Closed CaptMilkbeard closed 2 months ago
Why are you showing the content of the log file for Shellies Discovery Gen1 when you have a problem with Shellies Discovery Gen2?
Device IDs look wrong:
2024-06-15 08:19:07.761 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'payload_json' when rendering '{{ trigger.payload_json.src }}'
Did you run discovery automation manually?
You didn't attach the log file, so I can only guess that the devices didn't respond to the announce
, so I don't really have anything to analyze.
Since I cannot judge which message belongs to which version, I took the necessary parts from the log that corresponded to the filter. These are the messages of the last hour before my post.
the IDs are from the config itself, I just added an ID (MQTT prefix) of my device when I tested if this helps to recognise it (it didn't).
full logfile is now attached home-assistant.log
the IDs are from the config itself
shellyplus2pm-485519a1ff8c
comes from the example, I doubt your device uses this ID.
Nothing interesting in the log 🤷♂️
Yes, sorry, I wasn't precise enough. I meant the config from Github. I have included the examples to see if I get any reaction or at least an error that a device is not found. but there is just nothing.
nothing interesting also means you have no idea why it doesn't work?
Yea, I have an idea, there is no response from Shelly device. Why's that? I don't know, your configuration has to be wrong. You can set the log level to debug for MQTT component. Maybe this will help.
attached is the new log, I hope you see something helpful. I don't want to rule out that I've done something wrong, I just don't see it.
Your automation is still using non-existent IDs, you still can't see if MQTT topics are being sent and the real device is still not responding...
2024-06-16 16:33:28.466 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeating sequence: Iteration 1 of 3 with item: 'shellyplus2pm-485519a1ff8c'
2024-06-16 16:33:28.466 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeat at step 1: Running automation actions
2024-06-16 16:33:28.466 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeat at step 1: Executing step call service
2024-06-16 16:33:28.467 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Initialized trigger Shellies Announce Gen2
2024-06-16 16:33:28.467 INFO (MainThread) [homeassistant.components.automation.shellies_discovery_gen2] Initialized trigger Shellies Discovery Gen2
2024-06-16 16:33:28.468 INFO (MainThread) [homeassistant.components.automation.shellies_announce] Shellies Announce: Running automation actions
2024-06-16 16:33:28.468 INFO (MainThread) [homeassistant.components.automation.shellies_announce] Shellies Announce: Executing step call service
2024-06-16 16:33:28.468 INFO (MainThread) [homeassistant.components.automation.shellies_announce] Initialized trigger Shellies Announce
2024-06-16 16:33:28.469 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] Initialized trigger Shellies Discovery
2024-06-16 16:33:28.487 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeating sequence: Iteration 2 of 3 with item: 'shellyplus1pm-84cca877155c'
2024-06-16 16:33:28.487 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeat at step 1: Running automation actions
2024-06-16 16:33:28.487 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeat at step 1: Executing step call service
2024-06-16 16:33:28.496 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeating sequence: Iteration 3 of 3 with item: 'custom-prefix/shelly-kitchen'
2024-06-16 16:33:28.496 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeat at step 1: Running automation actions
2024-06-16 16:33:28.497 INFO (MainThread) [homeassistant.components.automation.shellies_announce_gen2] Shellies Announce Gen2: Repeat at step 1: Executing step call service
one unit appears now in mqtt explorer
i added 3 ID of my units and removed your examples now
announce
automation send correct payload to correct topics but there is no response from Shelly devices.
2024-06-17 10:02:46.530 DEBUG (MainThread) [homeassistant.components.mqtt.client] Transmitting message on shellyplus1pm-441793d483b4/rpc: '{"id":1,"src":"shellies_discovery","method":"Shelly.GetConfig"}', mid: 5, qos: 0
2024-06-17 10:02:46.540 DEBUG (MainThread) [homeassistant.components.mqtt.client] Transmitting message on shellyplus1-4855199c8b20/rpc: '{"id":1,"src":"shellies_discovery","method":"Shelly.GetConfig"}', mid: 6, qos: 0
Run Shellies Announce Gen2
automation manually and show me the log.
log attached with manuall announce
Further, one of the three units appeared now (shellyplus1pm-84cca877155c). home-assistant (3).log
It looks like your HA triggers the announce
automation when MQTT is not fully available. You need to add a delay.
I have tested it with a time pattern like the Gen1, but currently only 2 out of 3 PM devices appear and the Plus devices do not appear at all.
in mqtt explorer they all appear, so it still seems to be a problem in HA. but these Gen2 devices do not appear in shellies like the Gen1 but as individual devices. But you can already see this in the screenshots before.
I can see in the log that the device has been correctly recognized and configured. There were no errors. From my point of view, there is nothing I can fix in this case. The problem is due to configuration or is specific to your HA instance. The configuration process sends a GetConfig request to the device, the device responds to the shellies_discovery topic and then the real configuration occurs. For some reason, your devices don't respond or the answer doesn't reach HA.
that's at least one approach I should look for. I'll try resetting one of the shells and see if that changes anything. The HA system was actually reinstalled 2 months ago, so everything should be fine.
I'm surprised that at least some devices are now being displayed, which rules out configuration problems in the addon, Python, config and so on.
Thanks so far. If I find out anything else I would share it.
Describe the bug
gen2 devices doesn't appear via MQTT. Settings are set as mention in ReadMe. Devices appear in MQTT Explorer. Using also your gen1 Shellies-dicovery which is working fine. Therefore i'm sure python is setup correct ;)
Expected behavior
Expecting same behaviour as known from gen1, devices appear in HA -MQTTT
Versions:
Shellies Discovery GEN2 automation:
Shelly device MQTT settings:
Debug log:
logger: default: error
logs: homeassistant.components.python_script: debug
homeassistant.components.automation: info
homeassistant.components.mqtt.discovery: info