#Trying to use a variable in a action in the "for minutes" parameter

1 messages · Page 1 of 1 (latest)

small ingot
#

Hello everybody. I created a blueprint that reacts when a motion sensor detects motion and its darker than a certain value. In that case a light should turn on. Once the light was turned on I want it to be turned off again after a certain time has passed.
For this "certain time" I want to use a number as variable. However, I can't get the blueprint to accept the input value... it always says it requires a float as input... no matter what I do. Can anybody help me out with this?

I'd like to use the provided variable in
for:
hours: 0
minutes: 1
seconds: 0

As replacement for the static minutes... but no matter what I try... I can't get it to be accepted. Thansk in advance. Also, it seems I cant post the whole code here as its too long. will try in another reply

#

My current code looks like this

blueprint:
  domain: automation
  name: "[Raum] Licht anschalten bei Bewegung wenn dunkel"
  description: "Schaltet das gewählte Licht an falls es dunkel ist. Schaltet es danach wieder aus"

  input:
    target_light:
      name: Target Light
      description: Das Licht welches angeschaltet werden soll
      selector:
        entity:
          filter:
            domain: light
    target_motion_device:
      name: Motion Device
      selector:
        device:
          entity:
            device_class: illuminance
    target_motion_sensor:
      name: Motion Sensor
      selector:
        entity:
          filter:
            domain: binary_sensor
    target_lumi_device:
      name: Lumi Device
      selector:
        device:
          entity:
            device_class: illuminance
    target_lumi_sensor:
      name: Lumi Sensor
      selector:
        entity:
          filter:
            domain: sensor
            device_class: illuminance
    threshold_luminance:
      name: "Too-Dark Lumi"
      selector:
        number:
          min: 0
          max: 5000
    wait_time_to_turn_off_light_again:
      name: "Waiting time to turn off light"
      description: "TODO: Implement to use this for light off timeout"
      selector:
        entity:
          filter:
            domain: input_number

variables:
  wait_time_to_turn_off_light_again_var: !input wait_time_to_turn_off_light_again
#
triggers:
  - type: occupied
    device_id: !input target_motion_device
    entity_id: !input target_motion_sensor
    domain: binary_sensor
    trigger: device
    alias: Bewegung erkannt
  - alias: Eine Minute lang keine Bewegung
    type: not_occupied
    device_id: !input target_motion_device
    entity_id: !input target_motion_sensor
    domain: binary_sensor
    trigger: device
    for:
      hours: 0
      minutes: 1
      seconds: 0

conditions: []
actions:
  - alias: Licht einschalten (Wenn Bewegung und zu Dunkel)
    if:
      - condition: and
        conditions:
          - condition: template
            value_template: >-
              {{trigger.from_state.state == 'off' and trigger.to_state.state ==
              'on'}}
          - condition: state
            entity_id: !input target_light
            state: "off"
          - condition: numeric_state
            entity_id: !input target_lumi_sensor
            below: !input threshold_luminance
    then:
      - action: light.turn_on
        metadata: {}
        data: {}
        target:
          entity_id: !input target_light
  - alias: Licht ausschalten (Wenn keine Bewegung für 1 Minute)
    if:
      - condition: and
        conditions:
          - condition: template
            value_template: >-
              {{trigger.from_state.state == 'on' and trigger.to_state.state ==
              'off'}}
          - condition: state
            entity_id: !input target_light
            state: "on"
    then:
      - action: light.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: !input target_light
mode: single
lament crescent
#

use a duration selector for the entire for field

small ingot
#

thanks, I'll give it a try