Skip to content

Commit 6e8860b

Browse files
author
Ted Roberts
committed
Remove fan_status entity (v0.2.10)
1 parent 9cfcc6e commit 6e8860b

5 files changed

Lines changed: 2 additions & 99 deletions

File tree

custom_components/novastar_h/api.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ class NovastarState:
5959
temp_status: int | None = None # Temperature status (0=normal, 1=warning, etc.)
6060
device_status: int | None = None # Device status (0=busy, 1=ready)
6161
signal_status: int | None = None # Signal power status from iSignal
62-
fan_status: list[int] = field(default_factory=list) # Fan status list from fanList
6362
ftb_active: bool = False # Fade to black (blackout) active
6463
freeze_active: bool = False # Screen freeze active
6564
current_preset_id: int = -1 # -1 means no preset active
@@ -412,7 +411,6 @@ async def async_get_state(
412411
state.temp_status = temp_data.get("temp_status")
413412
state.device_status = temp_data.get("device_status")
414413
state.signal_status = temp_data.get("signal_status")
415-
state.fan_status = temp_data.get("fan_status") or []
416414

417415
return state
418416

@@ -426,15 +424,13 @@ async def async_get_device_status_info(
426424
- temp_status: Temperature status code
427425
- device_status: Device status (0=busy, 1=ready)
428426
- signal_status: Signal power status from iSignal
429-
- fan_status: List of fan status values from fanList
430427
"""
431428
data = await self._async_request("device/readDetail", {"deviceId": device_id})
432429
result: dict[str, Any] = {
433430
"temperature": None,
434431
"temp_status": None,
435432
"device_status": None,
436433
"signal_status": None,
437-
"fan_status": [],
438434
}
439435
if data and isinstance(data, dict):
440436
temp = data.get("backboardTemperature")
@@ -449,18 +445,9 @@ async def async_get_device_status_info(
449445
signal_status = data.get("iSignal")
450446
if signal_status is not None and isinstance(signal_status, (int, float)):
451447
result["signal_status"] = int(signal_status)
452-
fan_list = data.get("fanList")
453-
if fan_list is not None and isinstance(fan_list, list):
454-
result["fan_status"] = [int(f) for f in fan_list if isinstance(f, (int, float))]
455448
return result
456449

457-
async def async_get_temperature_info(
458-
self, device_id: int = 0
459-
) -> dict[str, Any]:
460-
"""Get device temperature info (deprecated, use async_get_device_status_info)."""
461-
return await self.async_get_device_status_info(device_id)
462-
463450
async def async_get_temperature(self, device_id: int = 0) -> float | None:
464451
"""Get device backboard temperature in Celsius."""
465-
info = await self.async_get_temperature_info(device_id)
452+
info = await self.async_get_device_status_info(device_id)
466453
return info.get("temperature")

custom_components/novastar_h/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@
2121
}
2222
],
2323
"zeroconf": ["_novastar._tcp.local."],
24-
"version": "0.2.9"
24+
"version": "0.2.10"
2525
}

custom_components/novastar_h/sensor.py

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
from typing import Any
4-
53
from homeassistant.components.sensor import (
64
SensorDeviceClass,
75
SensorEntity,
@@ -32,7 +30,6 @@ async def async_setup_entry(
3230
NovastarTempStatusSensor(entry, coordinator, device_info),
3331
NovastarDeviceStatusSensor(entry, coordinator, device_info),
3432
NovastarSignalStatusSensor(entry, coordinator, device_info),
35-
NovastarFanStatusSensor(entry, coordinator, device_info),
3633
])
3734

3835

@@ -255,78 +252,3 @@ def native_value(self) -> str | None:
255252
return None
256253

257254

258-
class NovastarFanStatusSensor(CoordinatorEntity[NovastarCoordinator], SensorEntity):
259-
"""Sensor entity for fan status."""
260-
261-
_attr_has_entity_name = True
262-
_attr_name = "Fan Status"
263-
_attr_translation_key = "fan_status"
264-
265-
# Map status codes to human-readable values
266-
FAN_STATUS_MAP = {
267-
0: "Off",
268-
1: "Running",
269-
2: "Error",
270-
}
271-
272-
def __init__(
273-
self,
274-
entry: ConfigEntry,
275-
coordinator: NovastarCoordinator,
276-
device_info: NovastarDeviceInfo,
277-
) -> None:
278-
"""Initialize the sensor entity."""
279-
super().__init__(coordinator)
280-
self._entry = entry
281-
self._device_info = device_info
282-
self._attr_unique_id = f"{entry.entry_id}_fan_status"
283-
284-
@property
285-
def device_info(self):
286-
"""Return device info."""
287-
model = "H Series"
288-
if self._device_info.model_id:
289-
model = f"H Series (Model {self._device_info.model_id})"
290-
return {
291-
"identifiers": {(DOMAIN, self._entry.entry_id)},
292-
"manufacturer": "Novastar",
293-
"model": model,
294-
"name": self._entry.data.get(CONF_NAME, DEFAULT_NAME),
295-
"sw_version": self._device_info.firmware,
296-
"serial_number": self._device_info.serial,
297-
}
298-
299-
@property
300-
def available(self) -> bool:
301-
"""Return True if entity is available."""
302-
return self.coordinator.last_update_success
303-
304-
@property
305-
def native_value(self) -> str | None:
306-
"""Return current fan status summary."""
307-
if self.coordinator.data and self.coordinator.data.fan_status:
308-
fan_list = self.coordinator.data.fan_status
309-
# Count fans by status
310-
running = sum(1 for f in fan_list if f == 1)
311-
errors = sum(1 for f in fan_list if f == 2)
312-
total = len(fan_list)
313-
314-
if errors > 0:
315-
return f"{errors}/{total} Error"
316-
if running == total:
317-
return "All Running"
318-
if running == 0:
319-
return "All Off"
320-
return f"{running}/{total} Running"
321-
return None
322-
323-
@property
324-
def extra_state_attributes(self) -> dict[str, Any] | None:
325-
"""Return detailed fan status as attributes."""
326-
if self.coordinator.data and self.coordinator.data.fan_status:
327-
fan_list = self.coordinator.data.fan_status
328-
attrs = {}
329-
for i, status in enumerate(fan_list):
330-
attrs[f"fan_{i + 1}"] = self.FAN_STATUS_MAP.get(status, f"Unknown ({status})")
331-
return attrs
332-
return None

custom_components/novastar_h/strings.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@
116116
},
117117
"signal_status": {
118118
"name": "Signal Power Status"
119-
},
120-
"fan_status": {
121-
"name": "Fan Status"
122119
}
123120
}
124121
}

custom_components/novastar_h/translations/en.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,6 @@
116116
},
117117
"signal_status": {
118118
"name": "Signal Power Status"
119-
},
120-
"fan_status": {
121-
"name": "Fan Status"
122119
}
123120
}
124121
}

0 commit comments

Comments
 (0)