bieniu/ha-shellies-discovery-gen2

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)
{3BB8518F-A72D-4C40-9F8A-929D165F5DFA}

Gen2 script started manually (few times) while device is awake (hold button to wake/test shelly smoke)

{AF99D289-6610-4FEA-AC8A-B5A4B0FEC788}

via shelly API , HA autodiscover works without issue - this is to confirm network connection.
{61D3E023-EE02-49C3-8367-68761B8C25A4}

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

Shelly device MQTT settings:
image

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

home-assistant.log
{F95C9E65-593D-49B4-8EA7-CB64D9CE34DA}
{DE0C19A2-09CE-40AE-BF51-897FF2ABF787}

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
  • 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 }}'
  • 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 }}'
  • 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

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. :(

{8A236ACF-CE97-49EE-B98E-DECDD33C0106}
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:
{25CF75FA-CB73-410A-AF94-2FF98801F86B}

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