本帖最后由 cookiesliy 于 2024-10-20 01:02 编辑
实体没问题能出来,就是这个单位替换和换算没效果.请问是哪里有问题
#netdata
sensor:
- platform: netdata
host: "192.168.2.1"
port: "19999"
name: main_router
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"
devices_temp: #设备温度
data_group: "sensors.temp_thermal_zone1_thermal_thermal_zone1"
element: "sys_devices_virtual_thermal_thermal_zone1_temp"
#单位换算
template:
- sensor:
- name: "internet received"
unique_id: main_router_internet_received
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"
unique_id: main_router_internet_sent
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_system_uptime
icon: mdi:av-timer
unit_of_measurement: "天"
state: "{{ (states('sensor.main_router_system_uptime') | float /3600 /24 ) | round(1, default=0) }}"
|