Hi !
I’m running into trouble trying to make a calculation of energy price once per day.
This template is what i use right now and i’m showing it on a card. Instead i wan’t to calculate it once per day, so it does not update as frequently and then display that value on a group together with power and the switch.
platform: template
sensors:
dehumidifier_price:
value_template: '{{ (states.sensor.dehumidifier_switch6_energy.state | float * 2.32) | round(0) }}'
friendly_name: 'Total expense'
unit_of_measurement: 'kr'
I’m very new to templating and i could not find a guide pointing me in the right direction so i hope someone here could find the time and help me out.
This is the automation i tried to set up, but my brain grinded to a halt when i got to the “action:”
- alias: 'Update total expence'
trigger:
- platform: time
at: '01:00:00'
condition:
condition: state
entity_id: switch.dehumidifier_switch6_switch
state: 'on'
This is where i tried but failed (the 2.32 is my electricity cost):
action:
service_template: >
'{{ (states.sensor.dehumidifier_switch6_energy.state | float * 2.32) | round(0) }}'
entity_id: sensor.dehumidifier_price
Thank you!