Sonoff Sv Garage Door status issue

Hi, I’m new in HA, I just setup everthing via DrZz’s guide on youtube.
I’ve flash sonoff sv to latest tasmota firmware 8.3.1, then set GPIO14 to switch2(10),GPIO 4 to Relay2 (22) and put following commands in tamota console:

I can see the status changes of reed switch in console

18:12:11 MQT: cmnd/garagestate/POWER2 = ON (retained)
18:12:13 MQT: cmnd/garagestate/POWER2 = OFF (retained)

But the two arrows do not turn to grey when I test the reed switch, they are always black
I do not know where I’m wrong, could anyone help me? please.


It works when I click any arrows, just can not see the status
My configuaration in HA

cover:
  - platform: mqtt
    name: garage
    state_topic: cmnd/garagestate/POWER2
    command_topic: cmnd/sonoff/POWER
    payload_open: ON
    payload_close: ON
    payload_stop: ON
    state_open: ON
    state_closed: OFF
    optimistic: false

Anyone help me? I’m getting stuck here.

off top of head think you have you state_topic: wrong

try

state_topic: stat/garagestate/POWER2 or with out the 2

think of it this way

state_topic: get the state of it

command_topic: send this command

you could go into the console and have a look at what its sending

at work having smoko cant test

Here is what I use with my sonoffsv and a reed switch.

  - platform: mqtt
    name: Garage Door
    state_topic: "tele/garagestate/SENSOR"
    value_template: '{{ value_json.Switch2  }}'
    command_topic: "cmnd/sonoff/POWER1"
    availability_topic: "tele/sonoff/LWT"
    payload_open: "1"
    payload_close: "1"
    payload_stop: "1"
    qos: 1
    state_open: "ON"
    state_closed: "OFF"
    retain: false
    payload_available: "Online"
    payload_not_available: "Offline"

Hi, Myle
Thanks for replying. I’ve tried the code start from stat and without 2 as well.

Unfortunately, still not work.

Thanks, HickHackerz

I’ve copied yours to my configuaration.yaml, but the result is the same, two arrows are always black, never turn to grey. but I click any arrows, they work.

oddly, I do not know where I’m wrong.

any wrong setting in my tasmota console?

You can check Tasmota console, you are wanting to see what your topic is for the Switch2 status.
Something like

08:28:15 MQT: tele/sonoffsv/SENSOR = {"Time":"2020-05-22T08:28:15","Switch2":"OFF"}

Change the state_topic: “tele/garagestate/SENSOR” and value_template: ‘{{ value_json.Switch2 }}’ then accordingly.
Also you will want to change the logging interval to be shorter. Telemetry period is default 300 seconds but 30 seconds works for me.

Which version of HA are you using? I think there was a bug with this card between 0.109 and 0.109.3
Probably not the case I but thought I should mention it

Thanks for that.

I’ve check the topic you mentioned, look like this

04:34:06 MQT: tele/sonoff/SENSOR = {"Time":"2020-05-23T04:34:06","Switch2":"OFF"}

So I’ve changed the code to

  - platform: mqtt
    name: Garage Door
    state_topic: "tele/sonoff/SENSOR"
    value_template: '{{ value_json.Switch2  }}'
    command_topic: "cmnd/sonoff/POWER1"
    availability_topic: "tele/sonoff/LWT"
    payload_open: "1"
    payload_close: "1"
    payload_stop: "1"
    qos: 1
    state_open: "ON"
    state_closed: "OFF"
    retain: false
    payload_available: "Online"
    payload_not_available: "Offline"

then set the Telemetry period to 30

when I restart HA, the down arrow turn to grey, but the problem is that no matter how I change the state of the magnet, the state in HA will not change, and the downward arrow is always grey.

Thanks for reminder
But I’m using the latest version Home Assistant 0.110.1

I checked and I have my switch set at switchmode 2 1

I’ve done it, they are all solid black now.

I found a issue in tasmota is that the toggle 2 is always off even if I put the magnet on or away. does it matter?

the toggle 2 will turn to ON when I put the magnet on before I setup MQTT, after I done the MQTT setting, the state of toggle 2 won’t work at all.

Im not using a Sonoff Sv but i have the same configuration on tasmota and this configuration is working for me:

Switchretain
stat/garage/RESULT = {“SwitchRetain”:“ON”}
Powerretain
stat/garage/RESULT = {“PowerRetain”:“OFF”}
switchtopic2
stat/garage/RESULT = {“SwitchTopic”:“SENSOR”}
switchmode1
stat/garage/RESULT = {“SwitchMode1”:0}
switchmode2
stat/garage/RESULT = {“SwitchMode2”:2}

  cover:
  - platform: mqtt
    state_topic: "cmnd/SENSOR/POWER2"              #SwitchTopic Enabled
    command_topic: "cmnd/garage/POWER1"
    availability_topic: "tele/garage/LWT"  
    name: "Garage Door"
    qos: 0
    retain: false
    payload_open: "ON"
    payload_close: "ON"
    payload_stop: "ON"
    state_open: "ON"
    state_closed: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"  

Make sure that your reed switch is connected properly.

OMG
Your setting works to me!
finally works!

Thank you so much!!!

Hi everybody. The garage switch is my first HA project. Thanks for the wealth of information so far. I’m having the exact same issue. I’ve tried the solution that worked for @leotantantan and still nothing. I’ll paste some screen grabs of my setup. The main difference with me is that I didn’t physically alter the SV, I added a relay instead of hacking the board. (If this is why it doesn’t work I’ll kick myself)

My switch works when I press the toggle button, and the arrows…and the stop button.
I’ve got a pulse time of 0,5 sec so the switch opens again after the press.
At this stage everything seems to work except for the feedback on HA on whether the garage is open or closed.

My settings are as @oriolism’s solution.

Switchretain
stat/garage/RESULT = {“SwitchRetain”:“ON”}
Powerretain
stat/garage/RESULT = {“PowerRetain”:“OFF”}
switchtopic2
stat/garage/RESULT = {“SwitchTopic”:“SENSOR”}
switchmode1
stat/garage/RESULT = {“SwitchMode1”:0}
switchmode2
stat/garage/RESULT = {“SwitchMode2”:2}

Any help is greatly appreciated.

Turns out I can only do one pic per post…

Turns out I can’t only do 3 replies too :joy:. If anybody responds i’ll send some more screengrabs

fixed

this method will stop on 12-22 update. We need to do the reconfiguration! but I’m not sure how yet!Screen Shot 2022-09-08 at 2.06.41 PM

it should be set inside the mqtt:

or the way i did it

created a script:

reset_garage_door:
  sequence:
    - service: switch.turn_on
      entity_id: switch.garage_door
#    - delay:
#        seconds: 1
#    - service: switch.turn_off
#      entity_id: switch.garage_door

then Created

  - platform: template
    covers:
      garage_door:
        friendly_name: "Garage Door"
#        value_template: {% if is_state("binary_sensor.garage_door", "off") %}closed{% else %}open{% endif %}
        position_template:  '{% if is_state("binary_sensor.garage_door", "off") %}0{% else %}100{% endif %}'
        open_cover:
          service: script.turn_on
          data:
            entity_id: script.reset_garage_door
        close_cover:
          service: script.turn_on
          data:
            entity_id: script.reset_garage_door
        stop_cover:
          service: script.turn_on
          data:
            entity_id: script.reset_garage_door
        icon_template: >-
          {% if is_state('binary_sensor.garage_door',"on") %}
            mdi:garage-open
          {% else %}
            mdi:garage
          {% endif %}

them in the Sonoff SV you need to set the

SwitchDebounce thing I Think its been a LONG LONG time I played with it as it just worked