ok, now it make sense. So by pushing the light of the corridor it trigger only an automation, but that automation change the controller 91AD group status which has just been updated by turning off the light in the bedroom.
So the automation send an “obsolete” status to the very same controller group turning on the bedroom light again.
Pushing the bedroom light off triggers a status refresh, it take time, you already loose 0.5 sec of waiting (as defined in const.py) as I need to wait for the controller to reflect its status. Querying the controller right after a button press would give me previous state and not the new state following a button press
REFRESH_DELAY: Final[float] = 0.5 # Delay before retrieving status after button press
Then I need to send a refresh command, wait the feedback, record it in HA.
Overall, I have not timed it, but probably 0.7sec if everything goes as planned, or else 2/3 seconds if I have to retry because the bus is busy.
I do not immediatly see optimization, we have to deal with how Nikobus is designed.
I had similar ‘trouble’ and a moved light to another group of the same module as a workaround.
I have looked at not refreshing the data from Nikobus but trusting an HA internal state following a button press, but it gives more trouble than it solves as we have no way to know if the button press was successfull and trigerred the outcome, so we might end up out of sync.
by the way, even worst for dimmer
DIMMER_DELAY: Final[int] = 1 # Delay before retrieving dimmer status
As dimmer, dim down, I have to wait 1 full second before to get it final status or else I get an interim status and not final state