Cant get MQTT working - Using Hassio but the switch does not appear on my home page - My config is as follows:
switch:
- platform: mqtt
name: “Sonoff”
state_topic: “stat/sonoff/POWER”
command_topic: “cmnd/sonoff/POWER”
qos: 1
payload_on: “ON”
payload_off: “OFF”
retain: true
My MQTT config as follows:
{
“logins”: [
{
“username”: “davidtja”,
“password”: “P/W”
}
],
“anonymous”: false,
“customize”: {
“active”: false,
“folder”: “mosquitto”
},
“certfile”: “fullchain.pem”,
“keyfile”: “privkey.pem”
}
And my log
what does your interface yaml look like for that particular switch? Does it show up in the states/current entities
Well, did you tell HA to display it on the home page?
1 Like
I suspect that may be my mistake!
Interface Yaml? I just put a “Switch” entry as detailed above in my config file.
I suspect therefore I need something else?
Appreciate advice.
you need to actually have the switch entity in a user interface either the original interface (frontend) or via lovelace.
all you’ve done is ‘added’ the device to your system.
But I’m sure i’ve simply had this before, Perhaps my formatting is wrong?
switch:
- platform: mqtt
name: “Bedroom Switch”
state_topic: “home/bedroom/switch1”
command_topic: “home/bedroom/switch1/set”
availability_topic: “home/bedroom/switch1/available”
payload_on: “ON”
payload_off: “OFF”
state_on: “ON”
state_off: “OFF”
optimistic: false
qos: 0
retain: true
If the switch works, then the formatting is correct.
You have to add it to a group and add your groups to the frontend or you need to learn how to use Lovelace.
Ok thanks, that makes much more sense. I’m (Obviously) quite new to this… Is it better to learn Lovelace?
I believe everything is going over to lovelace. It actually allows for a lot more freedom when designing your frontend. If you’re just starting out you’d be better off just jumping right in to Lovelace
1 Like