avoid sending modbus cmds in critical states

This commit is contained in:
Stefan Allius
2024-05-09 14:20:57 +02:00
parent 41d9a2a1ef
commit 5a0456650f
4 changed files with 25 additions and 7 deletions

View File

@@ -130,7 +130,7 @@ class Mqtt(metaclass=Singleton):
topic = str(message.topic)
node_id = topic.split('/')[1] + '/'
for m in Message:
if m.server_side and not m.closed and (m.node_id == node_id):
if m.server_side and (m.node_id == node_id):
logger_mqtt.debug(f'Found: {node_id}')
fnc = getattr(m, func_name, None)
if callable(fnc):
@@ -148,7 +148,7 @@ class Mqtt(metaclass=Singleton):
payload = message.payload.decode("UTF-8")
logger_mqtt.info(f'InvCnf: {node_id}:{payload}')
for m in Message:
if m.server_side and not m.closed and (m.node_id == node_id):
if m.server_side and (m.node_id == node_id):
logger_mqtt.info(f'Found: {node_id}')
fnc = getattr(m, "send_modbus_cmd", None)
res = payload.split(',')