I’m trying to set an automation.
The action should be triggered by a sensor-state, in this case it’s a remaining time. The output-style is hh:mm.
If the time is below a value, in my case it should be 25 minutes, I want to get the action started.
Here starts my problem.
I tried to configure the automation based on a numeric state platform.
When I want to enter the below-value in style of hh:mm I get an error message (Message malformed: Entity ID is an invalid entity ID for dictionary value @ data[‘entity_id’]).
What else can I do to get this automation running?
If your data really is in the hh:mm format (you can check by looking up your sensor’s state in Developer Tools), you’ll probably need to use the value_templateAutomation Trigger - Home Assistant to convert it to an integer.
Numerical triggers require a number. Time is not a number. Seconds is a number, minutes is a number, hours is a number. Combined, it’s not a number, its a time. So it will never work with a numerical trigger.
There are a number of ways to solve this. If you want to use a numerical trigger, then you need to take the sensor that is HH:MM and convert it to hours or minutes in a template sensor. In your case, you’d want it in minutes so you can specify 25 in the numerical state trigger.
What happens when you’re at an hour and 1 minute? You didn’t include hours so it will see it as 1 minute. I.E. it needs to be converted from HH:MM to M.
value_template: >
{% set h, m = state.state.split(':') | map('int') %}
{{ h * 60 + m }}