Hi there!
I just want a simple historical graphic and a real time indicator of my inbound / outbound bps readings out of an AP with dd-wrt with snmp.
I know nothing about yaml and a bit of coding so right now it is a trial and error approach with a 100% error rate.
I am able to “get” the info properly and this is how I see it:
console>snmputil get .1.3.6.1.2.1.2.2.1.10.7
Variable = interfaces.ifTable.ifEntry.ifInOctets.7
Value = Counter32 1117057065
console>snmputil get .1.3.6.1.2.1.2.2.1.16.7
Variable = interfaces.ifTable.ifEntry.ifOutOctets.7
Value = Counter32 3622501640
sensors are set this way…
sensor:
- platform: snmp
name: heavendoor_snmp-wan-in
host: !secret fwhost
community: !secret heavendoor_snmp-community
baseoid: .1.3.6.1.2.1.2.2.1.10.7
default_value: 0
accept_errors: true
version: 2c
unit_of_measurement: bps
scan_interval: 15
- platform: snmp
name: heavendoor_snmp-wan-out
host: !secret fwhost
community: !secret heavendoor_snmp-community
baseoid: .1.3.6.1.2.1.2.2.1.16.7
default_value: 0
accept_errors: true
version: 2c
unit_of_measurement: bps
scan_interval: 15
I basically followed the instructions here:
But the automation is failing.
Automation looks like this:
alias: Internet Bandwidth
description: ""
trigger:
- platform: time_pattern
seconds: /15
condition: []
action:
- parallel:
- service: input_number.set_value
entity_id: input_number.inbound_memory
data_template:
value: "{{ states('sensor.heavendoor_snmp_wan_in') | float | round(2) }}"
- service: input_number.set_value
entity_id: input_number.outbound_memory
data_template:
value: "{{ states('sensor.heavendoor_snmp_wan_out') | float | round(2) }}"
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- service: input_number.set_value
entity_id: input_number.inbound_bandwidth
data_template:
value: >-
{{ ((( (states('sensor.heavendoor_snmp_wan_in') | float | round(2)) -
(states('input_number.inbound_memory') | float | round(2))) * 8 *
1000) / (15*1000000000)) | float | round(2) }}
- service: input_number.set_value
entity_id: input_number.outbound_bandwidth
data_template:
value: >-
{{ ((( (states('sensor.heavendoor_snmp_wan_out') | float | round(2)) -
(states('input_number.outbound_memory') | float | round(2))) * 8 *
1000) / (15*1000000000)) | float | round(2) }}
mode: single
… but it fails reading:
Error rendering data template: ValueError: Template error: float got invalid input ‘unknown’ when rendering template ‘{{ ((( (states(‘sensor.heavendoor_snmp_wan_in’) | float | round(2)) - (states(‘input_number.inbound_memory’) | float | round(2))) * 8 * 1000) / (15*1000000000)) | float | round(2) }}’ but no default was specified
I think that that snmp sensor is not returning a proper value (or any value at all) and that’s why it considers the input as unkown…
Any help would be greatly appreciated! In fact, if there is a an easier way of getting a traffic history out of dd-wrt feel free to comment!
Thanks!