Garage-Cover State

Hi. I have a sonoff SV with a reed switch to controll my garage door. The problem is when I restart home assistant or the electricity goes off, when it back on, the state of garage door is “unknown”… i have flashed tasmota. I tried a lot of things, but cant solve this problem. From HA, I can Change the state trought the state tab, if I set the json and itentity ID and some parametera in JSON. What I gotnin mind, is to create an automation to Change state at HA startup, but I cant. Any one can help menor guive me another solution? Thks

I too have this problem.

Normally I would solve it by turning on the MQTT retain flag for the status, using switchretain 1, since the SV (with the reed switch on GPIO4 or 14) reports the status as a cmnd.

The problem is that the main open/close switch is also controlled via a cmnd, and I am using the SV as a toggle (pulsetime 10). So if I retain the switch status then the state is reported ok, but the garage opens on a restart (since the “power on” is retained) - not ideal.

I’d be interested to hear if anyone has solved this issue.

I have the same problem and I have concept of automation in my mind but need help with code.

Tasmota sends SENSOR status (Switch ON or OFF) every minute, that can be stored in HA as sensor.

Automation to update switch state as ON
Trigger when SENSOR is ON - condition - cover.garagedoor is “unknown” - action - set state = Opened on entity cover.garagedoor.

similar automation to update switch state as OFF

This way garage door status will remain unknown for min or two after HA restart then automation will kicks in and update the state.

Hi. I solved it by every time that HA restart or something like that, it will keep the state was closed. The only problem is if for some reason you have garage door opened, and HA restar, it will state closed and in really, the garage its opened. But I think this is not a big problem, because normally we open door to leave or come house. And we close it. If you keep it open, its signal that youre at home, and if for some reason HA restart at that momment, when you close the door, the state keeps close again… But its not a big problem for me

so what did you do to make it close on HA restart?

Try this:
1st, change sonoff name. Because I faced some problems. Change name to make sure you get original configs. then acess to sonoff console and:

poweronstate 0
switchmode1 2
switchmode2 0
powerretain 0
pulsetime 15
switchtopic 2
switchretain 1