hass-plejd icon indicating copy to clipboard operation
hass-plejd copied to clipboard

Reload of integration triggers all events

Open bnordli opened this issue 1 year ago • 4 comments

When I manually reload the integration (to get updated information from Plejd) all scenario and button events are triggered.

This is quite unfortunate, as this leads to all hooks for those events being triggered in HA.

This is a snapshot of my logbook just during the reload:

image

the logbook continues with all button press events being fired, then all (Plejd) scenario events being fired, then all button press events being fired (again!), then lights turning unknown (this is expected), then lights going to their actual state (also expected).

bnordli avatar Jan 13 '24 15:01 bnordli

This is issue for me aswell, using a Plejd scenario to control my screens up and down with double click of a button. Reloading integration makes my screens move.

oleost avatar Jan 15 '24 10:01 oleost

I had this problem too , in automation in trigger I had to add "not_from" , "not_to"

platform: state
entity_id: event.bedroom_low_light_activated
not_from:
  - unknown
  - unavailable
not_to:
  - unknown
  - unavailable

You can refer to this topic: https://community.home-assistant.io/t/help-with-triggering-an-automation-only-when-date-is-changed-in-the-state/630111/9

I Hope I understood your problem and my comments are relevant

igalg99 avatar Feb 16 '24 14:02 igalg99

This is a very helpful trick! I think it is impossible for this integration to get around this, since I assume HA sets all entities belonging to any integration as "unavailable" while the integration is reloading.

bnordli avatar Feb 18 '24 20:02 bnordli

That's exactly right. I've raised this issue with the core team, and while there's no good ideas right now, at least there's hope. image

thomasloven avatar Feb 19 '24 07:02 thomasloven