Added a SNMP based (Juniper) internet bandwidth monitor.
This commit is contained in:
parent
9575246cd5
commit
45126e79bb
@ -309,3 +309,23 @@
|
||||
- schlafzimmer
|
||||
- wohnzimmer
|
||||
mode: single
|
||||
- id: snmp_monitor_traffic_in
|
||||
alias: Monitor Traffic In
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: sensor.snmp_wan_in
|
||||
action:
|
||||
- service: input_number.set_value
|
||||
data_template:
|
||||
entity_id: input_number.internet_traffic_delta_in
|
||||
value: '{{ ((trigger.to_state.state | int - trigger.from_state.state | int) * 8 ) / ( as_timestamp(trigger.to_state.last_updated) - as_timestamp(trigger.from_state.last_updated) ) }}'
|
||||
- id: snmp_monitor_traffic_out
|
||||
alias: Monitor Traffic Out
|
||||
trigger:
|
||||
platform: state
|
||||
entity_id: sensor.snmp_wan_out
|
||||
action:
|
||||
- service: input_number.set_value
|
||||
data_template:
|
||||
entity_id: input_number.internet_traffic_delta_out
|
||||
value: '{{ ((trigger.to_state.state | int - trigger.from_state.state | int) * 8 ) / ( as_timestamp(trigger.to_state.last_updated) - as_timestamp(trigger.from_state.last_updated) ) }}'
|
||||
|
@ -29,6 +29,9 @@ webostv: !include webostv.yaml
|
||||
homeassistant:
|
||||
customize: !include customize.yaml
|
||||
|
||||
# Include helpers
|
||||
input_number: !include input_number.yaml
|
||||
|
||||
# Spotify
|
||||
spotify: !include spotify.yaml
|
||||
|
||||
|
@ -2,3 +2,19 @@ media_player.wohnzimmer_main:
|
||||
icon: mdi:audio-video
|
||||
sensor.home_assistant_datenbankgrosse:
|
||||
icon: mdi:database
|
||||
sensor.download_speed_mean:
|
||||
friendly_name: 'SNMP Download Average'
|
||||
icon: mdi:speedometer
|
||||
sensor.upload_speed_mean:
|
||||
friendly_name: 'SNMP Upload Average'
|
||||
icon: mdi:speedometer
|
||||
sensor.ping_time_mean:
|
||||
friendly_name: 'SNMP Ping Average'
|
||||
icon: mdi:clock-fast
|
||||
sensor.wan_traffic_in_mean:
|
||||
friendly_name: 'WAN Download Average'
|
||||
icon: mdi:download
|
||||
sensor.wan_traffic_out_mean:
|
||||
friendly_name: 'WAN Upload Average'
|
||||
icon: mdi:upload
|
||||
|
||||
|
13
groups.yaml
13
groups.yaml
@ -0,0 +1,13 @@
|
||||
snmp_monitor:
|
||||
name: Bandwith Monitoring
|
||||
entities:
|
||||
- sensor.internet_speed_in
|
||||
- sensor.internet_speed_out
|
||||
- sensor.wan_traffic_in_mean
|
||||
- sensor.wan_traffic_out_mean
|
||||
snmp_raw_values:
|
||||
name: SNMP Raw Values
|
||||
entities:
|
||||
- sensor.snmp_wan_in
|
||||
- sensor.snmp_wan_out
|
||||
|
11
input_number.yaml
Normal file
11
input_number.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
internet_traffic_delta_in:
|
||||
name: "Traffic IN Delta"
|
||||
initial: 0
|
||||
min: 0
|
||||
max: 1000000000000
|
||||
|
||||
internet_traffic_delta_out:
|
||||
name: "Traffic OUT Delta"
|
||||
initial: 0
|
||||
min: 0
|
||||
max: 1000000000000
|
@ -28,6 +28,10 @@
|
||||
entities:
|
||||
- sun.sun # Don't record sun data
|
||||
- sensor.fritzbox_device_uptime
|
||||
- sensor.snmp_wan_in
|
||||
- sensor.snmp_wan_out
|
||||
- input_number.internet_traffic_delta_in
|
||||
- input_number.internet_traffic_delta_out
|
||||
# event_types:
|
||||
# - call_service # Don't record service calls
|
||||
|
||||
|
34
sensors.yaml
34
sensors.yaml
@ -18,3 +18,37 @@
|
||||
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: template
|
||||
sensors:
|
||||
internet_speed_in:
|
||||
friendly_name: 'Internet Speed IN'
|
||||
value_template: '{{ ((states.input_number.internet_traffic_delta_in.state | float ) / 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) }}'
|
||||
unit_of_measurement: 'Mbps'
|
||||
|
||||
- platform: statistics
|
||||
name: 'WAN Traffic In'
|
||||
entity_id: sensor.internet_speed_in
|
||||
|
||||
- platform: statistics
|
||||
name: 'WAN Traffic Out'
|
||||
entity_id: sensor.internet_speed_out
|
||||
|
Loading…
Reference in New Issue
Block a user