1 """Support for TCP socket based sensors."""
3 from __future__
import annotations
5 from typing
import Final
8 PLATFORM_SCHEMA
as SENSOR_PLATFORM_SCHEMA,
16 from .common
import TCP_PLATFORM_SCHEMA
17 from .entity
import TcpEntity
19 PLATFORM_SCHEMA: Final = SENSOR_PLATFORM_SCHEMA.extend(TCP_PLATFORM_SCHEMA)
25 add_entities: AddEntitiesCallback,
26 discovery_info: DiscoveryInfoType |
None =
None,
28 """Set up the TCP Sensor."""
33 """Implementation of a TCP socket based sensor."""
37 """Return the state of the device."""
42 """Return the unit of measurement of this entity."""
43 return self._config[CONF_UNIT_OF_MEASUREMENT]
str|None native_unit_of_measurement(self)
StateType native_value(self)
def add_entities(account, async_add_entities, tracked)
None setup_platform(HomeAssistant hass, ConfigType config, AddEntitiesCallback add_entities, DiscoveryInfoType|None discovery_info=None)