159 字1 分钟
Home Assistant 用 Command line Sensor 获取硬盘温度
Home Assistant 获取 CPU 温度比较简单,官方的示例中即有。
Home Assistant 支持 hddtemp 获取硬盘温度,只是 hddtemp 不支持 USB 移动硬盘,所以使用 smartmontools 通过 S.M.A.R.T 获取温度。
首先安装 smartmontools,
apt-get install smartmontoolsHome Assistant 用 Command line Sensor 获取温度数据,参数中的 -d sat 是关键,
# CPU 温度- platform: command_line name: CPU Temperature command: "cat /sys/class/thermal/thermal_zone0/temp" unit_of_measurement: "°C" scan_interval: 300
# 硬盘温度- platform: command_line name: HDD Temperature command: "smartctl -d sat -a /dev/sda | grep Temperature_Celsius | cut -c88-89" unit_of_measurement: "°C" scan_interval: 300相关链接:https://home-assistant.io/components/sensor.command_line/