Redid wan traffic collection and replaced the old clumsy way. Added usage_meters.
This commit is contained in:
22
sensors.yaml
22
sensors.yaml
@@ -21,31 +21,39 @@
|
||||
query: 'SELECT table_schema "database", Round(Sum(data_length + index_length) / 1048576, 2) "value" FROM information_schema.tables WHERE table_schema="homeassistant" GROUP BY table_schema;'
|
||||
column: 'value'
|
||||
unit_of_measurement: MB
|
||||
|
||||
# SNMP (Juniper) router traffic sensor
|
||||
- platform: snmp
|
||||
name: snmp_wan_in
|
||||
host: !secret router_ip
|
||||
community: !secret router_community
|
||||
baseoid: .1.3.6.1.2.1.2.2.1.10.511
|
||||
|
||||
- platform: snmp
|
||||
name: snmp_wan_out
|
||||
host: !secret router_ip
|
||||
community: !secret router_community
|
||||
baseoid: .1.3.6.1.2.1.2.2.1.16.511
|
||||
|
||||
- platform: derivative
|
||||
source: sensor.snmp_wan_in
|
||||
unit_time: s
|
||||
unit: B
|
||||
name: wan_in_derivative
|
||||
- platform: derivative
|
||||
source: sensor.snmp_wan_out
|
||||
unit_time: s
|
||||
unit: B
|
||||
name: wan_out_derivative
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
internet_speed_in:
|
||||
friendly_name: 'Internet Speed IN'
|
||||
value_template: '{{ ((states.input_number.internet_traffic_delta_in.state | float ) / 1000000 ) | round(2) }}'
|
||||
value_template: "{{ (( states('sensor.wan_in_derivative') | float * 8 / 1000000 ) | round(2)) }}"
|
||||
unit_of_measurement: 'Mbps'
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
internet_speed_out:
|
||||
friendly_name: 'Internet Speed OUT'
|
||||
value_template: '{{ ((states.input_number.internet_traffic_delta_out.state | float ) / 1000000 ) | round(2) }}'
|
||||
value_template: "{{ (( states('sensor.wan_out_derivative') | float * 8 / 1000000 ) | round(2)) }}"
|
||||
unit_of_measurement: 'Mbps'
|
||||
|
||||
- platform: statistics
|
||||
@@ -53,7 +61,6 @@
|
||||
state_characteristic: mean
|
||||
entity_id: sensor.internet_speed_in
|
||||
sampling_size: 10
|
||||
|
||||
- platform: statistics
|
||||
name: 'WAN Traffic Out'
|
||||
state_characteristic: mean
|
||||
@@ -71,3 +78,4 @@
|
||||
sun_setting_template:
|
||||
friendly_name: "Sun Setting Template"
|
||||
value_template: "{{ as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom ('%H:%M') }}"
|
||||
|
||||
|
Reference in New Issue
Block a user