Closed polyedre closed 4 years ago
As this library rely on python-tuya, the best is to try manually to get your device working.
local_key
and your device_id
>>> import pytuya
>>> device = pytuya.OutletDevice('DEVICE_ID_HERE', 'IP_ADDRESS_HERE', 'LOCAL_KEY_HERE')
>>> device.status()
fan.py
, switch.py
, etc module
I think you can take inspiration on sensor.py
even if this is not the best piece of codeOther inspiration: https://github.com/home-assistant/home-assistant/pull/11000/files https://github.com/home-assistant/home-assistant/pull/15399/files
Both of my devices are timing out locally, they work fine via the App (I've even put my phone in airport mode, as I've read many devices only allow 1 connection)
import pytuya device = pytuya.OutletDevice('xxxxxxxxx', 'xxx.xx.xxx.xxx', 'xxxxxx') device.status() Traceback (most recent call last): File "
", line 1, in File "/usr/local/lib/python3.7/site-packages/pytuya/init.py", line 256, in status data = self._send_receive(payload) File "/usr/local/lib/python3.7/site-packages/pytuya/init.py", line 166, in _send_receive data = s.recv(1024) socket.timeout: timed out
Yes, you need to close the app if you want to use this API :)
Still cannot access, even with the App Closed or even without the mobile device on the wifi
You can check if you receive broadcast from the device. When it is not in communication with a device, it sends UDP packets to port 6666 using broadcast.
Try nc -lup 6666
(make sure the app is closed)
Nope had this running while i was out of the house the other day and nothing.....
Interestingly I now have my devices working locally with this custom component https://github.com/stast1/localtuya how this differs to yours I don't know as it is also using pytuya, so this issue can be closed unless you are going to add this support for yourself.
Very strange, because the part that wasn't working for you seemed to be the pytuya part !
This repo only support smart plug and is specific for retrieving monitored data about power consumption, how can I add support for other devices ?