Merge pull request #14 from eburtsev/master
Added ability to set gateway discovery IP in config
This commit is contained in:
@@ -8,6 +8,7 @@ mqtt:
|
|||||||
json: False
|
json: False
|
||||||
|
|
||||||
gateway:
|
gateway:
|
||||||
|
ip: 192.168.0.47
|
||||||
password: passw0rd
|
password: passw0rd
|
||||||
polling_interval: 2
|
polling_interval: 2
|
||||||
polling_models:
|
polling_models:
|
||||||
|
|||||||
+2
-1
@@ -97,6 +97,7 @@ if __name__ == "__main__":
|
|||||||
gateway_pass = yamlparser.get_gateway_password(config)
|
gateway_pass = yamlparser.get_gateway_password(config)
|
||||||
polling_interval = config['gateway'].get("polling_interval", 2)
|
polling_interval = config['gateway'].get("polling_interval", 2)
|
||||||
polling_models = config['gateway'].get("polling_models", ['motion'])
|
polling_models = config['gateway'].get("polling_models", ['motion'])
|
||||||
|
gateway_ip = config['gateway'].get("ip", None)
|
||||||
|
|
||||||
signal.signal(signal.SIGINT, exit_handler)
|
signal.signal(signal.SIGINT, exit_handler)
|
||||||
signal.signal(signal.SIGTERM, exit_handler)
|
signal.signal(signal.SIGTERM, exit_handler)
|
||||||
@@ -109,7 +110,7 @@ if __name__ == "__main__":
|
|||||||
client.subscribe("gateway", "+", "write", None)
|
client.subscribe("gateway", "+", "write", None)
|
||||||
client.subscribe("plug", "+", "status", "set")
|
client.subscribe("plug", "+", "status", "set")
|
||||||
|
|
||||||
gateway = XiaomiHub(gateway_pass)
|
gateway = XiaomiHub(gateway_pass, gateway_ip)
|
||||||
stop_event= threading.Event()
|
stop_event= threading.Event()
|
||||||
t1 = threading.Thread(target=process_gateway_messages, args=[gateway, client, stop_event])
|
t1 = threading.Thread(target=process_gateway_messages, args=[gateway, client, stop_event])
|
||||||
t1.daemon = True
|
t1.daemon = True
|
||||||
|
|||||||
Reference in New Issue
Block a user