activate developer tools on android phone and open
enable usb logging
install adb on your laptop
navigate to folder where you installed adb on cmd line
Run adb logcat > logcat.txt
start the app mentioned by @fastraxhttps://github.com/clach04/python-tuya/wiki/bin/Jinvoo%20Smart%201.0.3.apk 1
ensure devices are removed and re add your device whilst adb logcat is running
checkout logcat.txt
remove all apps
However, when I tried to turn on the light, i still got an error:
2018-07-18 18:50:48 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall switch.turn_on: entity_id=['switch.harveylight']>
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1021, in _event_to_service_call
await service_handler.func(service_call)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/switch/__init__.py", line 109, in async_handle_switch_service
await switch.async_turn_on()
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/homeassistant/.homeassistant/custom_components/switch/tuya.py", line 132, in turn_on
self._device.set_status(True, self._switchid)
File "/home/homeassistant/.homeassistant/custom_components/switch/tuya.py", line 96, in set_status
return self._device.set_status(state, switchid)
File "/srv/homeassistant/lib/python3.5/site-packages/pytuya/__init__.py", line 294, in set_status
data = self._send_receive(payload)
File "/srv/homeassistant/lib/python3.5/site-packages/pytuya/__init__.py", line 167, in _send_receive
data = s.recv(1024)
socket.timeout: timed out
1. Enable Tuya Platform: (pls note: all values are strings)
tuya:
username: 1234567890' // this is my 10 digit mobile no starting w/area code
password: 'your password' // this is my password for IoT account on Tuya site
country_code: '1' // this is for US. change to match your country
2. Setup Entities (devices) in config.yaml:
group
Tuya_Devices:
name: Tuya Devices
entities:
- switch.000000000000000000 //ha discovered this for me after step 1 restart
- light.00000000000000000000 //and this too
light:
- platform: tuya
host: 192.168.X.XX
local_key:
device_id:
friendly_name: Tuya Light
optimistic: true
id: 2
switch:
- platform: tuya
host: 192.168.X.XX
local_key:
device_id:
friendly_name: Tuya Switch
optimistic: true
id: 1
3. Discover some devices automatically discovery: //this may help discover devices, was always toward the top of config file in my case
and all you have to do is delete/rename the file, and in my case, I also remove the py_cache directory just in case since I have no idea how python cache its own compiled binaries.
I can’t seem to get my account linked. I keep getting errors upon restarting referencing an invalid config on the Tuya component even when I’m just adding the login information (Though the configuration validator says it’s good). I’m using my normal Tuya login, though I’ve seen some people reference using the IoT platform log in. Do I need to make an IoT account then transfer my devices to that?
I have NO idea what those “id: 1” is for. I think someone here in the forum managed to get tuya to work without it. Since my tuya works right now, I am not going to touch anything unless it’s absolutely necessary
That doesn’t seem to be it. I looked in the server files, and in home-assistant.log, I found the error referencing Tuya. It seems like it isn’t able to authenticate. Again, I’m using my normal Tuya account, not IoT.
tuyapy.tuyaapi.TuyaAPIException: get access token failed
Also, thank you for your help. It’s very much appreciated.
EDIT: I am using a multi-socket switch (Power strip).
it looks like your devID and/or localKey is not correct. you want to make absolutely sure that you got the right pair of information (see my post above)
Both are accurate. I decided to try to make an account with the Tuya IoT site, and then use that login information for the Tuya component, and it worked. I seem to be able to login to the Tuya app using that login information, and I can add devices from there.
I’d like to know if anyone is able to get the Tuya component working with an account created in the app instead of on the Tuya site. If not, that should be added to the documentation as a possible requirement.