Formula
{{ (now().timestamp() - 1 * 86400 ) | timestamp_custom('%Y-%m-%dT23:59:59') }}
Formular itself is working when i test the Syntax but the Value “last_reset” ends with the Formula and not and the Result “2022-06-19T23:59:59”
customize_glob:
sensor.tauron_amiplus_consumption_daily:
last_reset: >
{{ (now().timestamp() - 1 * 86400 ) | timestamp_custom('%Y-%m-%dT23:59:59') }}
Please help, thx Berni
petro
(Petro)
June 20, 2022, 3:51pm
2
You can’t template there.
ok, so what can i do ?
i need to add last_reset to my energy cause missing
and this with the correct value.
petro
(Petro)
June 20, 2022, 3:53pm
4
You can make a template sensor.
petro
(Petro)
June 20, 2022, 4:01pm
5
FYI, your template can be simplified to
{{ today_at().isoformat() }}
thx but how to subscract 1 day and customize the format?
petro
(Petro)
June 20, 2022, 4:03pm
7
You don’t need to. That template gives you midnight today and formats it.
agree on the today, but i need it 1d before
petro
(Petro)
June 20, 2022, 4:05pm
9
No it doesn’t. Your last template is doing 23:59:59 the previous day where the template I provided is giving you 1 second after that time.
{{ today_at().isoformat() }}
come to result
2022-06-20T00:00:00+02:00
and i need
2022-06-19T29:59:00+00:00
petro
(Petro)
June 20, 2022, 4:07pm
11
berndthiel:
29:59
that’s not a real time…
Also, do you understand the differences between UTC and Local time? I’d be very surprised if your device reset at midnight UTC (or the second before).
2022-06-19T23:59:00+00:00
my fault, but i need this date cause the Tauron AMI Plus show data of day before not realtime.
petro
(Petro)
June 20, 2022, 4:26pm
13
Yes but what you aren’t understanding is that you keep saying “It needs the day before hand” but it’s not the day before hand.
Midnight is hour 0 of day 20. It’s also hour 24 of day 19. You’re calling out midnight and you don’t realize it. You’re not calling out the day before at all.
can me make a google meet or similar, i think we talk about some but dont get your point?
petro
(Petro)
June 20, 2022, 4:30pm
15
No, you just need to understand that
2022-06-20T00:00:00 is equal to 2022-06-19T24:00:00, which is pretty much equal to 2022-06-19T23:59:59.
got it,
but {{ today_at().isoformat() }}
result in 2022-06-20T00:00:00**+02:00**
so is the “+02:00” not this day?
and is it needed than to make
template:
sensor:
name: "last_reset"
or can i use
customize_glob:
sensor.tauron_amiplus_consumption_daily:
last_reset: >
{{ today_at().isoformat() }}
petro
(Petro)
June 20, 2022, 4:38pm
17
Does this reset 2 hours after midnight your time or does it reset at midnight?
Tauron AMI is is the Energy Meter but power production is max to 22:00
thats why i wanna today -1d at 22:00:00 or 23:59:00