Template in timer

Hello everybody.
I have this timer.yaml:

time_warm_floor:
  name: Теплый пол выкл через -
  duration: '05:00:00'

Its working, but I need to enter this parameter manually from Lovelace. I add on input_datetime.yaml:

  input_time_timerwarmfloor:
    name: Таймер теплого пола
    has_date: false
    has_time: true

I change the timer parameters to:

time_warm_floor:
  name: Теплый пол выкл через -
  duration: '{{ states("input_datetime.input_time_timerwarmfloor") }}'

And I get a configuration error:
Invalid config for [timer]: offset {{ states(“input_datetime.input_time_timerwarmfloor”) }} should be format ‘HH:MM’, ‘HH:MM:SS’ or ‘HH:MM:SS.F’ for dictionary value @ data[‘timer’][‘time_warm_floor’][‘duration’]. Got ‘{{ states(“input_datetime.input_time_timerwarmfloor”) }}’. (See /config/configuration.yaml, line 9).

Help me please.

The duration does not support templates. Please refer to the documentation:

Hi, I achieved this with two automations and a script.

The sliders and countdown timers are in my lovelace.

image

This first Automation turns on device and starts the script.

  - entity_id: binary_sensor.pyronix_motion_detector_back_garden
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - condition: or
    conditions:
    - before: sunrise
      condition: sun
    - after: sunset
      condition: sun
  action:
  - entity_id: switch.sonoff_basic_back_garden_light_cmd
    service: switch.turn_on
  - service: script.1588678566870
  mode: single
'1588678566870':
  alias: Back Garden Security Light Timer
  sequence:
  - data_template:
      duration: 00:{{ states.input_number.security_lights_minutes.state | int }}:{{
        states.input_number.security_lights_seconds.state | int }}
      entity_id: timer.security_light_back_garden
    service: timer.start

The second automation r=triggers when the timer called for in the script finishes.

- id: '1588679946447'
  alias: Back Garden Security Light off /  reset
  description: ''
  trigger:
  - event_data:
      entity_id: timer.security_light_back_garden
    event_type: timer.finished
    platform: event
  condition: []
  action:
  - data: {}
    entity_id: switch.sonoff_basic_back_garden_light_cmd
    service: switch.turn_off
  mode: single

yaml

### INPUT BOOLEAN NUMERIC ###

input_number:    
  security_lights_seconds:
    name: Security Lights ON Timer S
    initial: 30
    min: 0
    max: 60
    step: 1
    mode: box


  security_lights_minutes:
    name: Security Lights ON Timer M
    initial: 0
    min: 0
    max: 10
    step: 1
### TIMERS ###

timer:
  
  security_light_back_garden:
    icon: mdi:timer-outline
2 Likes

Nice, but what if you only want the lights on when the illuminance of the sensor is lower than X lux ?