Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

Lights works perfect but Switches have random delay #25

Open
Zkaning opened this issue Aug 26, 2020 · 9 comments
Open

Lights works perfect but Switches have random delay #25

Zkaning opened this issue Aug 26, 2020 · 9 comments

Comments

@Zkaning
Copy link

Zkaning commented Aug 26, 2020

Tested to install a fresh setup on both RaspPi3b+ and Virtual machine running Linux on a Laptop.
Everything is the latest version, including tuya_custom. Get the same problem on both.
Smartlife app is instant and I have a 100Gb fiber with a netgear nighthawk router.
The Lights are working instant! but the switches are randomly delayed up to 30s.
The logfile: "Updating tuya_custom switch took longer than the scheduled update interval 0:00:15"
Any ide on what can cause this and am I the only one with this problem?

@ollo69
Copy link
Owner

ollo69 commented Aug 26, 2020

The Tuya API Cloud not always respond, this is an issue not related to the component.
To better investigate you should enable debug and post here your log file.
Please provide also some additional detail:

  • how often issue occur?
  • how many switch do you have?

@Zkaning
Copy link
Author

Zkaning commented Aug 26, 2020

I put this in config file:
"
logger:
default: info
logs:
custom_components.tuya: debug
"

After 15min I got this in the logger:
Updating tuya_custom switch took longer than the scheduled update interval 0:00:15
3:14:13 PM – Switch (WARNING) - message first occurred at 2:57:13 PM and shows up 35 times
Error doing job: Task exception was never retrieved
3:11:48 PM – components/discovery/init.py (ERROR)
You are using a custom integration for tuya which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2:58:14 PM – loader.py (WARNING) - message first occurred at 2:58:14 PM and shows up 2 times

I have 35 switches connected but they all works instant when using smartlife app.
If I disconnect 25 of them the same problem is still showing.
The delay is variating between 3s to 30s
The response is sometimes instant (as in the smartlife app) and sometimes delayed as described above, it is random :(

Thanks for you reply!! // Fredrik

@ollo69
Copy link
Owner

ollo69 commented Aug 26, 2020

To have right debug log you should put this line (with right indentation):

logger:
  default: info
  logs:
    custom_components.tuya_custom: debug

Anyway consider that the problem is related to the Cloud API dedicated to HA, that from some months are limited in number of possible requests. Considering the number of switchs, you can consider a delay of 30s a good result, will be very hard to have better result, also because this component use cloud poll and so you will never have a real time status refresh.
Consider as alternative option to flash your device with Tasmota (if applicable) and control them locally using MQTT. Remote control should be managed using Alexa and Tasmota Hue emulation.

@Shaman2
Copy link

Shaman2 commented Aug 26, 2020

May you can try TuyaGateway, I try to use it one week and this addon work without any delay, work as localtuya, but faster. More difficult to set up, but the only component for HA that works without delay. I use it parallel with tuya_custom for testing

@Zkaning
Copy link
Author

Zkaning commented Aug 28, 2020

Ok, I actually used that indentation, just forgot the ".tuya_custom: debug" instead of ".tuya: debug"
Unfortunaly I dont find many of my tuya devices in the library for tasmota :(
Will try it again today, but, do you have any experience of using "TuyaGateway" @ollo69 ?
https://github.com/TradeFace/tuyagateway

@Zkaning
Copy link
Author

Zkaning commented Aug 28, 2020

May you can try TuyaGateway, I try to use it one week and this addon work without any delay, work as localtuya, but faster. More difficult to set up, but the only component for HA that works without delay. I use it parallel with tuya_custom for testing

Thanks for the tip, I would really like to try this! But I get stuck because my limited knowledge in coding but I found the addon now so will test that!

@Zkaning
Copy link
Author

Zkaning commented Aug 28, 2020

May you can try TuyaGateway, I try to use it one week and this addon work without any delay, work as localtuya, but faster. More difficult to set up, but the only component for HA that works without delay. I use it parallel with tuya_custom for testing

@Shaman2 How do I run this?
npm i @tuyapi/cli -g

@Shaman2
Copy link

Shaman2 commented Aug 28, 2020

May you can try TuyaGateway, I try to use it one week and this addon work without any delay, work as localtuya, but faster. More difficult to set up, but the only component for HA that works without delay. I use it parallel with tuya_custom for testing

@Shaman2 How do I run this?
npm i @tuyapi/cli -g

no, install addon for home assistant
https://github.com/sjthespian/addon-tuyagateway

for get localkey I uses LDPlayer4, where install Packet Capture and TuyaSmart (old version 3.11). Its very simple for me without command line

@Zkaning
Copy link
Author

Zkaning commented Aug 29, 2020

@Shaman2 Thanks for the tip! When retrieving the packages, how did you find the localkey?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants