Using a Helper as a time limit

Hello,

I’m trying to use a helper to store a value of 2 min “00:02:00”, so that I can this helper in place of typing 2 min all over my automation. I’ve tried various types of helpers, but none seem to be working…

alias: Dining LUX Off
platform: numeric_state
entity_id:
  - sensor.presence_sensor_fp2_fb0d_light_sensor_light_level
for: input_text.timenumber
id: Dining LUX Off
above: input_number.lux_off_limit

I get an error saying:

Message malformed: offset input_text.timenumber should be format ‘HH:MM’, ‘HH:MM:SS’ or ‘HH:MM:SS.F’ for dictionary value @ data[‘for’]

Thankyou in advance for any help.

David.

You will need to use a template:

alias: Dining LUX Off
platform: numeric_state
entity_id:
  - sensor.presence_sensor_fp2_fb0d_light_sensor_light_level
for: "{{state('input_text.timenumber')}}"
id: Dining LUX Off
above: input_number.lux_off_limit

If you haven’t already, you may want to set a regex pattern for your Input text helper so that it won’t allow you to set a value that will cause your automations to fail. For “HH:MM:SS” format you can use ^\d{2}:\d{2}:\d{2}$.

1 Like