Fix all off (calling own videv all_off rx method)

This commit is contained in:
Dirk Alders 2025-08-30 17:40:38 +02:00
parent 991eeeb2d6
commit abfbf2496a

View File

@ -166,7 +166,7 @@ class all_off(videv_base):
for key in self.__inst_dict__:
all_off_topic = "/".join([topic, key])
logger.info("Addin all_off callback with topic %s", repr(all_off_topic))
mqtt_client.add_callback(all_off_topic, self.all_off)
mqtt_client.add_callback(all_off_topic, self.rx_all_off)
def __check_inst_capabilities__(self, name, inst):
if hasattr(inst, "ADD_TO_VIDEV_ALL_OFF"):
@ -194,6 +194,9 @@ class all_off(videv_base):
else:
self.__add_instances__(name + "/" + sub_name, sub, level=level+1)
def all_off(self, client, userdata, message):
def rx_all_off(self, client, userdata, message):
key = message.topic[len(self.topic) + 1:]
self.__inst_dict__[key].all_off()
try:
self.__inst_dict__[key].all_off()
except:
logger.exception("Failed to switch of %s", repr(key))