lovelace-rpi-monitor-card icon indicating copy to clipboard operation
lovelace-rpi-monitor-card copied to clipboard

displaying free / used memory on the Custom RPi Card

Open nabeelmoeen opened this issue 3 years ago • 7 comments

Total memory and %age used is available in the monitoring script output. Is there a way to customize the RPi custom card to pick and choose what sensor values to display vs. the defaults

nabeelmoeen avatar May 16 '21 08:05 nabeelmoeen

Hmmm... not at this time. You likely already know that you can see the values by tapping on the card, right?

So, what would you propose? Sensors would have to be swapped out. So which would you replace with what?

ironsheep avatar Aug 09 '21 21:08 ironsheep

I think showing memory usage % is better than for example Model Interfaces. But it would be nice if the sensors displayed were configurable.

juancamilo87 avatar Sep 20 '21 20:09 juancamilo87

maybe have RAM utilization vs. the SD Card size? the disk space usage already appears, which is probably more relevant than the total disk space (although I understand, this may depend on my own usecase).

what i had in mind was something like the default 'glance' card, or @dangreco's threedy_card that allows you to pick which sensors you want displayed for the entity.

type: 'custom:threedy-card'
base_entity: sensor.ender_5
monitored:
  - Status
  - ETA
  - Hotend
  - Bed
  - Elapsed
  - Remaining

I may attempt this modification as I start learning a bit of programming and HA customization

nabeelmoeen avatar Sep 26 '21 13:09 nabeelmoeen

I like this as well. It would be nice to have the option to add memory and CPU usage. For me, this is more relevant than total disk space or OS.

thijselblaso avatar Jan 03 '22 09:01 thijselblaso

I created a template for memory percentage. If you put the following into the Template editor, you'll see the result of each step. I then just created a sensor based on the third one and added that to a vertical stack card using CPU usage, the new sensor, and then the RPi Monitor Card below those.

free: {{ state_attr('sensor.rpi_monitor_omv', 'memory').free_mb }}

memory: {{ state_attr('sensor.rpi_monitor_omv', 'memory').size_mb }}

percent: {{ ((state_attr('sensor.rpi_monitor_omv', 'memory').free_mb |int / state_attr('sensor.rpi_monitor_omv', 'memory').size_mb |int ) * 100) | round(0)}}%

The last percent sign is just the 'unit' and is not necessary for the template.

jsp196 avatar Jan 12 '22 19:01 jsp196

@jsp196 Thanks for the template! I created this template for used memory:

memory used in percentage:
{{ (100 / (state_attr('sensor.rpi_monitor_omv', 'memory').size_mb |int) * ((state_attr('sensor.rpi_monitor_omv', 'memory').size_mb |int ) - (state_attr('sensor.rpi_monitor_omv', 'memory').free_mb |int ))) | round(0) }}%

richardbabangida avatar Jan 12 '22 22:01 richardbabangida

I've submitted a pull request for this change modified card and script output below rpi-monitor

nabeelmoeen avatar Apr 13 '22 06:04 nabeelmoeen

This is merged into repo... working on more changes, then will release!

ironsheep avatar Feb 05 '23 00:02 ironsheep

Changes committed. Feature appears in v1.2.6 and later

ironsheep avatar Feb 05 '23 23:02 ironsheep