Hi everyone!
I’m trying to connect my Shelly plus 1pm switches to HA using MQTT, I tried to follow any guide found around the web but I always get the same error: the entities are added but the device is unknown, therefore without the possibility of receiving the status or changing it. I followed the classic procedure to install and configure Mosquitto broker (with dedicated user mqtt_user) and enabled MQTT for the switch.
This is my configuration setup:
## configuration.yaml
automation: !include automations.yaml
mqtt:
switch: !include switches.yaml
binary_sensor: !include binary_sensors.yaml
## switches.yaml
- name: "Shelly Plus 1PM Switch"
unique_id: switch.shellyplus1pm-blabla_switch
payload_on: '{"id":1, "src": "homeassistant/shellies/shellyplus1pm-blabla", "method": "Switch.Set", "params":{"id":0,"on":true}}'
payload_off: '{"id":1, "src": "homeassistant/shellies/shellyplus1pm-blabla", "method": "Switch.Set", "params":{"id":0,"on":false}}'
qos: 1
state_topic: shellies/shellyplus1pm-blabla/status/switch:0
value_template: "{{ value_json.output }}"
state_on: true
state_off: false
command_topic: shellies/shellyplus1pm-blabla/rpc
## binary_sensors.yaml
- name: "Shelly Plus 1PM Input"
unique_id: binary_sensor.shellyplus1pm-blabla_input
value_template: "{{ value_json.state }}"
payload_on: true
payload_off: false
state_topic: shellies/shellyplus1pm-blabla/status/input:0
## automations.yaml
- id: shellies_get_status
alias: Shellies Get Status
description: ''
trigger:
- platform: homeassistant
event: start
- platform: time_pattern
hours: /1
condition: []
action:
- service: mqtt.publish
data:
topic: homeassistant/shellies/shellyplus1pm-blabla
payload: '{"id":1, "src": "homeassistant/shellies/shellyplus1pm-blabla", "method": "Shelly.GetStatus"}'
mode: single
As you can see, I’m able to find the entities in the mqtt integration, but they result unknown and not working.
Could you help me please? Thank you in advance!