rospogrigio / localtuya

local handling for Tuya devices
GNU General Public License v3.0
2.95k stars 563 forks source link

Garage Door open by itself #1051

Closed jforestd closed 2 years ago

jforestd commented 2 years ago

Hi!

I think the new update created a bug somewhere. My garage door automatically open at 3am this morning! I look in HA logg and it seams like the devise was unavailable for a fraction of second, and the I assume the system tought it was open, so he try to close it by itself.

I was quite afraid!

Thanks,

Aldaran commented 2 years ago

Eh, I also had problems after the update... My ZMAi-90 Energy Meter turns off its internal relay, as a result I am left without power... Today this happened for the second time (when restarting Home Assistant) since the update, the first was immediately after updates. Never had a problem before the latest update.

sss2400 commented 2 years ago

Same problem w/ Garage door!

SmileyZomb commented 2 years ago

My circuit breaker shutdown randomly after update, my light too

remlei commented 2 years ago

probably related to #1019 again

I suggest downgrading to v4.0.0 if you want a workaround for this issue.

jeremysherriff commented 2 years ago

It is normal for the tuya devices to appear to be offline briefly (showing as unavailable). The state normally corrects within 5 seconds, sometimes a little longer but usually very quickly. The correct action you should take is to set your automation to look for a specific from and to state, or to not take action if the previous state was unavailable using a template condition like this:

condition:
  - condition: template
    value_template: "{{ trigger.from_state.state != 'unavailable' }}"

I can confirm that this situation is normal for older localtuya (e.g. 3.x) and also for many other integrations - the unavailable state can happen during HA start-up, during local network disruption, and where there are limitations on the number of connected clients (as is often the case with tuya devices).

Aldaran commented 2 years ago

It is normal for the tuya devices to appear to be offline briefly (showing as unavailable). The state normally corrects within 5 seconds, sometimes a little longer but usually very quickly. The correct action you should take is to set your automation to look for a specific from and to state, or to not take action if the previous state was unavailable using a template condition like this:

condition:
  - condition: template
    value_template: "{{ trigger.from_state.state != 'unavailable' }}"

I can confirm that this situation is normal for older localtuya (e.g. 3.x) and also for many other integrations - the unavailable state can happen during HA start-up, during local network disruption, and where there are limitations on the number of connected clients (as is often the case with tuya devices).

Here the problem is not due to automation (like mine), I use a wifi meter to get 'total energy', the built-in relay is a side 'evil'. And I don't have any automation that uses this switch, the only one is just added via DP. Your example doesn't matter at all...

jeremysherriff commented 2 years ago

@Aldaran, my response is in regards to the issue raised by OP, regarding the garage door opening during the night after the switch has changed state unexpectedly. Your issue is unrelated, and is to do with the default state of specific DPs during the start-up of the integration. You should open your own issue.

remlei commented 2 years ago

@Aldaran, my response is in regards to the issue raised by OP, regarding the garage door opening during the night after the switch has changed state unexpectedly. Your issue is unrelated, and is to do with the default state of specific DPs during the start-up of the integration. You should open your own issue.

im pretty sure it has nothing to do with HA last state as well so your post is probably offtopic or rather unrelated.

in short it has something related regarding 4.1.0 update with added DPS RESET functionality. which causes device to act weird, eg, lights turning on randomly, fans turning off randomly, smartplugs/smart power strip turning off randomly, etc...

this bug only recently surfaced and not present on older versions.

heck I can actually reproduce this bug by just simulating a unavailable event on tuya device (a simple WIFI DEAUTH on the device is more than enough) and I can consistently trigger the device ON or OFF when it gets reconnected., so if the device is ON, it will turn off, if the device is off, it will turn on, if the device is passive, it will always follow its default state.

jforestd commented 2 years ago

To ve honest I just wanted to rise the defect 😅 My gf was so piss that I decided to try normal tuya. Back in the days I went with local tuya since garage dooor were a mess in the original integration. TY for the answer. I think as remlei mention it is related to issue #1019. I will close the defect to avoid duppicate.