refactor: sensor configuration fields

Automatically round decimal values for sensor.x and .y to an integer.
Make fields optional which are not used in every sensor.
This commit is contained in:
Markus Zehnder
2025-08-24 21:18:56 +02:00
parent 98941a00fe
commit 84455e9254
6 changed files with 50 additions and 62 deletions
-2
View File
@@ -53,7 +53,6 @@ The background image and sensor definitions are taken from the default system pa
"sensor": [
{
"mode": 1,
"type": 1,
"name": "CPU temp",
"label": "cpu_temperature",
"x": 195,
@@ -67,7 +66,6 @@ The background image and sensor definitions are taken from the default system pa
},
{
"mode": 1,
"type": 1,
"name": "CPU usage",
"label": "cpu_percent",
"unit": "%",
-5
View File
@@ -31,7 +31,6 @@ Example `panel.json` with a single "fan" indicator sensor and the following (par
"id": "29d9ef2d-30b4-459d-b2b0-43cb6d4d6b41",
"itemName": "CPU usage",
"mode": 2,
"type": 1,
"direction": 1,
"label": "cpu_percent",
"value": "47.7",
@@ -39,10 +38,6 @@ Example `panel.json` with a single "fan" indicator sensor and the following (par
"y": 184,
"width": 237,
"height": 237,
"fontColor": "#ffffff",
"fontSize": 14,
"fontFamily": "default_font",
"textAlign": "left",
"minAngle": -160,
"maxAngle": 30,
"minValue": 0,
-14
View File
@@ -25,41 +25,30 @@ The background image and sensor definitions are taken from the default system pa
"sensor": [
{
"mode": 3,
"type": 2,
"name": "SSD 4 usage",
"label": "storage_ssd4_usage",
"x": 400,
"y": 45,
"direction": 1,
"value": "35",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"textAlign": "center",
"minValue": 0,
"maxValue": 100,
"pic": "progress.png"
},
{
"mode": 3,
"type": 2,
"name": "SSD 5 usage",
"label": "storage_ssd5_usage",
"x": 400,
"y": 106,
"direction": 1,
"value": "80",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"textAlign": "center",
"minValue": 0,
"maxValue": 100,
"pic": "progress.png"
},
{
"mode": 1,
"type": 2,
"name": "SSD 4 temp",
"label": "storage_ssd4_temperature",
"x": 580,
@@ -68,7 +57,6 @@ The background image and sensor definitions are taken from the default system pa
"value": "34",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
@@ -76,7 +64,6 @@ The background image and sensor definitions are taken from the default system pa
},
{
"mode": 1,
"type": 2,
"name": "SSD 5 temp",
"label": "storage_ssd5_temperature",
"x": 580,
@@ -85,7 +72,6 @@ The background image and sensor definitions are taken from the default system pa
"value": "35",
"fontFamily": "HarmonyOS_Sans_SC_Bold",
"fontSize": 24,
"fontColor": -1,
"textAlign": "center",
"integerDigits": -1,
"decimalDigits": 0,
-6
View File
@@ -31,7 +31,6 @@ Example `panel.json` with a single "pointer" indicator sensor and the following
"id": "a9d4acac-2af9-4fe0-9f69-86cd09f25696",
"itemName": "CPU dial",
"mode": 4,
"type": 1,
"direction": 1,
"label": "cpu_percent",
"value": "47.7",
@@ -39,11 +38,6 @@ Example `panel.json` with a single "pointer" indicator sensor and the following
"y": 208,
"width": 302,
"height": 302,
"fontColor": "#ffffff",
"fontSize": 14,
"fontFamily": "",
"fontWeight": "normal",
"textAlign": "left",
"minAngle": -110,
"maxAngle": 110,
"minValue": 0,