I want to build a system that tells me to eat a little bit more when I used more energy than normal. I have already imported the calories that i have used that day (from my Garmin watch). I know that my diet takes into account an average of 1500 active calories a day. The part I can’t figure out is some sort of timer that starts at 0 at 7am and ends at 1500 at 9pm. Onces I got this (this would than be my calorie intake) I can compare this to the calories used and thus see if I should eat more.
make a template sensor that does the calculation
template:
- sensor:
- name: Predicted Calories
unique_id: 13409a19-2159-4cf8-b9ba-d74a7f678fc5
state_class: measurement
unit_of_measurement: calories
state: >
{% set start = today_at('07:00') %}
{% set end = today_at('21:00') %}
{% if start <= now() <= end %}
{% set total = (end - start).total_seconds() %}
{% set current = (now() - start).total_seconds() %}
{{ 1500 * current / total }}
{% else %}
0
{% endif %}
The template sensor will update once a minute with your expected calorie count for the current minute.
Thank you very much, that is exactly what I wanted. Until now I did not know you could create helpers.
Now I get a message on my phone and watch when my training exceeds my intake.