JoDehli / PyLoxone

Python Loxone binding
Apache License 2.0
203 stars 44 forks source link

If you want to Turn on / off multiple lights within a LightControllerV2 at the same time using a script a delay must be added! #317

Open ascha191 opened 2 weeks ago

ascha191 commented 2 weeks ago

Describe the bug

Turn on / off multiple lights within a LightControllerV2 at the same time does not work. Only 2 of 4 lamps are switched on/off at any one time. i have tested it with a homeassistant script and it needs at least a delay of 150ms so that all lamps are switched reliably. That's bad because I can't tell the voice assistant to turn off all the lights.

does not work:

alias: loxtest
sequence:
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: light.licht_keller_keller1
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: light.licht_keller_keller2
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: light.licht_keller_keller3
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: light.licht_keller_keller4

work:

alias: loxtest
sequence:
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: light.licht_keller_keller1
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 150
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: light.licht_keller_keller2
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 150
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: light.licht_keller_keller3
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 150
  - action: light.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: light.licht_keller_keller4
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 150

Firmware of your Miniserver

14.2.6.16 (latest)

HomeAssistant install method

Hassio

Version of HomeAssistant

Core 2024.10.4 Supervisor 2024.11.2 Operating System 13.1 Frontend 20241002.4

Version of Pyloxone

0.6.16

Update pyloxone

yes

Log

Settings for the log can be found on the main page under the section Log Configuration

JoDehli commented 2 weeks ago

@ascha191 you are right this should work but I know why it does not work. With the current implementation it is not so easy to fix it. I have a look if I get it to work. I work on a new implementation and there it should work out of the box. But what you try to achieve is the reason why a light controller exists. You could not use the lights individually you should light controller scene for that.

ascha191 commented 2 weeks ago

It's good to know I'm not the only one who can reproduce the problem. I have light scenes in use and switching via the GUI works perfectly. However, I'm intrigued by the possibility of integrating openAI into the voice assistant, so I'm in the process of implementing this in my home. Of course, there are some workarounds, such as scripts that the AI can access. But workarounds always come back to bite you sooner or later. It's good to hear you're working on a solution. If you need someone to test it, let me know! Anyway, thanks for your great efforts!

JoDehli commented 2 weeks ago

@ascha191 I can confirm that it is only working when you work with the the light controller and define different light circuits. With this you can only switch on the light circuit and all lights in this circuit will turn on. Or if you want to use home-assistant you must include a delay like you mentioned.

I checked it and I cannot change it so that it works without the additional delay.