Mqtt and switches

Thanks. I need to find a step by step to install HassIO in docker.

I installed HA OK, but not HassIO and had no joy withgetting Mosquitto password and user configured.

This is a very simple guide to install Hassio on Ubuntu 18 in Docker

ok, I just checked the console of sonoff tasmota and saw the following when I clicked the switch :

16:45:24 MQT: stat/HA/living/RESULT = {“Command”:“Unknown”}

here is my code in my configuration.yaml :

switch:

  • platform: mqtt
    name: “switch”
    icon: mdi:lightbulb-on
    command_topic: “cmnd/HA/living”
    state_topic: “stat/HA/living”
    payload_on: “ON”
    payload_off: “OFF”
    state_on: “ON”
    state_off: “OFF”
    optimistic: false
    qos: 0
    retain: false

so what could be wrong?

Do you have Tasmota?
If yes, the command topic should be %prefix%/%topic%/

So if the %topic% is HA the should be something like RELAY1 or POWER1.

Where did you get living?

“living” is dutch for the place where we have our couch and TV :slight_smile:

I want to have different sonoffs in my house, so I need to configure them each differently (each their own topic)

I think you need to add /POWER to the end of both of your topic strings

For my tasmota flashed Sonoff basics I use this config (topic is lamp)

mqtt:
  embedded:
switch:
  - platform: mqtt
    name: "lamp"
    state_topic: "stat/lamp/POWER"
    command_topic: "cmnd/lamp/POWER"
    availability_topic: "tele/lamp/LWT"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    payload_available: "Online"
    payload_not_available: "Offline"
    retain: false


I know what living stands for :smiley:

As also @reef-actor said, you need to complete the cmnd with POWER if your sonoff has just one relay.

Same thing for the state_topic

1 Like

It works!
woohoo, so glad! :slight_smile:

2 more questions and then this topic is closed for me.

  1. Is mqtt / tasmota case sensitive?
    Because sometimes you see users using : POWER, Power, power, …

  2. after I change something in the configuration.yaml, I always reboot my mini PC, is there another way for just resetting the layout of the screen?

@woody4165 : I still use Mosquitto by the way, didn’t change to the embedded broker, so Mosquitto works without a problem.

I think Tasmota is case sensitive

Complete reboot PC??? No!

If you change just lovelace.yaml, if you’re using it, there is nothing to do.

If you change any other yaml files, you can just restart HA with Settings->General->Restart, but I suggest always to do a Check before restarting

Well done for Mpsquitto

lovelace.yaml?

ui-lovelace.yaml is the file where you can optionally manually configure the layout of your pages (documentation). If you are using the visual editor (the default) you will not have it.

1 Like

What version of HA do you have?