Error using input_number to set brightness

Hi Guys,

First of all thanks for your help. I’ve been trying for the last few days to get a simple automation that as soon as a light is detected in the state on, it updates its brightness. Since I will want to change the brightness during day and night time I’ve created a variable called input_number.brightness in the helpers’ tab.

The code for my automation is:

alias: Brightness Set
description: ''
trigger:
  - platform: device
    type: turned_on
    device_id: 5738bb402c48bc3e9f878ebef3f6cd0e
    entity_id: light.hall_lights
    domain: light
condition: []
action:
  - type: turn_on
    device_id: 5738bb402c48bc3e9f878ebef3f6cd0e
    entity_id: light.hall_lights
    domain: light
    data: 
      brightness: "{{ states('input_number.brightness') | int }}"
mode: single'

it returns: Message malformed: extra keys not allowed @ data[‘data’]

What am I doing wrong here?

Once again thanks.

Device Actions don’t support templates. Use a Service Call.

action:
  - service: light.turn_on
    target:
      entity_id: light.hall_lights
    data: 
      brightness: "{{ states('input_number.brightness') | int(0) }}"

Perfect I have understand it now.

Thanks for your help

1 Like