Rounding numbers for systemmonitor load

Hi,
I’ve got under sensor

- platform: systemmonitor
  resources:
    - type: load_1m

but I get a number like 0.9835023570252 which is a bit too long.
I think that I need to use

value_template: "{{ states.sensor.load_1m | round(2)}}"

But do I need to create a new extra sensor to display the rounded load (which is not nice at all), or can I tweak the display of the load as it is now?

I think you may need to create a Template Sensor, although there may be another way I’m not aware of. If you do, I’d suggest:

value_template: "{{ states('sensor.load_1m') | float | round(2) }}"

Or at least:

value_template: "{{ states.sensor.load_1m.state | round(2) }}"
2 Likes

Yes I wanted to avoid to have two sensors with the load on my dashboard.

I think that I can replace it with

- platform: command_line
  name: Load (1m)
  command: cat /proc/loadavg|cut -d' ' -f1
  scan_interval: 60
- platform: command_line
  name: Load (5m)
  command: cat /proc/loadavg|cut -d' ' -f2
  scan_interval: 60
- platform: command_line
  name: Load (15m)
  command: cat /proc/loadavg|cut -d' ' -f3
  scan_interval: 60

but it’s a shame to no being able to use the systemmonitor sensor…
Also I’m not sure how python gives a load with many many digits after the comma, while /proc/loadavg just gives 2 digits after the comma.

So, it’s not possible with systemmonitor sensor at all? :frowning: (hiding main sensor not variant)

customize.yaml not working

sensor.load_1m:
  value_template: '{{ states.sensor.load_1m.state | round(1)}}'

I am using second sensor:

  - platform: template
    sensors:
      load:
        value_template: '{{ states.sensor.load_1m.state | round(2)}} {{ states.sensor.load_5m.state | round(2)}} {{ states.sensor.load_15m.state | round(2)}}'