Hassio Sonoff Not working


#1

Hassio latest version - Sonoff Basic several. All except one is working. Below is the one that is not working. I can turn the lights off and on from TasmoAdmin without any problems. Hassio sends the cmnd/sonoffsinklights/POWER ON or OFF command but the sonoff does not respond with a stat message and the light stays in the same state.

Here is my conf.yaml and customize.yam

  - platform: mqtt
    name: "sonoffsinklight"
    state_topic: "stat/sonoffsinklights/POWER"
    command_topic: "cmnd/sonoffsinklights/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: false

switch.sonoffsinklight:
  friendly_name: Sink Light
  emulated_hue_hidden: false
  emulated_hue_name: sink light
  icon: mdi:lightbulb-on

The following is from the log.  See the cmnd but never see the stat from the device

2018-12-05 17:11:01 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on cmnd/sonoffsinklights/POWER: OFF

It's almost like Hassio isn't sending the cmnd to the device.

Any help would be appreciated.

#2

Check the mqtt topic in the device. Is it sonoffsinklights or sonoffsinklight ?


#3

Sorry for the mistake. I had changed everything to sonoffsinklight removing the s. It still does not work. Here is a screen shot of the mqtt configuration on the sonoff.

I still think the cmnd is not getting to the sonoff from hassio.

Thanks


#4

How do you know that? Have you checked it is actually sending the message with an MQTT sniffer or are you just assuming it’s sending it?


#5

I am looking at the hassio logs which show the string that is transmitted

2018-12-05 17:11:01 DEBUG (MainThread) [homeassistant.components.mqtt] Transmitting message on cmnd/sonoffsinklights/POWER: OFF

I did discover from the sonoff console that this basic is showing

07:30:26 MQT: Attempting connection…
07:30:26 MQT: Connect failed to 192.168.1.104:1883, rc 5. Retry in 10 sec

quite a bit of the time. I am wondering if the basic is having internal problems. I am going to try another module when I get a chance. It may be this sonoff. What has confused me is that I have no problem turning the light on and off using either a direct connection to the ip or via the TasmoAdmin add-on.

I do appreciate your looking at this and making suggestions.


#6

Ok. I recommend using an MQTT sniffer program to make sure that the message is actually making it to the broker.

Just because it says in the logs it is being sent it doesn’t mean the broker is necessarily receiving it.


#7

mosquitto_sub is your friend.


#8

That’s not a mistake. if it was sonoffsinklights it was correct.


#9

According to the screenshot above the correct topic is “sonoffsinklight”.


#10

Not according to the config he posted:

- platform: mqtt
    name: "sonoffsinklight"
    state_topic: "stat/sonoffsinklights/POWER"
    command_topic: "cmnd/sonoffsinklights/POWER"

#11

I think the config is wrong based on the screenshot of the actual values inside the sonoff as indicated by Tasmoadmin.

It should be “sonoffsinklight”.


#12

He misunderstood me when I asked him to check the device mqtt topic was actually plural and he needlessly deleted the ‘s’ (then took the screen shot).

So now he either has to change the device topics back to plural or edit the config as you suggest.


#13

I thought he was referring to the HA config that he removed the ‘s’ from to make it match the actual sonoff config.

But yes, fixing either of those should be OK as long as they both match exactly.


#14

Also have a look a the broker log. If you are using the Mosquitto addon it is below the config and network section in the hassio Mosquitto addon page. This will show you if connections to the broker from HA and the sonoff are successful.


#15

Well it turns out that the sonoff lost the password to the mqtt broker. As you know the password is not shown when you look at the device via TasmoAdmin or via the configuration using the ip address. However, as I indicated above there were time that it would loose connection to the broker then try to reconnect. Today it failed continually so I re-entered the password and restarted it and it’s now working.

Thanks for all the help and suggestions. I might have found this faster if I had been using a sniffer so will look at setting one up.


#16

MQTT.fx is my favourite but there are many others.


#17

Seems to be a problem with the Sonoff. Try to reflash it that solves problems like this for me most of the time.