Light automation on lux

Greetings.

Iam trying to get my automation on living room lights going on lux.

I have a few virtual switches that I want to block the scripts from running and only when at least one are home.
But I am getting an error that doesn’t make sense to me.
“Message malformed: must contain at least one of below, above.”

Some how so doesn’t it want me to have a limit on 0 - 850 on the lux for the script. Why??

description: ""
mode: single
trigger:
  - type: illuminance
    platform: device
    device_id: a7ed6154826ffc40a51f06b10a6bd402
    entity_id: sensor.hue_outdoor_sensor_illuminance
    domain: sensor
  - platform: numeric_state
    entity_id: sensor.hue_outdoor_sensor_illuminance
    for:
      hours: 0
      minutes: 5
      seconds: 0
    attribute: light_level
    below: 850
    above: 0
condition:
  - condition: and
    conditions:
      - condition: state
        entity_id: input_boolean.virt_sleep
        state: "off"
      - condition: state
        entity_id: input_boolean.virt_manuell
        state: "off"
      - condition: state
        entity_id: zone.home
        attribute: persons
        state: ">1"
action:
  - type: turn_on
    device_id: 2b4bac3741e75a28dcdb424d3c5b1a20
    entity_id: light.golv
    domain: light
    brightness_pct: 100
  - type: turn_on
    device_id: 7b1e3969a3d145da637e764681d8b43c
    entity_id: light.hue_color_lamp_1
    domain: light
    brightness_pct: 100
  - type: turn_on
    device_id: 5f5e0fe8dd66cf3908547a6d892d3096
    entity_id: light.hue_color_lamp_2
    domain: light
    brightness_pct: 100
  - type: turn_on
    device_id: a2af6fc664552d47532dc5ce8b75fdeb
    entity_id: light.storarum_gardin
    domain: light
    brightness_pct: 100
  - type: turn_on
    device_id: 16b539f9da97dee8abac6f7fdeeefa1f
    entity_id: light.storarum_led
    domain: light
    brightness_pct: 100
alias: Storarum 0-850 Lux

Thanks in advance.

alias: Storarum 0-850 Lux
description: ""
mode: single
trigger:
  - platform: numeric_state
    entity_id: sensor.hue_outdoor_sensor_illuminance
    for:
      minutes: 5
    attribute: light_level
    below: 850
condition:
  - condition: state
    entity_id: input_boolean.virt_sleep
    state: "off"
  - condition: state
    entity_id: input_boolean.virt_manuell
    state: "off"
  - condition: numeric_state
    entity_id: zone.home
    attribute: persons
    above: 1
action:
  - service: light turn_on
    target:
      entity_id:
        - light.golv
        - light.hue_color_lamp_1
        - light.hue_color_lamp_2
        - light.storarum_gardin
        - light.storarum_led
    data:
      brightness_pct: 100

Thanks alot!!

Iam going to test it asap :slight_smile:

Iam currently doing my best to migrate from domoticz to home assistant for the second time.
The yalm are not sticking that good as lua in my head. But I guess that I need to work a lot more in that.

Regards Magnus

Home Assistant uses YAML like a hierarchical form. The hierarchy is defined by indentation.

I understand the basics of it, but it feels easyer with a script where you define local attribute and then a few “if” and "then"´s.
I find it easyer to have everything in scripts thats room and action defined as Envirement_livingroom.lua / tv_livingroom.lua to start the scene to watch tv.

My next problem are that Iam making an automation, but after that nothing happen lol
This are in the automations.yalm

- id: '1668701239641'
  alias: Golv av
  description: ''
  trigger:
  - device_id: 1614cc3d16e12c9cdaf1f0390811e5f7
    domain: deconz
    platform: device
    type: remote_button_short_press
    subtype: turn_off
  condition: []
  action:
  - type: turn_off
    device_id: 2b4bac3741e75a28dcdb424d3c5b1a20
    entity_id: light.golv
    domain: light
  mode: single

After i press the off button the lamp stays on. Ive reloaded the automations in configuration.

I also try to make an automation and include it in the configuration.yalm

automation: !include Sovrum_switch.yalm

And again nothing happens when i press the switch.
Ive tryed to have it to a boolean switch and its the same there.

I am trying to get the switch to toggle a virtual switch that will halt my environment scripts in the rooms for when we go to sleep.

Do I need to create a script that calls on automations or how do I triger them???

Regards Magnus

automation: !include Sovrum_switch.yalm

It’s yaml not yalm.

Thanks, changed that but still the same problem.

Check the automation’s trace.

Reference: Troubleshooting Automations