timnis
(TImo)
December 3, 2022, 10:00am
1
I try to track heater usage on last 30 days. Some times it works but generally it gives values which are a way of from reality
I have following config
- platform: history_stats
name: ULkohuone lämmitys ON (viim. 30pv) h
entity_id: switch.ulkohuone
state: "on"
type: time
end: "{{ now().replace(hour=0, minute=0, second=0) }}"
duration:
days: 30
If i check it from Influxdb, there I see these spikes. What could be the cause?
123
(Taras)
December 3, 2022, 1:35pm
2
I suggest you consider doing this:
Create a History Stats sensor that reports the current day’s total heating time.
- platform: history_stats
name: ULkohuone
entity_id: switch.ulkohuone
state: "on"
type: time
start: "{{ today_at() }}"
end: "{{ now() }}"
Create Utility Meter sensors that report daily, monthly, and yearly total heating time.
utility_meter:
ulkohuone_daily:
source: sensor.ulkohuone
cycle: daily
ulkohuone_monthly:
source: sensor.ulkohuone
cycle: monthly
ulkohuone_yearly:
source: sensor.ulkohuone
cycle: yearly
The data for Utility Meter sensors is stored in Home Assistant’s statistics table which is not purged and held indefinitely.
That’s the method I use to track heating and cooling time (and I now have over a year’s worth of data).
1 Like
timnis
(TImo)
December 3, 2022, 2:11pm
3
@123 Thanks, I will test this.
timnis
(TImo)
December 10, 2022, 4:05pm
5
Yes, now it works. Thanks.
1 Like
123
(Taras)
December 10, 2022, 4:13pm
6
timnis:
Thanks
You’re welcome!
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic is resolved. This helps other users find answers to similar questions.
For more information about the Solution tag, refer to guideline 21 in the FAQ.