Transformation error in: trigger with for variable

I’m not sure if I’m too stupid or just missing something.
I have the automation below. Every time I want to save, I get the message:
Message malformed: expected float for dictionary value @ data[‘for’][‘seconds’]

I have tried it as in the tutorial Automation Trigger - Home Assistant with int as well as with float.
However completely without success. What am I doing wrong or what else can I try?
Thanks in adavced!

alias: Schlafzimmer Bewegungsmelder off
description: Schlafzimmer Licht durch Bewegungsmelder in Abhängigkeit von Uhrzeit und Tag
trigger:
  - type: no_motion
    platform: device
    device_id: af0e9193e624fa62fff5285b62c8df05
    entity_id: binary_sensor.bewegungsmelder_schlafzimmer
    domain: binary_sensor
    for:
      hours: 0
      minutes: 0
      seconds: "{{ states('input_number.delay_schlafzimmer_tag')|float }}"
condition:
  - condition: state
    entity_id: input_boolean.schlafzimmer_manuel
    state: 'off'
    for:
      hours: 0
      minutes: 0
      seconds: 0
action:
  - service: light.turn_off
    data: {}
    target:
      area_id: schlafzimmer
mode: single

Could you show the state and the configuration of your helper input_number.delay_schlafzimmer_tag?

I’m getting the same error when using the platform: device.

But i suppose your motion sensor works similar to mine, on when there is motion and off when there is no motion, so you could try with the platform: state trigger

alias: Schlafzimmer Bewegungsmelder off
description: Schlafzimmer Licht durch Bewegungsmelder in Abhängigkeit von Uhrzeit und Tag
trigger:
  - platform: state
    entity_id: binary_sensor.bewegungsmelder_schlafzimmer
    to: 'off'
    for:
      hours: 0
      minutes: 0
      seconds: "{{ states('input_number.delay_schlafzimmer_tag')|float }}"
condition:
  - condition: state
    entity_id: input_boolean.schlafzimmer_manuel
    state: 'off'
action:
  - service: light.turn_off
    data: {}
    target:
      area_id: schlafzimmer
mode: single
1 Like

Then I am reassured that I am not completely stupid.
Your code works. Thanks a lot for that!

1 Like