Like many other posts I am really confused about MQTT, sonoffs and HassIO.
I have a ubuntu machine running as my MQTT broker in my home network on 192.168.1.38 using the standard port 1883.
I have 7 sonoff devices which are all auto detected and controlled by Tasmota inside HASSIO.
I have enabled MQTT on the Sonoffs and can see the messages going back and forwards in MQTT.FX
BUT
I cannot see any of these devices appearing in HASSIO itself. I set an automation script to force auto discovery
# Example automations.yaml entry
- alias: "Enable MQTT discovery for all devices"
trigger:
platform: homeassistant
event: start
action:
- service: mqtt.publish
data:
topic: "sonoffs/cmnd/SetOption19"
payload: "1"
- alias: "Power state on HA start-up"
trigger:
platform: homeassistant
event: start
action:
- service: mqtt.publish
data:
topic: "sonoffs/cmnd/state"
payload: ""
I have hard coded and removed ‘switch’ sections in configuration.yaml
Nothing ever lets me control the devices from the overview window of HASSIO.
If I hard code, I see the devices as switches on a panel, but nothing works. You click on a switch, it slides grey to blue, nothing happens and a second or two later it slides back to off.
I have sonoff-Tasmota 6.5.0 on all devices.
As two examples I have setup MQTT one sonoff as Topic = man_cave and the second as Topic=garage_light . The full topic is the default "%topic%/%prefix%/
In the tasmo admin panel in HASSIO if I select list devices, it shows their friendly names
ManCaveLight IP address, state, versions 6.5.0 etc
If I then click the cog wheel on the devices and select MQTT I see:
MQTT Host 192.168.1.38 Port 1883
MQTT Client Name = DVES_97252D
username and password are both as expected
MATT Topic = man_cave MQTT FullTopic=%topic%/%prefic%/
Group topic = sonoffs Button Topic and Switch Topic are both 0
Prefix 1: Command = cmnd Prefix 2:State =stat Prefix 3:Telemetry = tele
State Text: OFF = OFF State Text: ON = ON
I have hundreds of messages in MQTT Lens
some are under “man_cave/stat/STATUS1”
some are under “garage_light/stat/STATUS1” e.g.
{“StatusSTS”:{“Time”:“2019-03-20T00:51:12”,“Uptime”: “0T00:44:41”,“Vcc”:3.259,“SleepMode”: “Dynamic”,“Sleep”:50,“LoadAvg”:19,“POWER1”:“OFF”,“Wifi”:{“AP”:1,“SSId”:“TheBunns”, “BSSId”:“E8:FC:AF:FF:6F:CB”,“Channel”:11,“RSSI”:50,“LinkCount”:1,“Downtime”:“0T00:00:04”}}}
but right after starting HASSIO I got a few entries like:
homeassistant/light/97542D_L1_1/config
I also got only once messages as follows:
cmnd/sonoff_1/POWER with the message being OFF
cmnd/sonoff_5/POWER with the message also being OFF
I happen to know that I set sonoff_1 as my garage light and sonoff_5 as my man_cave light.
with entries for sensor, switch and light on the same topic
Never seen these again after start up.
So my questions are:
- How do I make sure these are seen in HASSIO?
- Setting Option 19 is often mentioned, but I cannot see this under any menu item in the sonoff configuration, either by directly accessing the device on port 80, or using tasmota admin in HASSIO.
- How do I get then name these devices in future automation?
I used to have this automation running
- id: '1530933735131'
alias: Garage Lights On
initial_state: 'on'
trigger:
- entity_id: sensor.garage_door_status
from: closed
platform: state
to: open
condition:
- after: '15:00:00'
before: 03:00:00
condition: time
action:
- data:
entity_id: switch.garage_lights
service: switch.turn_on
'''