add heating profiles

This commit is contained in:
robert 2021-12-20 19:39:17 +01:00
parent 363c03ffa2
commit 6679f2b22b

View File

@ -6,7 +6,7 @@ import os
import homematicip import homematicip
from homematicip.home import Home from homematicip.home import Home
from homematicip.device import ShutterContact,HeatingThermostat,PlugableSwitchMeasuring,WallMountedThermostatPro from homematicip.device import ShutterContact,HeatingThermostat,PlugableSwitchMeasuring,WallMountedThermostatPro
from homematicip.group import HeatingCoolingProfile,HeatingGroup
# Import MQTT client. # Import MQTT client.
import paho.mqtt.publish as publish import paho.mqtt.publish as publish
import paho.mqtt.client as paho import paho.mqtt.client as paho
@ -25,7 +25,7 @@ client = paho.Client(protocol=paho.MQTTv31) # * set a random string (max 23 cha
# client.username_pw_set(mqtt_username, mqtt_password) # MQTT server credentials # client.username_pw_set(mqtt_username, mqtt_password) # MQTT server credentials
client.connect(mqtt_broker, 1883, 60) # MQTT server address client.connect(mqtt_broker, 1883, 60) # MQTT server address
# Homematic IP # Homematic IP
config = homematicip.find_and_load_config_file() config = homematicip.find_and_load_config_file()
home = Home() home = Home()
@ -67,10 +67,31 @@ def write_wallmountedthermostatpro(room,device):
print({"Room":room, "Device Name":device.label, "Last Status Update" : device.lastStatusUpdate, "Actual Temperature":device.actualTemperature, "Set Point Temperature":device.setPointTemperature,"Humidity":device.humidity}) print({"Room":room, "Device Name":device.label, "Last Status Update" : device.lastStatusUpdate, "Actual Temperature":device.actualTemperature, "Set Point Temperature":device.setPointTemperature,"Humidity":device.humidity})
def heating_profile(group):
#heatingGroup=homematicip.group.HeatingGroup(group)
#heatingGroup.__init__(home)
print("Heating Profiles")
print("Group Label: " + group.label)
print("Group Type: " + group.groupType)
print("Active Heating Profile: " + group.activeProfile.name)
for profile in group.profiles:
if profile.name != "":
print("Group Profile Name: " + profile.name)
#print("Profile ID: " + profile.id)
#print("Profile Index: " + profile.index)
if profile.name == "Home Office":
print("Profile Index" + profile.index)
print(group)
heatingGroup=HeatingGroup(group)
# print(heatingGroup.profiles[0])
group.set_active_profile(profile.index)
def main(): def main():
global home global home
home.get_current_state() home.get_current_state()
for group in home.groups: for group in home.groups:
# if group.groupType=="HEATING":
# heating_profile(group)
if group.groupType=="META": if group.groupType=="META":
for device in group.devices: for device in group.devices:
if isinstance(device,ShutterContact): if isinstance(device,ShutterContact):