Getting daily energy consumption for a automation

Hey guys, I need your help.

I am trying to set up an automation with only enables a device if it’s daily energy usage is below a certain threshold. I set up a utility meter to get the power user per day … now my issue that despite the utility meter resetting correctly and report 0 kWh used for today I can’t see to find a way to get this number into the automation. The only attributes I can call are „Last Period“ und „Last valid State“ which are both both reset to zero and still yesterdays values.

Can someone point me in the right direction?

It’s just the numeric state you want. No attributes. Because the utility meter state is the number.

Example:

description: ""
mode: single
trigger:
  - platform: numeric_state
    entity_id:
      - sensor.house_daily_electric_day
    id: high_use
    above: 10
    alias: Device use above 10kW
  - platform: template
    value_template: "{{ states('sensor.house_daily_electric_day')|float(-1) == 0) }}"
    id: low_use
    alias: device use is 0kW
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - high_use
        sequence:
          - service: switch.turn_off
            target:
              entity_id:
                - switch.livingroom_fire
              device_id: []
              area_id: []
            data: {}
      - conditions:
          - condition: trigger
            id:
              - low_use
        sequence:
          - service: switch.turn_on
            target:
              entity_id: switch.livingroom_fire
            data: {}

Thank you very much, that is exactly what I need. That’s … well hidden considering all other parameters are in the attributes.

Just look in dev tools states page if you come across something like this again. The first column is the entity, the middle one is the actual state, and the last column is all the attributes.

To be honest i never considered „state“ to be an actual value, I always thought it was just the overall variable name for the entity. I know better now.