Higher CPU usage after updating to 2022.6.1

Should I be expecting a higher CPU usage after updating from 2022.6.0 to 2022.6.1?
This is running in HAOS over a Raspberry Pi 4.

image
image
image

Never mind, the high CPU consumption was related to one of my templates sensors and not to the new update.

what card do you use for these graphs? Looks neat

I’m using statistics-graph.
It’s OK when you have just a couple of sensors shown. If you have more that that in the same card it becomes messy, so I split in multiple cards.

chart_type: line
period: hour
days_to_show: 3
type: statistics-graph
entities:
  - sensor.processor_use
stat_types:
  - mean
  - min
  - max
  - sum

1 Like

thanks. Learning something new every day.

1 Like

May I ask how did you find what was causing your higher temps - i.e. which template sensor?

Sure!

I was trying to move all my groups from yaml to the new group helpers. It worked fine for the supported types, but as sensor’s groups are not available on the helpers, I was playing around with programming in a try to find my way.

The biggest case was related to my power consumption sensors, as I used to have one group per room containing all the power sensors from that room and then summing up the values using the extract function. So I have a template per room and an additional one summing up all the power sensors in my apartment.
That was a bit buggy, so I was happy to find a way without using the groups.

So I tried to search only the power sensors from a specific area with this:

{{ states.sensor 
| rejectattr('entity_id', 'in', ['sensor.total_power','sensor.living_room_total_power']) 
| selectattr('entity_id', 'in', area_entities('Living room')) 
| selectattr('attributes.device_class', 'defined') 
| selectattr('attributes.device_class', 'eq', 'power') 
| rejectattr('state', 'in', ['unavailable','unknown']) 
| map(attribute='state') 
| map('float') 
| sum }}

I had one of this per room (changing the room name and the exclusion (to not measure the sum sensor also) and another one without that filter (so I have all the power in the apartment), but that was increasing the CPU usage from ~10% to >30% (and the temperature following the extra CPU).
It was a nice solution, as I don’t have to change the template or groups every time I add a new sensor to the room, but i didn’t like the price (extra CPU).

In the end, I made it simple just with just a sum of each sensor on each room. It will require more maintenance (just like my original one, based on groups), but it’s way more stable a less costly to CPU:

    - name: Living room - Total power
      unique_id: xyz123
      unit_of_measurement: "W"
      device_class: power
      state: >-
        {{ 0
        +  (states('sensor.living_room_lights_map_wall_power') | float(0))
        +  (states('sensor.living_room_lights_tv_wall_power') | float(0))
        +  (states('sensor.living_room_map_wall_outlets_power') | float(0))
        +  (states('sensor.living_room_tv_rack_outlets_power') | float(0))
        +  (states('sensor.living_room_windows_outlet_power') | float(0))
        }}

And the one with total power is just a sum of all rooms:

    - name: Total power
      unique_id: abc987
      unit_of_measurement: "W"
      device_class: power
      state: >-
        {{ 0
        +  (states('sensor.balcony_total_power') | float(0))
        +  (states('sensor.bathroom_total_power') | float(0))
        +  (states('sensor.bedroom_total_power') | float(0))
        +  (states('sensor.closet_total_power') | float(0))
        +  (states('sensor.data_centre_total_power') | float(0))
        +  (states('sensor.guest_bathroom_total_power') | float(0))
        +  (states('sensor.guest_room_total_power') | float(0))
        +  (states('sensor.hall_total_power') | float(0))
        +  (states('sensor.kitchen_total_power') | float(0))
        +  (states('sensor.living_room_total_power') | float(0))
        +  (states('sensor.office_total_power') | float(0))
        }}

Have I answered your question?

hi Edward, you provided a great amount of explanation, thank you.

I applaud people like you who spend some amount of time to answer questions on forums like this.
People like you and many others, make this community great!

Cheers!

1 Like