Easiest is to use the tariff function of the utility meter. You can set values for tariff types, and utility meter then splits it in separate counters per tariff. In your case, tariffs would be heating and cooling. The. create an automation to set which tariff is active at a certain moment.
Thanks! I did not know about the tariff function.
But if I understand it correct than this does not create 2 separate sensors?
I would like to show them in my lovelace and create a yearly and last_year sensor of both heating and cooling. Or can I choose what tariff from the sensor is shown in the lovelace and show both tariffs with one sensor?
id: "automation_energy_aircos_maxicool_select_tariff"
alias: "Energy - Aircos MaxiCool Select Tariff"
description: "Selecteer het juiste energie tariff (Cooling of Heating) op basis van de astrologische seizoenen om de energie meter te splitsen in verbruik van verwarmen of verkoelen"
mode: single
triggers:
- trigger: homeassistant
event: start
id: homeassistant_start
- trigger: event
event_type: automation_reloaded
id: automation_reload
- trigger: state
entity_id:
- sensor.season_astronomical
from: null
to: spring
variables:
tariff: cooling
- trigger: state
entity_id:
- sensor.season_astronomical
from: null
to: autumn
variables:
tariff: heating
conditions: []
actions:
- action: select.select_option
metadata: {}
data:
option: "{{ tariff }}"
target:
entity_id: sensor.aircos_maxicool_eternal_energy_kwh