I’ve just started using automations and my current goal is to use a input_number variable to set the light brightness. (the input_number variable is updated by another automation that reads an illuminance sensor).
I’m creating my automations using the visual editor and so far I understand that it’s not possible to use things like input_number in the visual editor unless you switch to the YAML editor which uses a slightly different syntax.
1. Is there a simple way of editing just the action part of the automation in YAML and supplying the input_number variable there?
I have tried this without success, wondering if it’s even possible:
type: turn_on
device_id: 008577b037f49c9895e5e177f3078427
entity_id: light.l_hol1
domain: light
brightness_pct: "{{ states.input_number.brightness_hol.state | int }}"
I’m getting this error:
Message malformed: expected float for dictionary value @ data[‘brightness_pct’]
2. If #1 is not possible, then it should be done by switching to complete YAML automation code editing, in which case how should my automation code look like to be valid and to use the input_number for setting the brightness?
alias: 'PIR #1'
description: ''
trigger:
- type: turned_on
platform: device
device_id: c837b698eaa4a3167706f62cf2efd962
entity_id: binary_sensor.pir_ias_zone
domain: binary_sensor
condition:
- condition: time
after: '20:00:00'
before: '08:00:00'
- condition: device
type: is_off
device_id: 008577b037f49c9895e5e177f3078427
entity_id: light.l_hol1
domain: light
action:
- type: turn_on
device_id: 008577b037f49c9895e5e177f3078427
entity_id: light.l_hol1
domain: light
brightness_pct: 10
- delay:
hours: 0
minutes: 0
seconds: 30
milliseconds: 0
- type: turn_off
device_id: 008577b037f49c9895e5e177f3078427
entity_id: light.l_hol1
domain: light
mode: single
Thank you!