Fix linting
This commit is contained in:
6
hc2mqtt
6
hc2mqtt
@@ -48,13 +48,14 @@ def hc2mqtt(
|
|||||||
elif rc == 0:
|
elif rc == 0:
|
||||||
print(now(), f"MQTT connection established: {rc}")
|
print(now(), f"MQTT connection established: {rc}")
|
||||||
client.publish(f"{mqtt_prefix}LWT", payload="Online", qos=0, retain=True)
|
client.publish(f"{mqtt_prefix}LWT", payload="Online", qos=0, retain=True)
|
||||||
|
# Re-subscribe to all device topics on reconnection
|
||||||
for device in devices:
|
for device in devices:
|
||||||
mqtt_set_topic = f"{mqtt_prefix}{device['name']}/set"
|
mqtt_set_topic = f"{mqtt_prefix}{device['name']}/set"
|
||||||
print(now(), device["name"], f"set topic: {mqtt_set_topic}")
|
print(now(), device["name"], f"set topic: {mqtt_set_topic}")
|
||||||
client.subscribe(mqtt_set_topic)
|
client.subscribe(mqtt_set_topic)
|
||||||
for value in device["features"]:
|
for value in device["features"]:
|
||||||
# If the device has the ActiveProgram feature it allows programs to be started and
|
# If the device has the ActiveProgram feature it allows programs to be started
|
||||||
# scheduled via /ro/activeProgram
|
# andi scheduled via /ro/activeProgram
|
||||||
if "BSH.Common.Root.ActiveProgram" == device["features"][value]["name"]:
|
if "BSH.Common.Root.ActiveProgram" == device["features"][value]["name"]:
|
||||||
mqtt_active_program_topic = f"{mqtt_prefix}{device['name']}/activeProgram"
|
mqtt_active_program_topic = f"{mqtt_prefix}{device['name']}/activeProgram"
|
||||||
print(now(), device["name"], f"program topic: {mqtt_active_program_topic}")
|
print(now(), device["name"], f"program topic: {mqtt_active_program_topic}")
|
||||||
@@ -146,7 +147,6 @@ dev = {}
|
|||||||
def client_connect(client, device, mqtt_topic):
|
def client_connect(client, device, mqtt_topic):
|
||||||
host = device["host"]
|
host = device["host"]
|
||||||
device_topics = topics
|
device_topics = topics
|
||||||
active_program = False
|
|
||||||
|
|
||||||
for value in device["features"]:
|
for value in device["features"]:
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user