mqtt_node_util: add --legacy-relay option
This commit is contained in:
parent
e97f98e5e2
commit
94afba2bb1
@ -23,6 +23,7 @@ if __name__ == '__main__':
|
|||||||
help='mqtt modules to include')
|
help='mqtt modules to include')
|
||||||
parser.add_argument('--switch-relay', choices=[0, 1], type=int,
|
parser.add_argument('--switch-relay', choices=[0, 1], type=int,
|
||||||
help='send relay state')
|
help='send relay state')
|
||||||
|
parser.add_argument('--legacy-relay', action='store_true')
|
||||||
parser.add_argument('--push-ota', type=str, metavar='OTA_FILENAME',
|
parser.add_argument('--push-ota', type=str, metavar='OTA_FILENAME',
|
||||||
help='push OTA, receives path to firmware.bin')
|
help='push OTA, receives path to firmware.bin')
|
||||||
|
|
||||||
@ -45,7 +46,10 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
if arg.modules:
|
if arg.modules:
|
||||||
for m in 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:
|
if m == 'relay' and arg.switch_relay is not None:
|
||||||
module_instance.switchpower(arg.switch_relay == 1)
|
module_instance.switchpower(arg.switch_relay == 1)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user