The obvious answer would be HA isn’t receiving the state message back again but don’t know why.
Is your console example just from turning it on and off from HA as mine doesn’t show any CMD messages, this is one turn on and then off from the HA front end on mine…
Yeah I can’t see why it’s not getting the state back.
HA’s log isn’t showing anything related to MQTT responses…
I can’t really turn it off from HA because the switch keeps jumping back to the off position. The cmnd entries you see are my manual entries in the console to turn it off
When I configure Hassio like this, the log of the mosquito broker says
starting version 3.2.2
1512735275: mosquitto version 1.4.12 (build date 2017-06-01 13:03:48+0000) starting
1512735275: Config loaded from /etc/mosquitto.conf.
1512735275: Opening ipv4 listen socket on port 1883.
1512735275: Opening ipv6 listen socket on port 1883.
1512735275: Warning: Mosquitto should not be run as root/administrator.
1512735461: New connection from 172.30.32.1 on port 1883.
1512735461: Socket error on client , disconnecting.
1512735830: New connection from 172.30.32.1 on port 1883.
1512735830: Socket error on client , disconnecting.
Be sure you’re using the username/password you set up in the broker not an overall HA one.
As @mr.sneezy did, try removing them from the equation altogether to be sure everything then works and it’s not misdirecting you away from a different fault.
Without a username and pass it works good.
when i put a username and password, in the config.yaml is changes the used password for a long string automatically.
Maybe that’s the problem.
BTW, I’m new to Hassio and raspberry pi and programming.
Love Hassio though.
Even my wife gets exited about home automation
Sorry I’m another stuck.
In the Broker window I get this: [INFO] found davidtja on local database 1543575809: New client connected from 192.168.0.56 as DVES_3A4FB9 (c1, k10, u’davidtja’).
So assume my MQTT side is set up correctly.
I have added to my config:
First thing to check would be to open the webpage of the sonoff and goto configuration/configure MQTT check the topic is the same as your command topic and state topic in your config.yaml entry
To see the switch on your homepage you need to add it to a group via it’s entity ID which will be something like switch.sonoff etc.
Really appreciate your response.
I don’t have it in my devices/entities.
In my configuration validation it says:
“Component not found: Switch”
My full topic is “%prefix%/%topic%/” (that’s as it was by default).
My topics in the config file are:
state_topic: “stat/sonoff/POWER”
command_topic: “cmnd/sonoff/POWER”",
Whereas on the actual Sonoff webpage its “Sonoff” - Perhaps that my mistake perhaps?
Thanks for providing the code basics. I have for days tried to get Tasmota/sonfoff working to no avail. I just pasted the switch config and there it is! A 2017 response I find helpful in 2019. LOL!