Shelly plus smoke - non discovered by MQTT
Closed this issue · 8 comments
Describe the bug
Shelly plus smoke configured (with RPC) and visible in MQTT broker (hosted on HA)
Gen2 script started manually (few times) while device is awake (hold button to wake/test shelly smoke)
via shelly API , HA autodiscover works without issue - this is to confirm network connection.
Expected behavior:
show shelly smoke as a recognized device in MQTT
Versions:
- Home Assistant: 2024.10.0
- Shellies Discovery GEN2: 2.34.1
- Shelly device firmware: 1.4.2-gc2639da
Shellies Discovery GEN2 automation:
- id: shellies_discovery_gen2
alias: Shellies Discovery Gen2
mode: queued
max: 999
trigger:- platform: mqtt
topic: shellies_discovery/rpc
action: - service: python_script.shellies_discovery_gen2
data:
id: '{{ trigger.payload_json.src }}'
device_config: '{{ trigger.payload_json.result }}' - service: mqtt.publish
data:
topic: '{{ trigger.payload_json.result.mqtt.topic_prefix }}/command'
payload: status_update
- platform: mqtt
Show me please shellies announce
automation and a debug log.
How to catch a debug log -> https://github.com/bieniu/ha-shellies-discovery-gen2?tab=readme-ov-file#how-to-debug
im using both scripts gen1 and gen2 (gen1 works awesome - you are a legend bro!)
- id: shellies_announce
alias: Shellies Announce
trigger:- platform: homeassistant
event: start - platform: time_pattern
hours: /1
action:
service: mqtt.publish
data:
topic: shellies/command
payload: announce
- platform: homeassistant
- id: shellies_discovery
alias: Shellies Discovery
mode: queued
max: 999
trigger:
platform: mqtt
topic: shellies/announce
condition:- condition: template
value_template: '{{ trigger.payload_json.gen is not defined }}'
action:
service: python_script.shellies_discovery
data:
id: '{{ trigger.payload_json.id }}'
mac: '{{ trigger.payload_json.mac }}'
fw_ver: '{{ trigger.payload_json.fw_ver }}'
model: '{{ trigger.payload_json.model | default }}'
mode: '{{ trigger.payload_json.mode | default }}'
host: '{{ trigger.payload_json.ip }}'
- condition: template
- id: shellies_announce_gen2
alias: Shellies Announce Gen2
trigger:- platform: homeassistant
event: start
variables:
device_info_payload: '{{ {''id'': 1, ''src'':''shellies_discovery'', ''method'':''Shelly.GetConfig''}
| to_json }}'
device_ids:- shellyplus2pm-485519a1ff8c
- custom-prefix/shelly-kitchen
action:
- repeat:
for_each: '{{ device_ids }}'
sequence:- service: mqtt.publish
data:
topic: '{{ repeat.item }}/rpc'
payload: '{{ device_info_payload }}'
- service: mqtt.publish
- platform: homeassistant
- id: shellies_discovery_gen2
alias: Shellies Discovery Gen2
mode: queued
max: 999
trigger:- platform: mqtt
topic: shellies_discovery/rpc
action: - service: python_script.shellies_discovery_gen2
data:
id: '{{ trigger.payload_json.src }}'
device_config: '{{ trigger.payload_json.result }}' - service: mqtt.publish
data:
topic: '{{ trigger.payload_json.result.mqtt.topic_prefix }}/command'
payload: status_update
- platform: mqtt
you are a legend bro!
Thanks!
device_ids:
- shellyplus2pm-485519a1ff8c
- custom-prefix/shelly-kitchen
Where is the Plus Smoke ID?
There is none , but smoke is communicating with mqtt (screenshot from mqtt explorer) and via Shelly api to HA. And I don’t own any Shelly 2pm device. :(
log from python:
home-assistant_python_script_2024-10-05T04-42-03.419Z.log
shelly smoke factory rested and added via shellly api for test:
And I don’t own any Shelly 2pm device. :(
You copied a sample automation and didn't fill it with your own data. You need to enter your device ID here. ID = MQTT prefix.
What a noob error! Thank you, and sry for trouble. Everything is working.
No worries