From 74adba1a682eb3798a4c8d1d8cdb266abac65223 Mon Sep 17 00:00:00 2001 From: Monster1025 Date: Sat, 1 Apr 2017 22:52:49 +0300 Subject: [PATCH] allow to send commands to gateway --- src/main.py | 2 +- src/xiaomihub.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main.py b/src/main.py index 91fb2a4..24d48ca 100644 --- a/src/main.py +++ b/src/main.py @@ -86,7 +86,7 @@ if __name__ == "__main__": client = mqtt.Mqtt(config) client.connect() #only this devices can be controlled from MQTT - client.subscribe("gateway", "+", "rgb", "set") + client.subscribe("gateway", "+", "+", "set") client.subscribe("plug", "+", "status", "set") gateway = XiaomiHub(gateway_pass) diff --git a/src/xiaomihub.py b/src/xiaomihub.py index 5d43c8c..cbc9ed1 100644 --- a/src/xiaomihub.py +++ b/src/xiaomihub.py @@ -128,6 +128,7 @@ class XiaomiHub: def _send_socket(self, cmd, rtnCmd, ip, port): socket = self._socket try: + _LOGGER.info('Sending to GW {0}'.format(cmd)) self._read_unwanted_data() socket.settimeout(30.0) @@ -264,4 +265,4 @@ class XiaomiDevice(): return True def parse_data(self, data): - return True \ No newline at end of file + return True