Sonoff SV and Hassio - Garage Opener Status (OPEN/CLOSE) issue

Hi All

Hope your guys are well. I’m new to the forum.

Im currently using a Raspberry PI3 B, Sonoff SV and magnetic reed switch to control my Garage door. I do not get status update on open/close when making contact with reed switch. Status seems to get stuck in open position and stays there no matter the reed switch status. There is no problem activating the buttons to open and close for 1 second.
image

I cannot understand where im going wrong , see configuration below:

#In Configuration.yaml
cover:
platform: mqtt
name: “garage”
state_topic: “cmnd/2/POWER2”
command_topic: “cmnd/sonoffsv/POWER”
payload_open: “ON”
payload_close: “ON”
payload_stop: “ON”
state_open: “ON”
state_close: “OFF”
optimistic: false
retain: false

#In Groups:
garage_doors:
name: Garage Door
view: no
control: hidden
icon: mdi:garage
entities:

  • cover.garage

#In Customization:
cover.garage:
device_class: garage
friendly_name: Garage Door

When i toggle the reed switch , my sonoff console reflects these:
21:42:28 MQT: cmnd/2/POWER2 = OFF
21:42:28 MQT: cmnd/2/POWER2 = ON
21:42:30 MQT: cmnd/2/POWER2 = OFF
21:42:32 MQT: cmnd/2/POWER2 = ON

Please Help!!

Oddly enough, I got an SV working with my 2 garages and reed switches this morning. How are you determining the status?

On my setup I can tell whether the garage is open or closed by looking at the up and down arrows and seeing which is greyed. (That and using CustomUI to change the icon colour! :slight_smile: )

PS When you post code or yaml excerpts make sure to paste, then highlight and hit the </> button in the toolbar so people can read what you have posted.

Hi, I’m determining the status via a magnetic switch on GPIO14 and GND. However the open arrow is greyed out and does not change state even though I make and disconnect the magnetic switch…Not sure why…I will send my code asap…

image
I cannot understand where im going wrong , see configuration below:

#In Configuration.yaml
cover:
platform: mqtt
name: "garage"
state_topic: "cmnd/2/POWER2"
command_topic: "cmnd/sonoffsv/POWER"
payload_open: "ON"
payload_close: "ON"
payload_stop: "ON"
state_open: "ON"
state_close: "OFF"
optimistic: false
retain: false

#In Groups:
garage_doors:
name: Garage Door
view: no
control: hidden
icon: mdi:garage
entities:

cover.garage
#In Customization:
cover.garage:
device_class: garage
friendly_name: Garage Door

When i toggle the reed switch , my sonoff console reflects these:
21:42:28 MQT: cmnd/2/POWER2 = OFF
21:42:28 MQT: cmnd/2/POWER2 = ON
21:42:30 MQT: cmnd/2/POWER2 = OFF
21:42:32 MQT: cmnd/2/POWER2 = ON

OK, you need to highlight the bits you paste and then hit the </> key - not the whole post! It is impossible to see the indenting in either of the ways you have posted.

First thing I would try is watching your MQTT posts. When you open the door do you see a publication of

cmnd/2/POWER2 ON

at the broker?

cover:
  - platform: mqtt
    name: "garage"
    state_topic: "cmnd/2/POWER2"
    command_topic: "cmnd/sonoffsv/POWER"
    payload_open: "ON"
    payload_close: "ON"
    payload_stop: "ON"
    state_open: "ON"
    state_close: "OFF"
    optimistic: false
    retain: false
1 Like
   garage_doors:
    name: Garage Door
    view: no
    control: hidden
    icon: mdi:garage
    entities:
      - cover.garage
  cover.garage:
   device_class: garage
   friendly_name: Garage Door
When i toggle the reed switch , my sonoff console reflects these:

21:42:28 MQT: cmnd/2/POWER2 = OFF

21:42:28 MQT: cmnd/2/POWER2 = ON

21:42:30 MQT: cmnd/2/POWER2 = OFF

21:42:32 MQT: cmnd/2/POWER2 = ON

Where would i see the post at broker? In mosquito log? If so i see nothing…

And it was all going so well until your last paste!! :slight_smile:

Do you use the internal HA broker? Or are you using Mosquito, or something?

I use Mosquitto, and watch all my MQTT posts by running the following command at a terminal:

mosquitto_sub -u USERNAME -P PASSWORD -v -t #

but you may find it easier to use MQTT Spy

I can’t see anything obvious in your coding, so wonder if the Sonoff is posting correctly to the broker.

I’m using an add on Mosquitto mqtt within HASSIO

I think you need to change this to state_closed. Notice the “d” at the end.

Thanks to jcconnell’s solution. the “d” is key to fixing my sonoff status.
I think you need to change this to state_closed. Notice the “d” at the end.

Ok the new updates seem to break this in some way.

Sofar I have seen that the two lines need to be removed:

#    optomistic: false
#    retain:false

Also the UI is broken:

I dont get any notification if the port is opend anymore and no icon change either

@casperse, did you ever find a fix for the UI issue on the lovelace card? My states still aren’t updating.

No cant find any solution? (Anyone? please this is even breaking notification on the sensor when its open?)

Solution might be here?