summaryrefslogtreecommitdiff
path: root/bin/mqtt_node_util.py
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2023-09-07 00:38:21 +0300
committerEvgeny Zinoviev <me@ch1p.io>2023-09-07 00:38:21 +0300
commit94afba2bb100504c19c271ea10ae7a95058d3e08 (patch)
treefed050f198f34326577d32694e9baa9d8f4b3b08 /bin/mqtt_node_util.py
parente97f98e5e27a6df3827564cce594f27f18c89267 (diff)
mqtt_node_util: add --legacy-relay option
Diffstat (limited to 'bin/mqtt_node_util.py')
-rwxr-xr-xbin/mqtt_node_util.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/mqtt_node_util.py b/bin/mqtt_node_util.py
index 420a87e..cf451fd 100755
--- a/bin/mqtt_node_util.py
+++ b/bin/mqtt_node_util.py
@@ -23,6 +23,7 @@ if __name__ == '__main__':
help='mqtt modules to include')
parser.add_argument('--switch-relay', choices=[0, 1], type=int,
help='send relay state')
+ parser.add_argument('--legacy-relay', action='store_true')
parser.add_argument('--push-ota', type=str, metavar='OTA_FILENAME',
help='push OTA, receives path to firmware.bin')
@@ -45,7 +46,10 @@ if __name__ == '__main__':
if arg.modules:
for m in arg.modules:
- module_instance = mqtt_node.load_module(m)
+ kwargs = {}
+ if m == 'relay' and arg.legacy_relay:
+ kwargs['legacy_topics'] = True
+ module_instance = mqtt_node.load_module(m, **kwargs)
if m == 'relay' and arg.switch_relay is not None:
module_instance.switchpower(arg.switch_relay == 1)