Tuya LOCAL with energy monitoring and without tuya-convert

Because im an idiot. Added in a line just before leaving the house and it duplicated another line! Should be good now.

No worries! I got it installed now, and it worked great! Much easier than hunting for all the values every time and trying to remember where I installed tyua-cli.

Took me a minute to realize that the list would be spit out to file (should have read eh documentation the first time!). Would be nice if it could go to the log as well, but that is a very minor gripe.

I originally had it going to the log and wanted something that people could have open at the same time as they were adding the device. Was an easy edit though, so pushed 0.2 with it going to both the file and the log!

Happy its helped someone other than myself!

Awesome, just updated and tried it out, and looks great! I think this will help simplify the whole process for a lot of people.

This worked amazingly, took me barely any time - you are a genius

100% not! this is just using all the hard work from https://pypi.org/project/tinytuya/ and then packaging it with some simple scripts. I was thinking that the addon should run for 15 minutes and then shut down.

Would that be better than manually stopping it?

I think 15 minutes is a good idea

Added two config items, shutdown time and update time.

by default they do 300 seconds update (5 mins) and 900 seconds shutdown (15 mins) [by default the script adds 60 seconds to the shutdown to make it easier to judge the updates vs shutdowns.

Hi guys, iā€™m trying to add an RGB strip led by tuya local. Iā€™ve read the documentation but i canā€™t find anything about dp id 101 102 and 106 that iā€™ve. What are? So an other question, because my strip led have music mode, so i select it in entity configuration but it gives me back an error? Thanks a lot.

Hi everybody, we have just published a new release to celebrate the end of this f**king year:

If any of you were using the ā€œfakeā€ positioning mode for cover, please make sure you read the Release Notes VERY carefully, since now it has been renamed to ā€œtimedā€ (a much more appropriate name).
Thanks again for the almighty @postlund for his work, plus to @ultratoto14 who became a main collaborator, and all others who contributed.
Happy New Year to everybody, and stay safeā€¦ maybe we are seeing the end of the tunnel.

5 Likes

hi @rospogrigio, thank you all.
Unfortunately the new version brought a small problem. My two Teckin SP22 smartplugs have become ā€˜unavailableā€™.
The other seven smartplugs I own (six Bakibo TP22Y and one Gosund doubleplug SP211) continue to work very well with HA.
I activated the ā€˜debugā€™ function inside the ā€˜logsā€™ and I can see something strange. I will open a ticket on github shortly.
Happy New Year to you all and thank you for your work

1 Like

I also have the same problem with 4 Nooie smartplugs not found any more with latest version so I had to downgrade.

Are they on a different VLAN?

Hi @postlund,
all my devices are on same lan (no VLAN at all) and Iā€™m using them just in the localtuya integration (no regular tuya integration)

Happy New Year to all
today I tried to update the localtuya component to latest version. I am on 2020.12.2.
after the update I had to reenter all my covers. I manage to do that but one of them didnā€™t work. (they are all the same) So I remove it and tried to add it again. However the it wonā€™t let me. I got the following in the logs. any help what do I have to do to add it?

Logger: custom_components.localtuya.pytuya
Source: custom_components/localtuya/pytuya/__init__.py:554
Integration: LocalTuya (documentation, issues)
First occurred: 12:38:31 PM (1 occurrences)
Last logged: 12:38:31 PM

[507...614] Failed to get status: Unexpected payload=b'json obj data unvalid'
Traceback (most recent call last):
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 510, in detect_available_dps
    data = await self.status()
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 472, in status
    status = await self.exchange(STATUS)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 457, in exchange
    payload = self._decode_payload(msg.payload)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 554, in _decode_payload
    raise Exception(f"Unexpected payload={payload}")
Exception: Unexpected payload=b'json obj data unvalid'
Logger: custom_components.localtuya.config_flow
Source: custom_components/localtuya/pytuya/__init__.py:240
Integration: LocalTuya (documentation, issues)
First occurred: 1:16:02 PM (1 occurrences)
Last logged: 1:16:02 PM

Unexpected exception
Traceback (most recent call last):
  File "/config/custom_components/localtuya/config_flow.py", line 279, in async_step_basic_info
    self.dps_strings = await validate_input(self.hass, user_input)
  File "/config/custom_components/localtuya/config_flow.py", line 192, in validate_input
    detected_dps = await interface.detect_available_dps()
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 510, in detect_available_dps
    data = await self.status()
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 472, in status
    status = await self.exchange(STATUS)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 451, in exchange
    msg = await self.dispatcher.wait_for(seqno)
  File "/config/custom_components/localtuya/pytuya/__init__.py", line 240, in wait_for
    await asyncio.wait_for(self.listeners[seqno].acquire(), timeout=timeout)
  File "/usr/local/lib/python3.8/asyncio/tasks.py", line 498, in wait_for
    raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError

The problem above fixed in my browser ā€œclear cashed filesā€

I added the last cover. I have to say that in my case the previous version was much better.
My covers use the 1_2_3 positioning method. With the previous version (fake) the covers reporting their position with a number between 0-100. So I knew for example that in 50 were half opened. With the updated version they report only position 1 or 3 which not helping at all. The worst of all is that they report position 3 if they are half open or closed.

the slider is not working at all, and doesnā€™t report any position (stays at 0) when with the previous version it was working (at least somehow)

I would like to point out something that is not helping at all while in the configuration menu.
In the below menu I would like to remove the highlighted option (1 value 3) but there is now way.
I have to remove the device in order to ā€œplayā€ with the options to see which suits me most.
I hope there is a fix later because I think this is a bug

bug

One more serious problem is that the state for all positions is open (in developers tool) so most of my automation can not work. Before there was ā€œopeningā€, ā€œclosingā€ and ā€œunknownā€ depending on the position. Now in every case is ā€œopenā€.

Just installed with 4 smartplug Teckin SP22 (plug+energy monitoring)
I did nothing on yaml fileā€¦ just copied the file in the custom_component and used the integration

ID 19 is the instant energy consumed in W. I am trying try to make a complete list

Hi there, i got 4 Gosund EP2 here, already got all the localKeys, BUT, every value except voltage is 0. Why?
A light is connected and powered on.

here you can see that dps id 6 is probably voltage. but every other value is just 0.

I cant log in the smart life app with my tuya smart credentials. I normally use Tuya smart on my regular devices. Searched for those keys in the tuya smart app, but they are not there. though the smart life app does create them, but not available because I cant login

same problem