Hey everyone,
I am trying to capture a state of a sensor. I have set it up for a daily capture but now not sure how to do this weekly and monthly. This is what i have for daily:
# Previous day stats
template:
- trigger:
- platform: time
at: "23:59:00"
sensor:
- name: "Yesterday Exported Energy"
state: >
{{ (states('sensor.solaredge_exported_energy')) }}
unit_of_measurement: "Wh"
- name: "Yesterday Imported Energy"
state: >
{{ (states('sensor.solaredge_imported_energy')) }}
unit_of_measurement: "Wh"
- name: "Yesterday Self Consumed Energy"
state: >
{{ (states('sensor.solaredge_selfconsumption_energy')) }}
unit_of_measurement: "Wh"
- name: "Yesterday Exported Energy Cost"
state: >
{{ (states('sensor.exported_energy_cost')) }}
unit_of_measurement: "$"
- name: "Yesterday Imported Energy Cost"
state: >
{{ (states('sensor.imported_energy_cost')) }}
unit_of_measurement: "$"
- name: "Yesterday Self Consumed Energy Cost"
state: >
{{ (states('sensor.self_consumed_cost')) }}
unit_of_measurement: "$"
- name: "Yesterday Energy Cost Difference"
state: >
{{ (states('sensor.energy_cost_difference')) }}
unit_of_measurement: "$"
So I was hoping i could create the weekly like this:
# Previous week stats
- trigger:
- platform: time
at: "23:59:00"
condition:
- condition: time
weekday: sun # This condition ensures it only triggers on Sundays
sensor:
- name: "Previous Week Exported Energy"
state: >
{{ (states('sensor.weekly_exported_energy_0_06')) }}
unit_of_measurement: "Wh"
But I’m not getting anywhere. I tried looking at automations but couldn’t figure out what to do under action. Any help is appreciated
Thanks,
David