cooking:
sequence:
- service: timer.start
data_template:
entity_id: timer.cooking_timer
duration: '00:{{ states.input_number.timer_minutes.state | int }}:{{ states.input_number.timer_seconds.state | int }}'
In automations.yaml
- alias: 'Timer done'
trigger:
- platform: event
event_type: timer.finished
event_data:
entity_id: timer.cooking_timer
action:
- service: persistent_notification.create
data:
title: "Timer DONE"
message: "THE TIME IS DONE!"
It looks like this in lovelace:
The notification is not idea as it just puts an orange marker on the notification icon in the top right, so I’ll need think of a better solution to that.
Hi yes it does, you can visually see it count down the seconds. The text is the size that you can see in the screenshot so it’s not massive, but I’m sure you could find some custom card to display it larger!
my solution for the timer notification is a conditional card - perhaps that is something you hadn’t in mind… if you thought about that just ignore my post=)
Hey out there, im still fiddling with this timer and countdown sensor solution - till now, i integrated your solution and got a sensor running with the value of the timer. i doesn’t get values out of states.timer.timer.attributes.remaining / states.timer.timer.state and also not trough state_attr('timer.timer', 'remaining') - my solution is dirty as hell but works sometimes, i really would appreciate help, think there must be a way with templating this with input_number1 > 1 and input_number2 > 1 – but i not good enough at this. back to the following, the fiddling part cames in with the integration of hours…
Is it posible to make this cooking timer without the sliders?
I want it to count down from 1h, 20min?
The programe we use most on our washing machine takes 1h, 18min.
And I want the countdown time to show in Lovelace.
Counter starts when I close the door on the washing machine (got a door sensor on it).
Hi there, in addition I’ve made myself a countdown card based on this code.
It is conditional, so it will only show when the timer is active. Also, when you click it, the timer is cancelled. But before that, a confirmation message pops up.
It is based on the custom-button-card.
text-shadow: 0px 0px 0px black
tap_action:
action: call-service
service: timer.cancel
service_data:
entity_id: timer.cooking_timer
confirmation:
text: ‘[[[ return Are you sure you want to cancel the timer? ]]]’
Have you read the documentation? Take a look here:
There you’ll find the following:
Avoid using states.sensor.temperature.state , instead use states('sensor.temperature') . It is strongly advised to use the states() , is_state() , state_attr() and is_state_attr() as much as possible, to avoid errors and error message when the entity isn’t ready yet (e.g., during Home Assistant startup).
The next point would be “Time”, there you’ll find, what you’re looking for.
You need to find out, what type duration is. Normally you would want to typecast this value to an integer or int. Than add 120 seconds.
Thanks fir the hint @paddy0174
The main problem are still there. I don’t know the type of the duration attribute. In the devlopment-tool shows the state as 00:05:00. (static, even if the timer is running)
Meaning, the code I posted, doesn’t work? Or do you just want an explanation?
In the snippet I posted, the duration will be type casted to INT or Integer or at least should get type casted…
sorry, my answer was a little short. Yes, I took over your code. The template logic is now correct. Unfortunately, the condition still does not change after 2 minutes. I think it’s because of the ‘120’. But I have no idea how to solve this (I’m not a programmer and not familiar with int.).
If you have the solution as code, that would be perfect.
I found the problem. The countdown is not an attribute. Just the start (and remaining) time. But both are not change, if you start the countdown. So isn’t possible to make a condition: https://github.com/home-assistant/core/issues/30062