smartin
February 11, 2024, 8:14am
1
I have a Statistics Sensor with a rather big max_age:
- platform: statistics
name: "environment_lux_1_illuminance_lux AverageLinear_24h"
entity_id: sensor.environment_lux_1_illuminance_lux
state_characteristic: average_linear
max_age:
hours: 24
But i need its Value only once a Day. It is really unnecessary to let it permanently compute the statistic.
Is there a Way to only let it calculate the Statistics when triggered?
tom_l
February 11, 2024, 9:28am
2
Use a triggered template sensor instead.
smartin
February 11, 2024, 9:45am
3
I guess thats my Problem - i know how to set up (triggered) template sensors, but not how implement that with statistics.
I tried it (for general testing i used time_pattern) with:
- trigger:
- platform: time_pattern
minutes: /15
sensor:
- platform: statistics
name: "environment_lux_1_illuminance_lux AverageLinear_24h"
entity_id: sensor.environment_lux_1_illuminance_lux
state_characteristic: average_linear
max_age:
hours: 24
But that obviously doesn’t work.
Invalid config for ‘template’ at configuration.yaml, line 421: ‘platform’ is an invalid option for ‘template’, check: sensor->0->platform Invalid config for ‘template’ at configuration.yaml, line 421: required key ‘state’ not provided
Can you point me in the right Direction?
PS: Congratulations for your Joining-Anniversary
tom_l
February 11, 2024, 10:07am
4
You can’t just add options from other integrations to the template sensor.
You need to implement a an average equation in the state
option.
Which now I think about it is going to be difficult.
smartin
February 11, 2024, 10:17am
5
Thats it. I need the state_characteristic: average_linear
Statistics Value. Once a Day.
I don’t know how to make that with a State Template.