Closed homecb closed 3 years ago
I don't know programming, but is the HA team able to improve this in future updates?
pt., 26 cze 2020, 10:15 użytkownik Naoki Sawada notifications@github.com napisał:
As @ollo69 https://github.com/ollo69 said, the cause of this problem is the Tuya API request limit. The HA side cannot solve the cause.
I tried the verification and correction by the following PR.
- ollo69/ha_tuya_custom#1 https://github.com/ollo69/ha_tuya_custom/pull/1
As a result of taking measures for the time being, the status change made in HA is reflected immediately and the problem disappears even on the UI.
However, if you change the status with the Smart Life app, etc., there will be a time lag of several seconds to 2 minutes before it is reflected in HA.
In order to do a complete sync, you have to do the sync locally, such as with localtuya, but there is no way to get the device local key automatically and integrating it is very expensive.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/36744#issuecomment-650048564, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOWN4V36YOAVLAKOWF5BH6DRYRKJLANCNFSM4N4XQGEA .
I don't know programming, but is the HA team able to improve this in future updates? pt., 26 cze 2020, 10:15 użytkownik Naoki Sawada notifications@github.com napisał: … As @ollo69 https://github.com/ollo69 said, the cause of this problem is the Tuya API request limit. The HA side cannot solve the cause. I tried the verification and correction by the following PR. - ollo69/ha_tuya_custom#1 <ollo69/ha_tuya_custom#1> As a result of taking measures for the time being, the status change made in HA is reflected immediately and the problem disappears even on the UI. However, if you change the status with the Smart Life app, etc., there will be a time lag of several seconds to 2 minutes before it is reflected in HA. In order to do a complete sync, you have to do the sync locally, such as with localtuya, but there is no way to get the device local key automatically and integrating it is very expensive. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#36744 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOWN4V36YOAVLAKOWF5BH6DRYRKJLANCNFSM4N4XQGEA .
Nope, this problem comes from Tuya. They seem to be closing down on people no using their apps (earlier this year they blocked tuya-convert for example)
I dont think the problem is the request limits, using the Appdaemon v4 they work fine.
Hi,
I have the device_id, local key and ip. I change the configuration.yalm and copy the files to config\custom_components\localtuya, I reset the server, I get no error just the new switch doesn't show up. I´m missing the part editing the switch.py and "and edit it for ID/DPS that is correct for your device." what exactly should I change?
Same issue here. Just joined the hassio program but my tuya devices state in the UI does not work properly. After deactivating a switch for example, the lovelace UI reverts back to state "active". However the devices are turning on and of just fine.
For covers (shutters) I use a cover template to get rid of the unknown state. Works fine if controlled by HA but because of the unknown state and lengthy delay in updates from Tuya it rarely reflects smartlife changes. I'm thinking of making all the light switches and power sockets into templates now to fix the HA control updates since these devices dont have an unknown state it should work.
Nope, this problem comes from Tuya. They seem to be closing down on people no using their apps (earlier this year they blocked tuya-convert for example)
First all thanks developer for your hard work. If a Tuya problem I don't understand. Why the Alexa integration work fine? ...
If a Tuya problem I don't understand. Why the Alexa integration work fine? ...
As they have developed the integration themselves they have access to a special API (probably) which isn't rate limietd.
If a Tuya problem I don't understand. Why the Alexa integration work fine? ...
The HA integration uses its own API endpoint for HA developed by Tuya.
-https://pypi.org/project/tuyapy/
However, this API library doesn't seem to have been updated in a long time.
Beginning earlier this month, requests to this API endpoint will frequently return errors. In addition, the documentation for this API endpoint is not publicly available, so we are limited in what we can do.
Is there a way we can contact Tuya to let them know? Perhaps they are unaware of the problem.
If they are aware and wont help, perhaps we should go review our purchases on Amazon to let others know about this new complication from this manufacturer.
Is there a way we can contact Tuya to let them know? Perhaps they are unaware of the problem.
I am writing to tuyasmart@tuya.com today, I've posted this issue with this Issue link. There is no reply so far. I will let you know as soon as they reply.
I don't think Tuya have completely abandoned this api or are unaware of problems. The other issue that happened last week was that color setting for color bulbs was suddenly broken, producing wrong colors when set by the HA Tuya component. That was fixed this week, apparently at Tuya's end. I don't think that could have been part of the rate-limit problem, although it may have been caused inadvertently by changes made at the same time.
I am writing to tuyasmart@tuya.com today, I've posted this issue with this Issue link. There is no reply so far. I will let you know as soon as they reply.
I'm starting to understand how many problems there are home automation built on integrations. I think it will be a difficult road to go. We will absolutely need a standard protocol, or it will be the end
Hi guys, can anybody help me. I extracted the local key, the device id and ip, I downloaded the localtuya and copy it to config\custom_components\localtuya in configuration.yalm I created the switch: as bellow, I deleted the tuya integration and rebooted the server. I get no error, but this switch doesn't appear anywhere. What I'm doing wrong?
switch:
Hi guys, can anybody help me. I extracted the local key, the device id and ip, I downloaded the localtuya and copy it to config\custom_components\localtuya in configuration.yalm I created the switch: as bellow, I deleted the tuya integration and rebooted the server. I get no error, but this switch doesn't appear anywhere. What I'm doing wrong?
switch:
- platform: localtuya host: 192.168.0.3 local_key: fe596182f1b77xxx device_id: 03132278a4cf1xxxxx name: Lamp1 update_interval: 3
Ok, I got it fixed with another version of the localtuya, an older version, the only problem the update_interval is not supported in this so it takes about 10 seconds to update https://github.com/fastcolors/localtuya-homeassistant
I sent a PR to PaulAnnekov/tuyaha.
Is the PR destination good there?
I'm thinking of making all the light switches and power sockets into templates now to fix the HA control updates since these devices dont have an unknown state it should work.
Using templates for Switches (for lights and sockets) doesn't have the same result that cover templates do. Not sure why...
I sent a PR to PaulAnnekov/tuyaha.
Is the PR destination good there?
How is the status ? When will be this fixed ?
Hi,
Thanks for all the work guys but what is the workaround? I have read all the posts, including the fixes that have now been deleted.
@nao-pon @ollo69 - what do you recommend? How do I install your latest updates? Where are the instructions? @ollo69 - your readme file tells me nothing. What, as code owner, is the latest status?
Do I have to go down the route of localtuya? does this synch with the smartlife app? So many unanswered questions here. Your expertise and opinion would be greatly appreciated.
tuyaha maintainer already gave an answer. There's some work to be done in order to fix this problem and he's aware of that as well as the colaborators of the tuyaha project. In the mean time, you can:
Patience is needed, since the problem is how tuyaha makes some queries to the tuya api, which is a relative flaky API in terms of TCP connection handling and rate-limiting.
@estebanz01
Thanks for your prompt response. However it doesn't answer the question of how to install the latest commits. And flashing devices means that only some of them will work as the rest can't be flashed.
Localtuya seems to be the answer but I still require the answer to my question, does it synch with smartlife app without delay. It seems to be quite an effort for something that might not work as well as the old tuya integration, so I am reticent to try it without a positive response to this question.
Especially as you are advocating patience here, but in the meantime my HA installation is useless.
All, @estebanz01 explain very well current situation. We cannot do miracle, response time provided by Tuya APi is not under our control and Tuya seems not be interested on fix this. At this moment I suggest to try to replace standard component with tuya_custom. This is exactly the same component implemented inside Home Assistant but with some change in the library used to comunicate with Tuya Cloud. This will not resolve all issue, but all possible feed-back will be usefull to find the best working solution. When a acceptable solution will be found, we will PR the change to TuyaHA library and in HA component. Installing the custom componet is really simple adding custom repository in HACS or manual copyng the component in your custom_components directory.
@ollo69 a basic approach to start fixing the issue at the origin https://github.com/PaulAnnekov/tuyaha/pull/38 . I'm looking at your tuya custom repo and it looks promising.
Trying @ollo69 workaround for the second day and everything is working perfect. I only have lights and plugs though, but it's working as intended.
@Duke-Box Remove the current Tuya component and install https://github.com/ollo69/ha_tuya_custom as a custom component instead. There are two ways to install it. One is to use HACS, and the other is to place the tuya_custom directory in the archive you downloaded in the custom_components directory. I recommend HACS.
Restart HA and install and use the Tuya Custom integration.
Controlling through HA all works. Changes in HA will be immediately reflected in the SmartLife app. However, there will be a time lag for the changes in the SmartLife app to be reflected in HA. This is indefinite between 15 seconds and 2 minutes. We have no control over this as it is due to the Tuya API.
PS, my work has been merged into ollo69/ha_tuya_custom.
Does this custom component still needs "local_key" for each device to be added to configuration.yaml ?
My solution is tuya-convert and tasmota firmware
My solution is tuya-convert and Taso firmware
I have bought 3 different switches which was listed at tuyaconvert compatiblity website, no one is flashable because of new firmware. Therefor that is no solution for me...
My solution is tuya-convert and tasmota firmware
Not for the faint of heart. I had to break out the Dremel and soldering iron for 3 out of 15 devices. If you have a slightly older Teckin SP20 DO NOT try tuya-convert on it, 2 out of 2 bricked for me. I had to serial flash them to recover. I have another 2 SP20's that I've left with the stock firmware to avoid the Dremel mess. Using the custom-tuya component for those. I also have a Martin & Jerry 3 way dimmer that can't take Tasmota (not ESP chip) so that's still on Tuya as well.
@Duke-Box Remove the current Tuya component and install https://github.com/ollo69/ha_tuya_custom as a custom component instead. There are two ways to install it. One is to use HACS, and the other is to place the tuya_custom directory in the archive you downloaded in the custom_components directory. I recommend HACS.
Restart HA and install and use the Tuya Custom integration.
Controlling through HA all works. Changes in HA will be immediately reflected in the SmartLife app. However, there will be a time lag for the changes in the SmartLife app to be reflected in HA. This is indefinite between 15 seconds and 2 minutes. We have no control over this as it is due to the Tuya API.
PS, my work has been merged into ollo69/ha_tuya_custom.
Can someone help me out here please. When adding the custom repository in HACS (repo URL, setting type to Integration) the save button remains disabled. Am I missing something?
Update: Upgraded HACS, working now.
The custom repository version is working nicely with my 2 remaining power sockets. It would be great if this version could read the power usage - I can't flash these remaining ones to Tasmota and it would be good to leave them with Tuya but get the readings!
I had to fight with this too... it took a few attempts but eventually HACS accepted it.
Can someone help me out here please. When adding the custom repository in HACS (repo URL, setting type to Integration) the save button remains disabled. Am I missing something?
My solution is tuya-convert and tasmota firmware
Not for the faint of heart. I had to break out the Dremel and soldering iron for 3 out of 15 devices. If you have a slightly older Teckin SP20 DO NOT try tuya-convert on it, 2 out of 2 bricked for me. I had to serial flash them to recover. I have another 2 SP20's that I've left with the stock firmware to avoid the Dremel mess. Using the custom-tuya component for those. I also have a Martin & Jerry 3 way dimmer that can't take Tasmota (not ESP chip) so that's still on Tuya as well.
Hi I have try all mode possible not only Tuya Convert... First soldering too....This il my first Slitinto 202
I can't suggest this mode because is not easy and is not the best result, anyway work fine and it can resume your bricked device...
Tuya convert guide on this video work fine for me....... on other two device one the same and one diffrent type.
Guys, thanks for all your input. Especially @allo69 and @nao-pon for your updates and instructions. After linking your custom component into HACS I see the instruction are there too - excellent
Ok - so removed old Tuya integration, restarted HA, installed the custom component through HACS, restarted HA, configured the custom tuya by Configurator/Integrations, restarted HA. all tuya devices found! Trouble is no one told me the entity names change! No problem just change them back through Configurator/Integrations/Tuya custom component/devices and update. All my automations/scripts and lovelace cards back and appear to be working with acceptable responses
Great work!
Update: after playing with this, the response between the HA UI and the device is virtually instantaneous, as is the status in the smartlife app. Trigger something In HA and the state changes in th UI and smartlife immediately. The delay between Smartlife and the HA UI is slow - between 15 seconds best and 1min 40 secs worst. However that's fine as I would only use one or the other to control devices and the delay in HA showing a change is not a show stopper for me.
I am very pleased with this :-)
Update: after playing with this, the response between the HA UI and the device is virtually instantaneous, as is the status in the smartlife app. Trigger something In HA and the state changes in th UI and smartlife immediately. The delay between Smartlife and the HA UI is slow - between 15 seconds best and 1min 40 secs worst. However that's fine as I would only use one or the other to control devices and the delay in HA showing a change is not a show stopper for me.
The real issue is if you have automations coded against a state change. I.e. if I press the physical kitchen smart light switch, also turn on the corner light. For those kind of automations, you don't want a two minute delay.
Now, if all your switches are Tuya, then one can actually use automations in the SmartLife/Tuya app instead of HA. But if you have a combination of ecosystems and want HA to manage such automations, you are screwed when there's a two-minute delay.
@ cannondale0815
Yes very true. I hadn't thought of that as I don't use smartlife automations. All my mixed ecosystem automations are within HA so that isn't a problem for me. Anything I have outside HA is usually an Alexa routine - so I should check those.
Good observation.
Update: after playing with this, the response between the HA UI and the device is virtually instantaneous, as is the status in the smartlife app. Trigger something In HA and the state changes in th UI and smartlife immediately. The delay between Smartlife and the HA UI is slow - between 15 seconds best and 1min 40 secs worst. However that's fine as I would only use one or the other to control devices and the delay in HA showing a change is not a show stopper for me.
The real issue is if you have automations coded against a state change. I.e. if I press the physical kitchen smart light switch, also turn on the corner light. For those kind of automations, you don't want a two minute delay.
Now, if all your switches are Tuya, then one can actually use automations in the SmartLife/Tuya app instead of HA. But if you have a combination of ecosystems and want HA to manage such automations, you are screwed when there's a two-minute delay.
Yeah, I have the same issue over here. I have a tuya switch on my sink light, when I turn it on manually I also want it to turn on my yeelight and set it to max brightness. I done this through HA and it worked very well until these recent issues.
With the current delay and incorrect status report it became too unreliable and I ended up exchanging it for a sonoff basic and I'll add the tuya on my garage where it doesn't need to trigger anything.
@connondale0815 @carlosvroque
I now see your point and I have the same with my HA automations triggered by an Alexa routine.
Time to rethink :-(
I think this problem will let me change everything I have from tuya for mqtt devices from other brands.. But I need switchs with wifi and rf, to use wall rf switches too..
@ollo69 @nao-pon i´m using custom component installed using hacs, and is working much better now.. The only issue i found is with cover switches, HA is always reporting that covers are oppening, when they aren´t oppening.
Maybe this happen because of the undefined state of the cover switch. When the covers are stopped, the switch should stay in undefined state, that way i can open or close. Right now they keep forcing the open state, that way if i want to open, i need to use the stop command first and only then i can use the open command. Other thing is that closing state is not showing up, i can close, but the state is not showed in HA.
@JorgeMaTeixeira since you have covers, can you try cloning this PR into your local https://github.com/PaulAnnekov/tuyaha/pull/38 and run the script I posted in a comment there? I really want to see if my proposal works for this device. I only have switches. Also, @ollo69, I'm wondering if you have a cover/fan/light on tuya for testing. 😁
@estebanz01 If it helps, it seems to be working with my Martin & Jerry 3 way dimmer switch:
Got devices
{ 'header': {'code': 'SUCCESS', 'payloadVersion': 1},
'payload': { 'devices': [ { 'data': { 'brightness': '91',
'online': True,
'state': 'false'},
'dev_type': 'light',
'ha_type': 'light',
'icon': 'https://images.tuyaus.com/smart/program_category_icon/tgq.png',
'id': 'eb26f9da7bd1477823lcx6',
'name': 'Stair Lights'},
{ 'data': {'online': True, 'state': True},
'dev_type': 'switch',
'ha_type': 'switch',
'icon': 'https://images.tuyaus.com/smart/icon/1511859381_0.png',
'id': '07200178dc4f223f5216',
'name': 'Anne TV Switch'},
{ 'data': {'online': True, 'state': False},
'dev_type': 'switch',
'ha_type': 'switch',
'icon': 'https://images.tuyaus.com/smart/icon/1526260644vu7k0j60o0tazwbryfb4bzkt9_0.jpg',
'id': '18480742cc50e3cf1271',
'name': 'Trent Light'},
{ 'data': {'online': True, 'state': False},
'dev_type': 'switch',
'ha_type': 'switch',
'icon': 'https://images.tuyaus.com/smart/icon/1526260644vu7k0j60o0tazwbryfb4bzkt9_0.jpg',
'id': '18480742cc50e3cefdca',
'name': 'Theo Light'}],
'scenes': []}}
@estebanz01 i will try, but i need toread first, I'm a newbie, everything is hard to me. Ahahah.
@Scope666 thanks! if you copy/paste this script https://github.com/PaulAnnekov/tuyaha/pull/38#issuecomment-652143897 to a new py file within the tuyaha folder you cloned, and just run it, it will automatically grab the light device and it will reflect the status in real time. Let me know if you can test it 😀 .
@JorgeMaTeixeira no worries! we are here to learn. You can do this in a terminal (mac OS or Linux):
git clone https://github.com/estebanz01/tuyaha
cd tuyaha
git checkout use-session-object
For windows, you can follow this tutorial: https://www.howtogeek.com/451360/how-to-clone-a-github-repository/
Then within the tuyaha folder, you just need to create a new py file and put this script in there: https://github.com/PaulAnnekov/tuyaha/pull/38#issuecomment-652143897. You can run it by doing python3 myscriptfile.py
.
Again, thank you all for you help!
Also in hassio tuya switch not have the control on/off
@Scope666 thanks! if you copy/paste this script PaulAnnekov/tuyaha#38 (comment) to a new py file within the tuyaha folder you cloned, and just run it, it will automatically grab the light device and it will reflect the status in real time. Let me know if you can test it 😀 .
Sorry for the delay, here you go. The light turned on and off as the script was running, matching the output:
Craigs-MBP:tuyaha craig$ python3 test.py
[ <tuyaha.devices.light.TuyaLight: "Stair Lights" (eb26f9da7bd1477823lcx6)>,
<tuyaha.devices.switch.TuyaSwitch: "Anne TV Switch" (07200178dc4f223f5216)>,
<tuyaha.devices.switch.TuyaSwitch: "Trent Light" (18480742cc50e3cf1271)>,
<tuyaha.devices.switch.TuyaSwitch: "Theo Light" (18480742cc50e3cefdca)>]
[ { 'data': {'brightness': '91', 'online': True, 'state': 'true'},
'dev_type': 'light',
'ha_type': 'light',
'icon': 'https://images.tuyaus.com/smart/program_category_icon/tgq.png',
'id': 'eb26f9da7bd1477823lcx6',
'name': 'Stair Lights'},
{ 'data': {'online': True, 'state': False},
'dev_type': 'switch',
'ha_type': 'switch',
'icon': 'https://images.tuyaus.com/smart/icon/1511859381_0.png',
'id': '07200178dc4f223f5216',
'name': 'Anne TV Switch'},
{ 'data': {'online': True, 'state': True},
'dev_type': 'switch',
'ha_type': 'switch',
'icon': 'https://images.tuyaus.com/smart/icon/1526260644vu7k0j60o0tazwbryfb4bzkt9_0.jpg',
'id': '18480742cc50e3cf1271',
'name': 'Trent Light'},
{ 'data': {'online': True, 'state': True},
'dev_type': 'switch',
'ha_type': 'switch',
'icon': 'https://images.tuyaus.com/smart/icon/1526260644vu7k0j60o0tazwbryfb4bzkt9_0.jpg',
'id': '18480742cc50e3cefdca',
'name': 'Theo Light'}]
turning on
True
turning off
True
turning on
True
I have the same issue here, I hope this is resolved soon!
Hi all, this seems Tuya's problem, I've submitted a ticket to Tuya official. If you have the same problem, please contact the online consult on page https://developer.tuya.com/en/demo
Guys, thanks for all your input. Especially @allo69 and @nao-pon for your updates and instructions. After linking your custom component into HACS I see the instruction are there too - excellent
Ok - so removed old Tuya integration, restarted HA, installed the custom component through HACS, restarted HA, configured the custom tuya by Configurator/Integrations, restarted HA. all tuya devices found! Trouble is no one told me the entity names change! No problem just change them back through Configurator/Integrations/Tuya custom component/devices and update.
Firstly, Thanks for all the effort and help, it really works.
After using the Custom, the switch has stop toggling back and show correct state when switched.
However, My Tuya temperature sensor is no longer working or showing the entity in HA after I use the tuya_custom
Can anyone help to fix this portion in Tuya_custom....Thanks in advance...you guys are great!
I suspect that climate device do not provide info throught discovery, so I need to revert last change. Are you able to enable debug and attach here your log file so that I can check better received information? You should add the following line in configuration.yaml:
logger:
default: info
logs:
custom_components.tuya_custom: debug
The problem
Tuya switch component works, but the toggle does not keep its state. The issue is a resurrection of https://github.com/home-assistant/core/issues/25992 I couldn't comment on that thread (locked), thus created a new one.
Environment
Problem-relevant
configuration.yaml
Traceback/Error logs
Additional information