Shellies Discovery Gen2 Script

Information could be useful, there are 20 Shelly devices so far, all gen 3, 12 dimmers, the rest are 1PM and mini, and a plus1,they all worked fine on shelly integration, i am rebuilding with everything mqtt, its only the dimmers have this issue,
thanks for your fast response

These sensors are available for Dimmer Gen3

yes i looked and saw that, for some reason they dont show up, im not sure why

Please show me a screenshot of the device in HA with all entities. Something like this:

Please catch the log according to this instruction GitHub - bieniu/ha-shellies-discovery-gen2: Script that adds MQTT discovery support for Shellies Gen2+ devices
and open an issue here GitHub · Where software is built and attach the log file.

Hello

I’m having a problem with my Shelly 1PM Mini Gen 4. It’s connected via MQTT and recognized in the MQTT Explorer, but it’s not showing up in HA. My Shelly Pro 2PM works perfectly. What am I doing wrong?

I don’t know. Prepare the log file according to these instructions and then I will be able to tell you something.

File “/usr/local/lib/python3.13/site-packages/aiohttp/connector.py”, line 1321, in _wrap_create_connection
raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.178.66:443 ssl:<ssl.SSLContext object at 0x7f1293dd2b70> [Connect call failed (‘192.168.178.66’, 443)]
2026-02-27 21:24:49.983 INFO (MainThread) [homeconnect_websocket.session] Closing connection to 192.168.178.66
2026-02-27 21:24:49.984 DEBUG (MainThread) [homeconnect_websocket.hc_socket] Closing socket wss://192.168.178.66:443/homeconnect
2026-02-27 21:24:55.301 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Running automation actions
2026-02-27 21:24:55.302 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeating sequence: Iteration 1 of 1 with item: ‘shelly1pmminig4-7c2c676a5e0c’
2026-02-27 21:24:55.302 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeat at step 1: Running automation actions
2026-02-27 21:24:55.302 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeat at step 1: Executing step call service
2026-02-27 21:24:55.309 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeat at step 1: Executing step call service
2026-02-27 21:25:00.099 INFO (MainThread) [homeassistant.components.automation.shellies_discovery_gen2] Shellies Discovery Gen2: Running automation actions
2026-02-27 21:25:00.099 INFO (MainThread) [homeassistant.components.automation.shellies_discovery_gen2] Shellies Discovery Gen2: Executing step call service
2026-02-27 21:25:00.099 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: ‘dict object’ has no attribute ‘payload_json’ when rendering ‘{{ trigger.payload_json.src }}’
2026-02-27 21:25:00.107 ERROR (MainThread) [homeassistant.components.automation.shellies_discovery_gen2] Shellies Discovery Gen2: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘payload_json’
2026-02-27 21:25:00.108 ERROR (MainThread) [homeassistant.components.automation.shellies_discovery_gen2] Error while executing automation automation.shellies_discovery_gen2: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘payload_json’
2026-02-27 21:25:19.446 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Running automation actions
2026-02-27 21:25:19.447 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeating sequence: Iteration 1 of 1 with item: ‘shelly1pmminig4-7c2c676a5e0c’
2026-02-27 21:25:19.447 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeat at step 1: Running automation actions
2026-02-27 21:25:19.447 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeat at step 1: Executing step call service
2026-02-27 21:25:19.454 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeat at step 1: Executing step call service

2026-02-27 21:25:00.099 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: ‘dict object’ has no attribute ‘payload_json’ when rendering ‘{{ trigger.payload_json.src }}’

Did you run the shellies_discovery automation manually?

Yes, I have that

it works, thank you