SNMP Bandwidth monitoring

Hi All,
I’ve managed to use the SNMP sensor to monitor the LAN ports on my router to display traffic info. The info is displayed in bits. Is there a way to change that to MB of GB? I don’t think the SNMP sensor can convert to datatypes as in multiplying the retieved IOD field by 0.00000125 to change to MB. Any ideas?

Thanks

Template Sensor

Aaah, just found it, thanks very much!

No worries. It’s always amazing to me how much you can do with templates in HA. They’re so cool.

Let me know if you have any issues and I’ll try to help wherever I can.

Hi there, so, just need some help with setting the template up. I have the following sensor setup in the sensors.yaml file:

  • platform: snmp
    name: NAS - In
    host: 192.168.0.1
    port: 161
    community: public
    baseoid: 1.3.6.1.2.1.2.2.1.16.4
    unit_of_measurement: “bits”

This gives a value back in bits (i think) and then I need to convert it to MB

  • platform: template
    sensors:
    nas__in:
    value_template: ‘{{ states.sensor.nas__in.state | multiply(0.0000001192) | round(2) }}’
    friendly_name: ‘NAS In’
    unit_of_measurement: ‘MB’

So, my question is then, is this correct? I now have sensor.nas_in and sensor.nas_in_2… Is there no way to nest the template sensor into the snmp sensor? I have issues with the value template as rounding doesn’t work all the time, it will only multiply and then not round

I think you’ve got it right, simply hide the snmp sensor and only show the template in the Web UI.

Yes, and I would also suggest using a different name for your template sensor than the one you are drawing the values from to keep things straight in the future.

Hi Guys, thanks for the replies, I’ve made some tweaks and have taken your advice, seems alright, but I’ve got a couple more questions:

  1. Sensor readings are displayed in groups and their output is sometimes not rounded off correctly. I’ll get a reading of 20.17 and when it reruns it displays as 20.100000000000009. Why is this? (Not sure if this has anything to do with it, but I also get these values from openweathermap when the temperature or pressure monitors run)

Could it be because SNMP sensors run prior to the Template sensors. Shouldn’t they run as nested or child sensors e.g
1 - SNMP Sensor A
a - SNMP Template A
2 - SNMP Sensor B
a - SNMP Template B

Oh and is there any way to run 1 SNMP Sensor to pull all the values instead of having to run 8. There can be quite a backlog if Homeassistant becomes complex…

Last one, can the sensors be scheduled to run at specific times or intervals?