Open PavelPawlowski opened 2 weeks ago
It would be fine with the timestamp in the state, if only one event would be sent to HA, but there are two events being sent to HA within several milliseconds.
@PavelPawlowski no it should behave exactly like other buttons. I see no solution to change that.
@PavelPawlowski see also https://github.com/JoDehli/PyLoxone/issues/294#issuecomment-2272765678
The button entity is stateless. https://developers.home-assistant.io/docs/core/entity/button/
I understand that it is stateless. Then it is fine when the button is pressed and as a state a timestamp is sent.
But the problem is that a single press of the button in loxone sends two events into HA, so like two presses in a row. (with original switch implementation it was fine, butecause first event was "on" and second event was "off". But with the PushButton, two events with timestamp arrive instead of single event.)
Like in the code example I've reported.
With Single Press of button:
First event received in HA:
{
"payload": "2024-08-26T15:29:48.446374+00:00"
}
Second event received in HA a second later
{
"payload": "2024-08-26T15:29:49.411075+00:00"
}
Other PressButtons in HA when pressed, theye send single event with timestamp as state.
I understand that it is stateless. Then it is fine when the button is pressed and as a state a timestamp is sent.
But the problem is that a single press of the button in loxone sends two events into HA, so like two presses in a row. (with original switch implementation it was fine, butecause first event was "on" and second event was "off". But with the PushButton, two events with timestamp arrive instead of single event.)
Like in the code example I've reported.
With Single Press of button:
First event received in HA:
{ "payload": "2024-08-26T15:29:48.446374+00:00" }
Second event received in HA a second later
{ "payload": "2024-08-26T15:29:49.411075+00:00" }
Other PressButtons in HA when pressed, theye send single event with timestamp as state.
As you state in your reply: the problem is that Loxone Miniserver sends two events. There should be only one. Your loggings confirm that there is no way do distinguish between the Loxone Button-down and Loxone Button-up. This is something that Loxone should fix.
What are you trying to accomplish? Maybe we can help.
Describe the bug
When a PushButton is Pressed in Loxone, the corresponding button object in HomeAssistant for both "Pressed" and "Unpressed" states have a timestamp in ithe state. So it is not possbile to distinguish those two events in any way as the current satate is nowehere available. (Previously when the PushButton was represented by switch in HA, it worked fine).
The state should be on / off or pressed / unpressed. Or something what would allow to distinguish the two event types. Or Send only a single even on Press instaed of two events.
Button Pressed Event Detail
Button UnPressed Event Detail
Firmware of your Miniserver
11.1.9.14
HomeAssistant install method
HACS
Version of HomeAssistant
2024.8.3
Version of Pyloxone
0.6.14
Update pyloxone
Yes, updated to the latest version:
Log
Settings for the log can be found on the main page under the section Log Configuration