Hi, of course I will try it. But please can you tell me what I have to do?
Replace the cover.py file in your localtuya folder with the one you find here:
https://raw.githubusercontent.com/rospogrigio/localtuya/cover_fix_time_nonetype/custom_components/localtuya/cover.py
And let us know…
yes, it is working
thank you!
Hi, @rospogrigio.
With the last master branch 3.1.0, also a lot of entries appeared in the logs.
Entries in the logs
Logger: custom_components.localtuya.light
Source: custom_components/localtuya/pytuya/__init__.py:132
Integration: LocalTuya integration (documentation, issues)
First occurred: 10:25:53 (518 occurrences)
Last logged: 10:33:25
[121...281] Entity light.in_wall_dimmer_2 is requesting unset index for option color_mode
[121...281] Entity light.in_wall_dimmer_2 is requesting unknown DPS index None
[830...dcb] Entity light.on_wall_dimmer is requesting unset index for option color_mode
[830...dcb] Entity light.on_wall_dimmer is requesting unknown DPS index None
[046...60d] Entity light.in_wall_dimmer_1 is requesting unset index for option color_mode
[046...60d] Entity light.in_wall_dimmer_1 is requesting unknown DPS index None
But there is no color_temp or color_mode DP in dimmers. Brightness DP only.
OnWall dimmer has:
OnWall Dimmer
InWall dimmer has:
InWall Dimmer
In InWall Dimmers - DP 101 is a separate setting for the minimum brightness level.
Or is it okay?
Thanks.
I have been spending hours with no luck with different android emulators, different versions of tuya apps and attempts with local sniffers on my samsung phone, but no luck of getting the IDs of my motion sensors or switches.
Does anyone please have a method that always work for you? From a windows computer or non-rooted android phone?
Thanks
Hi. I use this method:
For those who use the Tuya Smart app on Android, and have a PC with Windows OS.
For getting the Tuya Smart LocalKey (or device ID, or etc.). There a method a “easier” way.
The Tuya Smart app stores the LocalKey in a XML-File on your phone/tablet. Usually you can’t access it until the phone is rooted. But don’t worry, no need to root your phone, there is a easier way.
We will install a Android emulator, root it, install the Tuya Smart app and extract the keys. To do so, go to:
and download the latest BlueStacks Tweaker (Link is on top of the page) and Bluestacks installation (down below) according to your OS (32/64Bit).
Also go town to “utils” and download SuperSu 2.82-SR5.apk and Root Checker Pro 1.6.2.apk.
Then install Bluestacks, and after installation, follow the first instructional video on the page to root Bluestacks.
With rooted Bluestacks, go to Play Store and Download “Tuya Smart” app.
N.B. Version Tuya Smart App should be no higher v.3.6.1
Make sure to run it once, login and access your device’s once!
This is essential because only when doing so, it will get the configuration to our Bluestacks rooted phone!
Next, install “ES File Explorer” from Google Play store.
Set ES File Explorer to “Root Mode” (Scroll down left to find “Root Explorer”)
a warning will popup if root sholud be granted, grant it.
root sholud be granted
Now on the right, navigate to:
/data/data/com.tuya.smartlife/shared_prefs
shared_prefs
You end up in a folder with some XML-files, this is where we want to go.
XML-files
Find the file called:
preferences_global_key_<some chars and numbers>.xml
and click it. ES File Explorer will open it (or better copy file and open in Notepad++). You will find the ID of your device’s!
I use this method to get local ID for devices of various manufacturers, for example Tuya Smart, Xiaomi, Midea Air.
Hi
apparently there is still something wrong.
Today some of my covers where grayed out and I could not use them at all, even with the slider
The logs are
og Details (ERROR)
Logger: homeassistant
Source: components/tuya/__init__.py:146
First occurred: 7:44:52 AM (17 occurrences)
Last logged: 9:50:01 AM
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/tuya/__init__.py", line 153, in async_poll_devices_update
device_list = await hass.async_add_executor_job(_get_updated_devices)
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/tuya/__init__.py", line 146, in _get_updated_devices
tuya.poll_devices_update()
File "/usr/local/lib/python3.8/site-packages/tuyaha/tuyaapi.py", line 166, in poll_devices_update
return self.discover_devices()
File "/usr/local/lib/python3.8/site-packages/tuyaha/tuyaapi.py", line 207, in discover_devices
devices = self.discovery()
File "/usr/local/lib/python3.8/site-packages/tuyaha/tuyaapi.py", line 188, in discovery
response = self._request("Discovery", "discovery")
File "/usr/local/lib/python3.8/site-packages/tuyaha/tuyaapi.py", line 267, in _request
self._raise_frequently_invoke(
File "/usr/local/lib/python3.8/site-packages/tuyaha/tuyaapi.py", line 292, in _raise_frequently_invoke
raise TuyaFrequentlyInvokeException(message)
tuyaha.tuyaapi.TuyaFrequentlyInvokeException: Method [Discovery] fails 1 time(s) using poll interval 60.0 - error: you can discovery once in 600 seconds
and
Log Details (ERROR)
Logger: homeassistant.util.logging
Source: util/logging.py:108
First occurred: 7:39:52 AM (1 occurrences)
Last logged: 7:39:52 AM
Exception in _update_handler when dispatching 'localtuya_50758014840d8e91f036': ({},) Traceback (most recent call last): File "/config/custom_components/localtuya/common.py", line 245, in _update_handler self.status_updated() File "/config/custom_components/localtuya/cover.py", line 168, in status_updated if self._state.isupper(): AttributeError: 'NoneType' object has no attribute 'isupper'
not sure for the connections issues because everything else was working ok or at least I think so
The first exception is from the regular tuya integration, so not a problem for us. The other indicates that a status update has been received, but for some reason we don’t have a state yet (I.e. value for the ID DP). This is a case I guess shouldn’t happen, but maybe we should guard against it since it can happen sometimes when there’s an issue with the initial DP detection.
Hi
In Log for Dimmer. Dimmer work ON, OFF and adjust Brightness.
Dimmer ON:
WARNING
Logger: custom_components.localtuya.light
Source: custom_components/localtuya/pytuya/__init__.py:132
Integration: LocalTuya integration (documentation, issues)
First occurred: 11:16:22 (1080 occurrences)
Last logged: 11:20:09
[830...dcb] Entity light.on_wall_dimmer is requesting unset index for option color_mode
[830...dcb] Entity light.on_wall_dimmer is requesting unknown DPS index None
[830...dcb] Entity light.on_wall_dimmer is requesting unknown DPS index 1
[830...dcb] Entity light.on_wall_dimmer is requesting unknown DPS index 2
(1080 occurrences)
Dimmer OFF
Logger: custom_components.localtuya.light
Source: custom_components/localtuya/pytuya/__init__.py:132
Integration: LocalTuya integration (documentation, issues)
First occurred: 11:16:22 (1424 occurrences)
Last logged: 11:28:23
[830...dcb] Entity light.on_wall_dimmer is requesting unset index for option color_mode
[830...dcb] Entity light.on_wall_dimmer is requesting unknown DPS index None
[830...dcb] Entity light.on_wall_dimmer is requesting unknown DPS index 1
[830...dcb] Entity light.on_wall_dimmer is requesting unknown DPS index 2
(1424 occurrences)
After reboot server:
Logger: custom_components.localtuya.light
Source: custom_components/localtuya/pytuya/__init__.py:132
Integration: LocalTuya integration (documentation, issues)
First occurred: 11:33:29 (12 occurrences)
Last logged: 11:33:29
[830...dcb] Entity light.on_wall_dimmer is requesting unknown DPS index None
[121...4c6] Entity light.in_wall_dimmer_1 is requesting unset index for option color_mode
[121...4c6] Entity light.in_wall_dimmer_1 is requesting unknown DPS index None
[121...281] Entity light.in_wall_dimmer_2 is requesting unset index for option color_mode
[121...281] Entity light.in_wall_dimmer_2 is requesting unknown DPS index None
How to fix this?
This thread is the very definition of impenetrable! So I apologize if I ask a question that’s been asked, but I only read through 30-40 posts before I gave up.
I got seven of Nedis Smartlife Switches a few days ago on “this is leaving our sortiment sale”, so I figured they were the old firmware, which I was going to do the Tuya flash with. Turned out that they have the new firmware that doesn’t work with that. And I can’t depend on always having the cloud available. So I have started my attemps to get Tuya local working.First, I found this way of getting the info necessary for the switches was the easiest (creating a project on Tuya IoT platform, installing the python scripts on the Pi and running the wizard):
I got the info I needed, and it was also able to check the device locally, so it’s working.
Then I added the integration with “Add integration” in two Pis, and I put my first switch in there. So far it seemed good. Only it doesn’t work as it should. I click the switch, but nothing happens, and the slider on the swith goes back. Turning the switch off and on manually doesn’t make it change in the GUI. So something’s obviously wrong. When adding the device I saw the alternatives ‘1’: True, ‘2’: 0, and I have tried both versions. I actually had to delete the integration, restart Hass and add it all again to do that. Anyway, it didn’t help.
Can somebody please put me out of my misery?
You should add a switch
as entity and use 1 as the datapoint for ID. That should be it. Check the logs for potential errors.
@rospogrigio Just wanted to thank you for such a great item developed.
Ive been messing around with Tasmota / ESPhome and after seeing a few plugs and switches with Tuya on them in costco I bought them (normally I’m browsing amazon trying to find old versions), got them home hooked them up and then added your Localtuya with the app sync to grab the key via tuyaapi and the setup is 1) much faster to add devices than tasmota 2) much easier to control / build the mapping than either 3) much nicer integrated into HA!
Really great work!
There’s clearly something wrong here. I set it up like this:
Then I got this result:
And I could turn it on. Then off. And then nothing. The slider jumped back to on, while the switch was off, so naturally I could not do anything with it. I am guessing that the log is about that:
Edit: After a few reboots I can see that it works one or two clicks every time, then the same “Heartbeat failed” error comes and it stops working.
Did you access your device on the Tuya app at all?
Yeah, no problem. That’s 100 % reliable, when the broadband is working. Which is is now, but not always. During winter storms the cables can be damaged.
Hi. I currently have the HA version 0.115.6 and I don’t want to update to the latest version at the moment, due to the problems with the python version, it would be possible to use LOCAL yours in my version.
I have tried and the switch does not work for me, it recognizes it, I put all the information on it and it lets me create the entity, but it does not act on it.
Then I have tried to install the custom component from HACS and I have discovered that it requests 0.116 as a minimum version, is it possible to update to this version and not to the last one, and if I do, the phyton version will be fine?
Thanks for the help!! a greeting
You just mentioned that it worked with the app. First of all, make sure you don’t have the regular tuya integration set up. Remove if you do. Also, make sure you kill the app completely and try again. Tuya devices normally only work with one user at the time, so you need to make sure no one else (e.g. an app) is active at the same time as this integration.
I believe 0.115 is fine, but you will have to install it manually. For further problems, open issues at GitHub and include debug logs. We don’t follow up bug reports here as it’s hard to keep track for us.