mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Fix ecowitt typing (#78171)
This commit is contained in:
parent
68b511737d
commit
b2692ecc80
@ -68,4 +68,4 @@ class EcowittBinarySensorEntity(EcowittEntity, BinarySensorEntity):
|
|||||||
@property
|
@property
|
||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool:
|
||||||
"""Return true if the binary sensor is on."""
|
"""Return true if the binary sensor is on."""
|
||||||
return self.ecowitt.value > 0
|
return bool(self.ecowitt.value)
|
||||||
|
@ -25,13 +25,13 @@ async def async_get_device_diagnostics(
|
|||||||
"device": {
|
"device": {
|
||||||
"name": station.station,
|
"name": station.station,
|
||||||
"model": station.model,
|
"model": station.model,
|
||||||
"frequency": station.frequency,
|
"frequency": station.frequence,
|
||||||
"version": station.version,
|
"version": station.version,
|
||||||
},
|
},
|
||||||
"raw": ecowitt.last_values[station_id],
|
"raw": ecowitt.last_values[station_id],
|
||||||
"sensors": {
|
"sensors": {
|
||||||
sensor.key: sensor.value
|
sensor.key: sensor.value
|
||||||
for sensor in station.sensors
|
for sensor in ecowitt.sensors.values()
|
||||||
if sensor.station.key == station_id
|
if sensor.station.key == station_id
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
"""Support for Ecowitt Weather Stations."""
|
"""Support for Ecowitt Weather Stations."""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
import dataclasses
|
import dataclasses
|
||||||
|
from datetime import datetime
|
||||||
from typing import Final
|
from typing import Final
|
||||||
|
|
||||||
from aioecowitt import EcoWittListener, EcoWittSensor, EcoWittSensorTypes
|
from aioecowitt import EcoWittListener, EcoWittSensor, EcoWittSensorTypes
|
||||||
@ -242,6 +245,6 @@ class EcowittSensorEntity(EcowittEntity, SensorEntity):
|
|||||||
self.entity_description = description
|
self.entity_description = description
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def native_value(self) -> StateType:
|
def native_value(self) -> StateType | datetime:
|
||||||
"""Return the state of the sensor."""
|
"""Return the state of the sensor."""
|
||||||
return self.ecowitt.value
|
return self.ecowitt.value
|
||||||
|
Loading…
x
Reference in New Issue
Block a user