allow to send commands to gateway
This commit is contained in:
+1
-1
@@ -86,7 +86,7 @@ if __name__ == "__main__":
|
|||||||
client = mqtt.Mqtt(config)
|
client = mqtt.Mqtt(config)
|
||||||
client.connect()
|
client.connect()
|
||||||
#only this devices can be controlled from MQTT
|
#only this devices can be controlled from MQTT
|
||||||
client.subscribe("gateway", "+", "rgb", "set")
|
client.subscribe("gateway", "+", "+", "set")
|
||||||
client.subscribe("plug", "+", "status", "set")
|
client.subscribe("plug", "+", "status", "set")
|
||||||
|
|
||||||
gateway = XiaomiHub(gateway_pass)
|
gateway = XiaomiHub(gateway_pass)
|
||||||
|
|||||||
+2
-1
@@ -128,6 +128,7 @@ class XiaomiHub:
|
|||||||
def _send_socket(self, cmd, rtnCmd, ip, port):
|
def _send_socket(self, cmd, rtnCmd, ip, port):
|
||||||
socket = self._socket
|
socket = self._socket
|
||||||
try:
|
try:
|
||||||
|
_LOGGER.info('Sending to GW {0}'.format(cmd))
|
||||||
self._read_unwanted_data()
|
self._read_unwanted_data()
|
||||||
|
|
||||||
socket.settimeout(30.0)
|
socket.settimeout(30.0)
|
||||||
@@ -264,4 +265,4 @@ class XiaomiDevice():
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def parse_data(self, data):
|
def parse_data(self, data):
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user