|
发表于 2024-10-31 16:02:54
|
显示全部楼层
大佬,跟着你的步骤做,集成显示了,但是单位没转换过来,请帮忙,看下哪里配置错了,谢谢
# ---netdata配置---
sensor:
- platform: netdata
host: "192.168.3.3"
port: "19999"
name: OpenWrt
resources:
internet_received:
data_group: "net.eth0" # 下载流量(b/s)
element: "received"
internet_sent:
data_group: "net.eth0" # 上传流量(b/s)
element: "sent"
invert: true
system_uptime: # 系统上线运行时间(单位:秒)
data_group: "system.uptime"
element: "uptime"
# ---单位换算---
template:
- sensor:
- name: "internet received rate"
unique_id: internet_received_rate
device_class: data_rate
icon: mdi:download-network-outline
unit_of_measurement: "kB/s"
state: "{{ (states('sensor.main_router_internet_received') | float / 8) | round(1, default=0) }}"
- name: "internet sent rate"
unique_id: internet_sent_rate
device_class: data_rate
icon: mdi:upload-network-outline
unit_of_measurement: "kB/s"
state: "{{ (states('sensor.main_router_internet_sent') | float / 8) | round(1, default=0) }}"
- name: "Main Router Uptime"
unique_id: main_router_uptime
icon: mdi:av-timer
unit_of_measurement: "天"
state: "{{ (states('sensor.main_router_system_uptime') | float / 3600 / 24) | round(1, default=0) }}" |
|