|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | | -from typing import Any |
4 | | - |
5 | 3 | from homeassistant.components.sensor import ( |
6 | 4 | SensorDeviceClass, |
7 | 5 | SensorEntity, |
@@ -32,7 +30,6 @@ async def async_setup_entry( |
32 | 30 | NovastarTempStatusSensor(entry, coordinator, device_info), |
33 | 31 | NovastarDeviceStatusSensor(entry, coordinator, device_info), |
34 | 32 | NovastarSignalStatusSensor(entry, coordinator, device_info), |
35 | | - NovastarFanStatusSensor(entry, coordinator, device_info), |
36 | 33 | ]) |
37 | 34 |
|
38 | 35 |
|
@@ -255,78 +252,3 @@ def native_value(self) -> str | None: |
255 | 252 | return None |
256 | 253 |
|
257 | 254 |
|
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 |
0 commit comments