I’ve spent some time trying to figure out how to do this on my own and don’t think I can do it by myself.
I have two SMNP integers that I want to calculate into a percentage. I have found some examples on the forums but cannot get it to work.
- platform: snmp
name: 'ESXi Total RAM'
host: 192.168.1.201
baseoid: 1.3.6.1.2.1.25.2.3.1.5.6
community: !secret esxi_community
accept_errors: true
- platform: snmp
name: 'ESXi Used RAM'
host: 192.168.1.201
baseoid: 1.3.6.1.2.1.25.2.3.1.6.6
community: !secret esxi_community
accept_errors: true
- platform: template
sensors:
esxi_memory_used:
friendly_name: "ESXi Memory Usage"
unit_of_measurement: '%'
value_template: '{{ states('sensor.esxi_used_ram') | float / states('sensor.esxi_total_ram') | float * 100) | round(2) }}'
Trying to divide both sensor outputs to get a percentage, what am I doing wrong?