Utility meter, split in heat and cold energy usage with seasons

My (none smart) airco is connected to a power plug to measure the consumption of energy.
It only has one energy sensor:

sensor.smart_plug_aircos_maxicool_electric_consumption_kwh

If I make 2 extra sensors, for example:

sensor.smart_plug_aircos_maxicool_heating_electric_consumption_kwh
sensor.smart_plug_aircos_maxicool_cooling_electric_consumption_kwh

Is it possible to make it that the heating sensor only counts when the season is spring or summer, or specific months?

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.

1 Like

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?

It does create extra sensors, one for each tariff.

1 Like

Thanks,

I made it like this:

Utility Meter >

aircos_maxicool_eternal_energy_kwh:
  name: "Aircos MaxiCool - Eternal Energy (kWh)"
  unique_id: "sensor_aircos_maxicool_eternal_energy_kwh"
  source: sensor.smart_plug_aircos_maxicool_electric_consumption_kwh
  tariffs:
    - heating
    - cooling
  always_available: true

Automation >

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

Utility Meter >

aircos_maxicool_cooling_yearly_energy_kwh:
  name: "Aircos MaxiCool Cooling - Yearly Energy (kWh)"
  unique_id: "sensor_aircos_maxicool_cooling_yearly_energy_kwh"
  source: sensor.aircos_maxicool_eternal_energy_kwh_cooling
  cycle: yearly
  always_available: true

aircos_maxicool_heating_yearly_energy_kwh:
  name: "Aircos MaxiCool Heating - Yearly Energy (kWh)"
  unique_id: "sensor_aircos_maxicool_heating_yearly_energy_kwh"
  source: sensor.aircos_maxicool_eternal_energy_kwh_heating
  cycle: yearly
  always_available: true

Template >

sensor:
  - name: "Aircos MaxiCool Heating - Last Year Energy (kWh)"
    unique_id: "sensor_aircos_maxicool_heating_last_year_energy_kwh"
    unit_of_measurement: "kWh"
    device_class: energy
    state_class: total
    icon: "mdi:lightning-bolt"
    state: >
      {{ ( state_attr('sensor.aircos_maxicool_heating_yearly_energy_kwh','last_period')|float ) }}
    availability: "{{ state_attr('sensor.aircos_maxicool_heating_yearly_energy_kwh','last_period') | is_number }}"


sensor:
  - name: "Aircos MaxiCool Cooling - Last Year Energy (kWh)"
    unique_id: "sensor_aircos_maxicool_cooling_last_year_energy_kwh"
    unit_of_measurement: "kWh"
    device_class: energy
    state_class: total
    icon: "mdi:lightning-bolt"
    state: >
      {{ ( state_attr('sensor.aircos_maxicool_cooling_yearly_energy_kwh','last_period')|float ) }}
    availability: "{{ state_attr('sensor.aircos_maxicool_cooling_yearly_energy_kwh','last_period') | is_number }}"