1 """Support for Minut Point sensors."""
3 from __future__
import annotations
8 DOMAIN
as SENSOR_DOMAIN,
11 SensorEntityDescription,
20 from .const
import DOMAIN
as POINT_DOMAIN, POINT_DISCOVERY_NEW
21 from .entity
import MinutPointEntity
23 _LOGGER = logging.getLogger(__name__)
26 SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
29 suggested_display_precision=1,
30 device_class=SensorDeviceClass.TEMPERATURE,
31 native_unit_of_measurement=UnitOfTemperature.CELSIUS,
35 suggested_display_precision=1,
36 device_class=SensorDeviceClass.HUMIDITY,
37 native_unit_of_measurement=PERCENTAGE,
41 suggested_display_precision=1,
42 device_class=SensorDeviceClass.SOUND_PRESSURE,
43 native_unit_of_measurement=UnitOfSoundPressure.WEIGHTED_DECIBEL_A,
50 config_entry: ConfigEntry,
51 async_add_entities: AddEntitiesCallback,
53 """Set up a Point's sensors based on a config entry."""
56 """Discover and add a discovered sensor."""
57 client = config_entry.runtime_data.client
61 for description
in SENSOR_TYPES
68 POINT_DISCOVERY_NEW.format(SENSOR_DOMAIN, POINT_DOMAIN),
69 async_discover_sensor,
74 """The platform class required by Home Assistant."""
77 self, point_client, device_id, description: SensorEntityDescription
79 """Initialize the sensor."""
80 super().
__init__(point_client, device_id, description.device_class)
84 """Update the value of the sensor."""
85 _LOGGER.debug(
"Update sensor value for %s", self)
None __init__(self, point_client, device_id, SensorEntityDescription description)
def _update_callback(self)
SensorDeviceClass|None device_class(self)
str|None device_class(self)
None async_write_ha_state(self)
datetime|None parse_datetime(str|None value)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
def async_discover_sensor(device_id)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)