bieniu / ha-shellies-discovery-gen2

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

ShellyPlus1 Input Type Button - no correct relay #417

Closed SilRo991 closed 3 months ago

SilRo991 commented 3 months ago

Describe the bug

I have to use the Input mode "button - momentary" for one of my ShellyPlus1. As always the discovery of the script works great but I guess there is something wrong with the status of the Relay it discovers. It is always off. MQTT sends switch:0 - output - true/false. But on input:0 the state is always null. With the Relay 0 i can switch it on but HA does not get the right feedback and thinks the state of the switch is off. So if I am fast, I can switch my Relay off to set the switch on and off quickly.

Expected behavior

If I use the Relay/switch in home assistant, I would like to get the right state (on/off) and use the switch as well as the button.

Versions:

Shellies Discovery GEN2 automation:

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 image

bieniu commented 3 months ago

Debug log please.

bieniu commented 3 months ago

obraz

obraz

SilRo991 commented 3 months ago

oh my god🤦‍♂️. Thanks for the hint. I must have overlooked that.