Continuation of this topic:
This is my code for the daily sensors (this works!).
- trigger:
- platform: time
at: '00:00:00'
- platform: state
entity_id: sensor.buienradar_temperature
sensor:
- name: 'Max temp nw'
unit_of_measurement: '°C'
device_class: temperature
state: >
{% set t_new = states('sensor.buienradar_temperature') | float(-99) %}
{{ [t_new, this.state | float(-99)] | max if trigger.platform != 'time' else t_new }}
attributes:
temperature_updated: "{{ now() | as_local }}"
- trigger:
- platform: time
at: '00:00:00'
- platform: state
entity_id: sensor.buienradar_temperature
sensor:
- name: 'Min temp nw'
unit_of_measurement: '°C'
device_class: temperature
state: >
{% set t_new = states('sensor.buienradar_temperature') | float(99) %}
{{ [t_new, this.state | float(99)] | min if trigger.platform != 'time' else t_new }}
attributes:
temperature_updated: "{{ now() | as_local }}"
I also want weekly and monthly min max for the temperature. This only works for max temp weekly. Max temp monthly and min temp weekly/monthly looks like it’s increased with 0,1 every hour (intitial value was 0,0 for the max and 99,0 for the min temp sensors).
Code:
utility_meter:
max_temp_weekly:
source: sensor.max_temp_nw
name: Max Temp Weekly
cycle: weekly
max_temp_monthly:
source: sensor.max_temp_nw
name: Max Temp Monthly
cycle: monthly
min_temp_weekly:
source: sensor.min_temp_nw
name: Min Temp Weekly
cycle: weekly
min_temp_monthly:
source: sensor.min_temp_nw
name: Min Temp Monthly
cycle: monthly
Screenshot of entities:
I need some help with this please