ollo69 / ha_tuya_custom

Tuya Custom Component for testing
Apache License 2.0
39 stars 18 forks source link

Refresh time is too long #36

Open arebollom opened 3 years ago

arebollom commented 3 years ago

Hello, Testing with my climate I have seen that if I manually dial the thermostat a temperature takes more than 5 min to be reflected in the climate.xxxxx

It's normal? with tuya intration the gap is "only" 1 minute

Thanks,

ollo69 commented 3 years ago

Currently the refresh time is 5 min. due to discovery command limitation in API. HA Tuya integration don not use discovery and polling time is lower, but in many case can fail to refresh. So my question is: using HA integration update come regularly every minutes or just some time?

arebollom commented 3 years ago

With tuya integración HA, It is refresh every minite

hribarrobert commented 3 years ago

In other systems like Alexa, tuya elements are refreshed on 10s interval. Can we also achieve this kind of relatively acceptable delay?

ollo69 commented 3 years ago

In other systems like Alexa, tuya elements are refreshed on 10s interval. Can we also achieve this kind of relatively acceptable delay?

This is not possible, Tuya API is not supporting this refresh interval. At this moment the API is returning that "discovery" command can be called once every 300 sec. (and switch must use "discovery") and "query" to single device can be called once every 60 sec. This means that if you have more than 1 device query is not usable and so minum refresh time with more that 1 device is 5 minutes, quite ridiculous. I'm going to think how to release a new version that will not use "discovery" in case of single device, but I cannot do better than this, unless Tuya will change API behavior.

hribarrobert commented 3 years ago

So Tuya is then treating other big players like Amazon-Alexa, diferently than normal users are allowed through Tuya API?

ollo69 commented 3 years ago

This are not standard API but a dedicated API created by Tuya for HA some years ago. But yes, it is possible, generally speaking, that Amazon and Google have a preferred channel with Tuya than me and you, surprised?

ollo69 commented 3 years ago

With tuya integración HA, It is refresh every minite

With last release if you have only climate registered in Tuya app now refresh should be every minute. Can you check this?

arebollom commented 3 years ago

remains the same, has a refresh time of 5 minutes

ollo69 commented 3 years ago

How many devices connected to your Tuya account you have? Which type?

arebollom commented 3 years ago

I have 3 thermostats MOEs

ollo69 commented 3 years ago

So, just to better understand, using Tuya standard component, if you change, at the same time, some status on all 3 thermostats, after 1 minute status for all thermostats are updated in HA?

arebollom commented 3 years ago

Indeed, with your standard we update every minute, with custom every 5 minutes

ollo69 commented 3 years ago

But do you really perform the test that I said before using standard integration? Because if your 3 devices are all updated in HA at the same time and after 1 minute, I'm missing somenthing! My expectation is that only 1 device is updated with standard integration!!!