Skip to content

Commit c1d208a

Browse files
committed
add uptime
1 parent 213b14e commit c1d208a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

custom_components/nemon_intex_swg/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"codeowners": ["@NemoN"],
55
"dependencies": [],
66
"documentation": "https://github.com/NemoN/ha-intex-swg",
7-
"version": "1.0.6",
7+
"version": "1.0.7",
88
"integration_type": "device",
99
"iot_class": "local_polling",
1010
"requirements": ["aiohttp>=3.8.0"],

custom_components/nemon_intex_swg/sensor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
SENSOR_TYPES = [
1313
(("display", "brightness"), "Display Brightness"),
1414
(("display", "current_code"), "Display Code"),
15+
(("system", "uptime_seconds"), "Uptime (seconds)"),
1516
]
1617

1718
BOOL_SENSOR_TYPES = [
@@ -56,6 +57,9 @@ def __init__(self, client, coordinator, path, name):
5657
# unique_id: e.g. "nemon_intex_swg-XYZ_display_brightness"
5758
self._attr_unique_id = f"{coordinator.name}_{'_'.join(path)}"
5859

60+
if self._path == ("system", "uptime_seconds"):
61+
self._attr_unit_of_measurement = "s"
62+
5963
@property
6064
def state(self):
6165
data = self._client.data
@@ -110,7 +114,7 @@ def state(self):
110114
@property
111115
def available(self) -> bool:
112116
p = self.coordinator.data.get("power") if self.coordinator.data else None
113-
117+
114118
return isinstance(p, (int, float))
115119

116120
@callback

0 commit comments

Comments
 (0)