bieniu / ha-shellies-discovery-gen2

Script that adds MQTT discovery support for Shellies Gen2 devices
Apache License 2.0
106 stars 18 forks source link

Not discovering Shelly when add-on is active #514

Closed UMB8998 closed 1 week ago

UMB8998 commented 1 week ago

Describe the bug

If I have a Shelly Plus 1 I could add it perfectly to the system, but once I activate the Add-On it stops updating the device info like for example the FW version only the switch works. If I erase the shelly and run the automations again it doesn't detect it, only when I disable the add-on on the shelly it get's detected by HA

Expected behavior

Detect the Shelly with the Add-On Active, and pull the info from the Add-On

Versions:

Shellies Discovery GEN2 automations:

- id: shellies_announce_gen2
  alias: "Shellies Announce Gen2"
  triggers:
    - platform: homeassistant
      event: start
  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'} | to_json }}"
    device_ids:  # enter the list of device IDs (MQTT prefixes) here
      - shellyplus1-b8d61a8a9554
      - shelly1minig3-5432045f2dd4
      - shelly1minig3-3030f9e5f24c
      - shelly1minig3-3030f9e5a9f4
      - shellyplusi4-d8132ad240a0
      #And the list goes on
  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 }}"

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

imagen

Debug log:

bieniu commented 1 week ago

I think you forgot about something…

image

UMB8998 commented 1 week ago

Sorry, completely forgot about that

home-assistant_2024-11-04T07-02-03.881Z.log

UMB8998 commented 1 week ago

Thank you!