Issues with Shelly 1PM + HA via MQTT

Hi everybody,

I have a Shelly 1PM (which is connected to some lights) and I’m trying to control it with HA via MQTT.
I started by doing some tests with the MQTT Explorer and I was able to see the topics status changing whenever I toggled the input. Also, everything worked fine when I forced a command, using the explorer.
However, when I try to do the same using HA I face some issues. I’m able to send the “on” command but I never get the feedback of the state, this way I can’t send the “off” command.

My configuration.yaml is as follows:

light:
  - platform: mqtt
    name: test
    state_topic: “shellies/shelly1pm-xx/relay/0”
    command_topic: "shellies/shelly1pm-xx/relay/0/command"
    payload_on: "on"
    payload_off: "off"
    qos: 1

Just for testing the state change, I did the following configuration, and I was able to see the state change feedback in HA, by toggling the 1PM input.

sensor:
  - platform: mqtt
    name: test1
    state_topic: “shellies/shelly1pm-xx/relay/0”
    qos: 1

I have the latest HA version and also Shelly 1PM latest firmware.

What am I doing wrong?

Thanks for the support.

Looks good according to the Welcome to Shelly Technical Documentation | Shelly Technical Documentation

Are other mqtt devices working correctly with Home Assistant?

Have you checked the mosquitto addon logs?

Hi @tom_l ,

In the meantime I’ve already found the issue, the quotation marks were wrong, probably due to a copy paste from some example…

These quotation marks are not being accepted:

 state_topic: “shellies/shelly1pm-xx/relay/0”

Changed to these and now I have the state feedback being updated properly, using the light configuration :slight_smile::

state_topic: "shellies/shelly1pm-xx/relay/0"

I found out because I’ve tried to test again the sensor example that I’ve put here and it was not working anymore :smiley:.

Many thanks.

1 Like

i have the same setup excepted not for lights but only for power off .Status are seen in HA Dashboard but no command are executed, and nothing change - mqtt log no action seen

any ideas ?