Working activeProgram messages
This commit is contained in:
12
HCDevice.py
12
HCDevice.py
@@ -117,7 +117,6 @@ class HCDevice:
|
||||
raise Exception(f"{self.name}. Unable to configure appliance. Program UID {uid} is not a valid program.")
|
||||
|
||||
if 'options' in data:
|
||||
## TODO: Check to see if options is mandatory
|
||||
for option_uid in data['options']:
|
||||
if str(option_uid) not in self.features:
|
||||
raise Exception(f"{self.name}. Unable to configure appliance. Option UID {uid} is not valid for this device.")
|
||||
@@ -325,17 +324,6 @@ class HCDevice:
|
||||
self.services[service["service"]] = {
|
||||
"version": service["version"],
|
||||
}
|
||||
# print(self.name, now(), "services", self.services)
|
||||
|
||||
# we should figure out which ones to query now
|
||||
# if "iz" in self.services:
|
||||
# self.get("/iz/info", version=self.services["iz"]["version"])
|
||||
# if "ni" in self.services:
|
||||
# self.get("/ni/info", version=self.services["ni"]["version"])
|
||||
# if "ei" in self.services:
|
||||
# self.get("/ei/deviceReady", version=self.services["ei"]["version"], action="NOTIFY")
|
||||
|
||||
# self.get("/if/info")
|
||||
|
||||
else:
|
||||
print(now(), self.name, "Unknown", msg)
|
||||
|
||||
15
hc2mqtt
15
hc2mqtt
@@ -112,8 +112,12 @@ def client_connect(client, device, mqtt_topic):
|
||||
|
||||
host = device["host"]
|
||||
device_topics = topics
|
||||
active_program = False
|
||||
|
||||
for value in device["features"]:
|
||||
# If the device has the ActiveProgram feature it allows programs to be started and scheduled via /ro/activeProgram
|
||||
if "BSH.Common.Root.ActiveProgram" == device['features'][value]['name']:
|
||||
active_program = True
|
||||
if (
|
||||
"access" in device["features"][value]
|
||||
and "read" in device["features"][value]["access"].lower()
|
||||
@@ -132,6 +136,12 @@ def client_connect(client, device, mqtt_topic):
|
||||
mqtt_set_topic = mqtt_topic + "/set"
|
||||
print(now(), device["name"], f"set topic: {mqtt_set_topic}")
|
||||
client.subscribe(mqtt_set_topic)
|
||||
|
||||
if active_program:
|
||||
mqtt_active_program_topic = mqtt_topic + "/activeProgram"
|
||||
print(now(), device["name"], f"program topic: {mqtt_active_program_topic}")
|
||||
client.subscribe(mqtt_active_program_topic)
|
||||
|
||||
client.on_message = on_message
|
||||
|
||||
while True:
|
||||
@@ -156,11 +166,6 @@ def client_connect(client, device, mqtt_topic):
|
||||
if value is None:
|
||||
continue
|
||||
|
||||
# new_topic = topics[topic]
|
||||
# if new_topic == "remaining":
|
||||
# state["remainingseconds"] = value
|
||||
# value = "%d:%02d" % (value / 60 / 60, (value / 60) % 60)
|
||||
|
||||
new_topic = device_topics[topic]
|
||||
state[new_topic] = value
|
||||
update = True
|
||||
|
||||
Reference in New Issue
Block a user