Hello all
I’m pretty new to HA and all those technologies, then tapping blindly sometimes…
I’m running HA on RPi4 (default installation installed from image)
Recently bought a few pieces of Shelly 1 being wanted to automate them through MQTT.
I installed Mosquitto broker from official Hass.io repo using default config. I’ve created new user requested in installation manual.
Then following manual, I jumped into Configuration/Integration and added integration with MQTT which was announced and newly recognized one at this time. Unfortunately there is no shelly devices recognized by auto-discovery. I quess it’s because Shelly doesn’t conform MQTT topic format, required for auto-discovery.
Anyway, at first I attempted to try new relay with Node-Red. It worked at first try: it sends messages switching the relay, it receives states.
But then I wanted to add some visualization/button to HA dashboard. And I failed I spent literally 4 hours browsing Internet. I saw a lot of discussions about similar troubles, with suggestion to use automation script syncing Shellys at HA start. Nothing helped.
My configuration for shelly relay looks like this (I’m including whole switch section, which includes Twinkly too)
switch:
- platform: command_line
switches:
twinkly:
command_on: "python3 /config/python_scripts/twinkly.py 192.168.0.103 on"
command_off: "python3 /config/python_scripts/twinkly.py 192.168.0.103 off"
command_state: "python3 /config/python_scripts/twinkly.py 192.168.0.103 state"
value_template: "{{ value == \"1\" }}"
friendly_name: Twinkly
- platform: mqtt
name: "shelly1-10D891"
command_topic: "shellies/shelly1-10D891/relay/0/command"
state_topic: "shellies/shelly1-10D891/relay/0"
availability_topic: "shellies/shelly1-10D891/online"
qos: 1
retain: false
payload_on: "on"
payload_off: "off"
state_on: "on"
state_off: "off"
optimistic: false
This config allowed me to show “shelly1-10D891” on dashboard. unfortunately with status “unknown”
I attempted to add mqtt section to configuration.yaml (I saw somewhere “old-school” term for this) but this is probably not needed for native Mosquito plugin. Anyway if mosquito integration is removed then HA shows notification about not finding mqtt platform. With mosquito integration is added, then no error or warnings is shown, even without mqtt: section in configuration.yaml.
Right now two options seems to remain. Use REST integration (incl one available in HACS) or try Shelly discovery add-on for MQTT (also from HACS) but don’t know if it will work
Anyway I’m really curious why it doesn’t work and what I am doing wrong. I would like to understand that. Especially it works in Node-Red so communication Shelly-MQTT and MQTT-NodeRed is working.
Thanks in advance.