Skip to content

Commit

Permalink
Merge pull request #44 from dougiteixeira/vm-memory-perc-fix
Browse files Browse the repository at this point in the history
Fix VMs percentage free memory sensor
  • Loading branch information
dougiteixeira authored Mar 12, 2023
2 parents 46abc06 + f1c32ec commit ce1bed0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions custom_components/proxmoxve/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,7 @@ class ProxmoxSensorEntityDescription(ProxmoxEntityDescription, SensorEntityDescr
icon="mdi:memory",
native_unit_of_measurement=PERCENTAGE,
conversion_fn=lambda x: round(x * 100, 1),
value_fn=lambda x: 1
- x[ProxmoxKeyAPIParse.MEMORY_FREE] / x[ProxmoxKeyAPIParse.MEMORY_TOTAL] if x[ProxmoxKeyAPIParse.MEMORY_TOTAL] > 0 else 0,
value_fn=lambda x: x[ProxmoxKeyAPIParse.MEMORY_FREE] / x[ProxmoxKeyAPIParse.MEMORY_TOTAL] if x[ProxmoxKeyAPIParse.MEMORY_TOTAL] > 0 else 0,
state_class=SensorStateClass.MEASUREMENT,
),
ProxmoxSensorEntityDescription(
Expand Down

0 comments on commit ce1bed0

Please sign in to comment.