feat: simple sensor panels with file-based data source (#7)

* add simulation mode for easier development

* improved sensor file watcher, poc cpu & mem usage

Trigger file read by rename event

* feat: system information sensor tool

Gather various sensor values with the sysinfo crate:
https://github.com/GuillaumeGomez/sysinfo
Values can be written to a sensor source file with the `--out` cmd line
option for the `asterctl` tool.

* ci: build sysinfo tool and include in build artifact

* feat: support integerDigits, decimalDigits sensor value format options

* docs: update documentation

Closes #6
This commit is contained in:
Markus Zehnder
2025-08-22 13:41:31 +02:00
committed by GitHub
parent 3f174251d6
commit e85d616da7
32 changed files with 3803 additions and 3933 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

+948
View File
@@ -0,0 +1,948 @@
{
"setup": {
"switchTime": "30",
"refresh": 1
},
"mianban": [
1,
2
],
"diy": [
{
"type": 5,
"img": "default_1_index.jpg",
"sensor": [
{
"mode": 1,
"type": 1,
"name": "CPU温度",
"label": "cpu_temperature",
"x": 195,
"y": 110,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "98",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 120,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": "",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 1,
"name": "CPU占用",
"label": "cpu_percent",
"x": 200,
"y": 285,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "98",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 60,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": "%",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 1,
"name": "RAM占用",
"label": "memory_usage",
"x": 560,
"y": 70,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "98",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " %",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 1,
"name": "RAM温度",
"label": "memory_Temperature",
"x": 560,
"y": 131,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "98",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " ℃",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 1,
"name": "tt hh:mm:ss",
"label": "DATE_m_d_h_m_2",
"x": 515,
"y": 246,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "下午 06:08:08",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": -1,
"unit": "",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 1,
"name": "External IP Address",
"label": "net_ip_address",
"x": 515,
"y": 307,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "146.56.182.244",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": -1,
"unit": "",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 1,
"name": "GPU占用",
"label": "gpu_core",
"x": 852,
"y": 70,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "98",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " %",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 1,
"name": "GPU温度",
"label": "gpu_temperature",
"x": 852,
"y": 131,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "98",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " ℃",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 1,
"name": "网络上传",
"label": "net_upload_speed",
"x": 852,
"y": 246,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "100 K/S",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": -1,
"unit": "",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 1,
"name": "网络下载",
"label": "net_download_speed",
"x": 852,
"y": 307,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "120 K/S",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": -1,
"unit": "",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
}
]
},
{
"type": 5,
"img": "default_1_hdd.jpg",
"sensor": [
{
"mode": 1,
"type": 1,
"name": "主板温度",
"label": "motherboard_temperature",
"x": 315,
"y": 105,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "98",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 40,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "right",
"integerDigits": -1,
"decimalDigits": 1,
"unit": " ℃",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 2,
"name": "固态1",
"label": "storage_ssd[0]['temperature']",
"x": 265,
"y": 181,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " ℃",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 3,
"type": 2,
"name": "固态1-进度条",
"label": "storage_ssd[0]['used']",
"x": 50,
"y": 157,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": "",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "progress1.png",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 2,
"name": "固态2",
"label": "storage_ssd[1]['temperature']",
"x": 265,
"y": 246,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " ℃",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 3,
"type": 2,
"name": "固态2-进度条",
"label": "storage_ssd[1]['used']",
"x": 50,
"y": 220,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": "",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "progress1.png",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 2,
"name": "固态3",
"label": "storage_ssd[2]['temperature']",
"x": 265,
"y": 306,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " ℃",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 3,
"type": 2,
"name": "固态3-进度条",
"label": "storage_ssd[2]['used']",
"x": 50,
"y": 282,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": "",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "progress1.png",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 2,
"name": "固态4",
"label": "storage_ssd[3]['temperature']",
"x": 580,
"y": 70,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " ℃",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 3,
"type": 2,
"name": "固态4-进度条",
"label": "storage_ssd[3]['used']",
"x": 400,
"y": 45,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": "",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "progress2.png",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 2,
"name": "固态5",
"label": "storage_ssd[4]['temperature']",
"x": 580,
"y": 130,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " ℃",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 3,
"type": 2,
"name": "固态5-进度条",
"label": "storage_ssd[4]['used']",
"x": 400,
"y": 106,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": "",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "progress2.png",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 2,
"name": "硬盘1",
"label": "storage_hdd[0]['temperature']",
"x": 580,
"y": 247,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " ℃",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 3,
"type": 2,
"name": "硬盘1-进度条",
"label": "storage_hdd[0]['used']",
"x": 400,
"y": 221,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": "",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "progress2.png",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 2,
"name": "硬盘2",
"label": "storage_hdd[1]['temperature']",
"x": 580,
"y": 307,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " ℃",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 3,
"type": 2,
"name": "硬盘2-进度条",
"label": "storage_hdd[1]['used']",
"x": 400,
"y": 282,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": "",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "progress2.png",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 2,
"name": "硬盘3",
"label": "storage_hdd[2]['temperature']",
"x": 870,
"y": 70,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " ℃",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 3,
"type": 2,
"name": "硬盘3-进度条",
"label": "storage_hdd[2]['used']",
"x": 691,
"y": 45,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": "",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "progress2.png",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 2,
"name": "硬盘4",
"label": "storage_hdd[3]['temperature']",
"x": 870,
"y": 130,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " ℃",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 3,
"type": 2,
"name": "硬盘4-进度条",
"label": "storage_hdd[3]['used']",
"x": 691,
"y": 106,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": "",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "progress2.png",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 2,
"name": "硬盘5",
"label": "storage_hdd[4]['temperature']",
"x": 870,
"y": 246,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " ℃",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 3,
"type": 2,
"name": "硬盘5-进度条",
"label": "storage_hdd[4]['used']",
"x": 691,
"y": 221,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": "",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "progress2.png",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 1,
"type": 2,
"name": "硬盘6",
"label": "storage_hdd[5]['temperature']",
"x": 870,
"y": 307,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": " ℃",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "",
"xz_x": 0,
"xz_y": 0
},
{
"mode": 3,
"type": 2,
"name": "硬盘6-进度条",
"label": "storage_hdd[5]['used']",
"x": 691,
"y": 282,
"width": 0,
"height": 0,
"textDirection": 0,
"direction": 1,
"value": "7",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"fontWeight": "normal",
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
"unit": "",
"minAngle": 0,
"maxAngle": 180,
"minValue": 0,
"maxValue": 100,
"pic": "progress2.png",
"xz_x": 0,
"xz_y": 0
}
]
}
]
}
+34
View File
@@ -0,0 +1,34 @@
cpu_temperature: 65
cpu_percent: 98
memory_usage: 77
memory_Temperature: 48
net_ip_address: 146.56.182.244
gpu_core: 98
gpu_temperature: 78
net_upload_speed: 100
net_upload_speed#unit: K/S
net_download_speed: 120
net_download_speed#unit: M/S
motherboard_temperature: 38
storage_ssd[0]['temperature']: 31
storage_ssd[0]['used']: 17
storage_ssd[1]['temperature']: 32
storage_ssd[1]['used']: 18
storage_ssd[2]['temperature']: 33
storage_ssd[2]['used']: 19
storage_ssd[3]['temperature']: 34
storage_ssd[3]['used']: 20
storage_ssd[4]['temperature']: 35
storage_ssd[4]['used']: 21
storage_hdd[0]['temperature']: 36
storage_hdd[0]['used']: 22
storage_hdd[1]['temperature']: 37
storage_hdd[1]['used']: 23
storage_hdd[2]['temperature']: 38
storage_hdd[2]['used']: 24
storage_hdd[3]['temperature']: 39
storage_hdd[3]['used']: 25
storage_hdd[4]['temperature']: 40
storage_hdd[4]['used']: 26
storage_hdd[5]['temperature']: 41
storage_hdd[5]['used']: 27