shellyannouncegen2 issue
Closed this issue · 1 comments
Describe the bug
This is not really a bug!! When HA starts, shelly announce is triggerd but not all devices will be dicovered with the current state, some will report "unknown". Also the H&T devices will not get the correct values at once.
Expected behavior
the expectation is that all shelly devices will be discovered with the correct state when HA starts. If shelly announce is triggered manually after a while (3-5min), all shelly states will be recovered correctly and H&T devices will get the values. Maybe it will help, if shelly announce will be delayed after HA is fully startet. For me it looks like, that HA is not completely ready when shelly announce it triggered.
-->
Versions:
- Home Assistant: 2024.12
- Shellies Discovery GEN2: 3.6.0
- Shelly device firmware: 1.4.4
Shellies Discovery GEN2 automations:
``id: shellies_announce_gen2
alias: "Shellies Announce Gen2"
triggers:
- platform: homeassistant
event: start
actions:
- repeat:
for_each: "{{ device_ids }}"
sequence:
- action: mqtt.publish
data:
topic: "{{ repeat.item }}/rpc"
payload: "{{ get_config_payload }}"
- service: mqtt.publish
data:
topic: "{{ repeat.item }}/rpc"
payload: "{{ get_components_payload }}"
variables:
get_config_payload: "{{ {'id': 1, 'src': 'shellies_discovery', 'method': 'Shelly.GetConfig'} | to_json }}"
get_components_payload: "{{ {'id': 1, 'src': 'shellies_discovery', 'method':'Shelly.GetComponents', 'params': {'include': ['config']}} | to_json }}"
device_ids: # enter the list of device IDs (MQTT prefixes) here
Please provide Shellies Discovery automations (announce and discovery) here.
++++++++++++++++
id: shellies_discovery_gen2
alias: "Shellies Discovery Gen2"
mode: queued
max: 999
triggers:
- platform: mqtt
topic: shellies_discovery/rpc
actions:
- action: python_script.shellies_discovery_gen2
data:
id: "{{ trigger.payload_json.src }}"
device_config: "{{ trigger.payload_json.result }}"
- condition: template
value_template: "{{ 'mqtt' in trigger.payload_json.result }}"
- service: mqtt.publish
data:
topic: "{{ trigger.payload_json.result.mqtt.topic_prefix }}/command"
payload: "status_update"
Shelly device MQTT settings:
n/aDebug log:
will be delivered only if applicable in this caseCheck the discovery automation traces to see if it executes correctly after HA starts. Some HA instances have problems with this and need to add a delay to the announce automation.