StyraHem / ShellyForHASS

Shelly smart home platform for Home Assistant
MIT License
619 stars 111 forks source link

[BUG] Shelly Button 1 not working when on battery #629

Open me1299 opened 2 years ago

me1299 commented 2 years ago

Environment

Describe the bug

Whenever my Shelly Button 1 is battery powered it stops functioning. The status is not updated whenever I click the button. The button 1 does flash green after pressing the button.

Steps to Reproduce

Remove USB cable, wait for the Button 1 to enter sleep mode. Press the button

Expected behavior

The button press is registered by Shelly4HASS

Screenshots

Traceback/Error logs

Additional context

Protocols: CoAP-discovery, CoAP-msg, poll I just found out that when I reboot HA it will start working again. But after a few minutes it stops working until I reboot HA again. So I think the problem is with ShellyForHASS not registering CoIoT traffic once the devices has disappeared from the network for some time.

me1299 commented 2 years ago

Did some TCPDumps.

When USB powered and pressing the button 1 packet is logged. E..............D.....3.3..m3P....cit.s... SHBTN-2#98CDAC2C269C#2.C......{"G":[[0,9103,0],[0,2102,"S"],[0,2103,31],[0,3115,0],[0,3112,1],[0,3111,100],[0,9102,["ext_power"]]]}

Battery powered two packets are sent when you press the button once. E..............D.....3.3....P....cit.s... SHBTN-2#98CDAC2C269C#2.C......{"G":[[0,9103,0],[0,2102,"S"],[0,2103,41],[0,3115,0],[0,3112,0],[0,3111,100],[0,9102,["button"]]]} E.... .........D.....3.3....P....cit.s... SHBTN-2#98CDAC2C269C#2.C......{"G":[[0,9103,0],[0,2102,"S"],[0,2103,41],[0,3115,0],[0,3112,0],[0,3111,100],[0,9102,["button"]]]}

After waiting a minute the problem starts and when I press the button no Multicast traffic is reaching the HA host. So I think it's a problem with the Shelly itself.

Bounties1337 commented 2 years ago

Hi. Sorry to bother.

Do you know whether there is a way to add to HA, the different shelly button switch entities, single, double, triple and long over CoAP, when using shellyforHASS?

At present when running over CoAP I only see shelly button 1 switch entity. However, when running MQTT against the shelly button 1, out of the blue, I do see the different click methods which is much more convincing when creating automation.