1 """Support for Taps Affs."""
3 from __future__
import annotations
5 from datetime
import timedelta
8 from tapsaff
import TapsAff
9 import voluptuous
as vol
12 PLATFORM_SCHEMA
as BINARY_SENSOR_PLATFORM_SCHEMA,
21 _LOGGER = logging.getLogger(__name__)
23 DEFAULT_NAME =
"Taps Aff"
27 PLATFORM_SCHEMA = BINARY_SENSOR_PLATFORM_SCHEMA.extend(
29 vol.Required(CONF_LOCATION): cv.string,
30 vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
38 add_entities: AddEntitiesCallback,
39 discovery_info: DiscoveryInfoType |
None =
None,
41 """Set up the Taps Aff binary sensor."""
42 name = config.get(CONF_NAME)
43 location = config.get(CONF_LOCATION)
51 """Implementation of a Taps Aff binary sensor."""
54 """Initialize the Taps Aff sensor."""
55 self.
datadata = taps_aff_data
60 """Return the name of the sensor."""
61 return f
"{self._name}"
65 """Return true if taps aff."""
66 return self.
datadata.is_taps_aff
69 """Get the latest data."""
74 """Class for handling the data retrieval for pins."""
77 """Initialize the data object."""
84 """Return true if taps aff."""
88 """Get the latest data from the Taps Aff API and updates the states."""
92 _LOGGER.error(
"Update failed. Check configured location")
def __init__(self, location)
def __init__(self, taps_aff_data, name)
None add_entities(AsusWrtRouter router, AddEntitiesCallback async_add_entities, set[str] tracked)
None setup_platform(HomeAssistant hass, ConfigType config, AddEntitiesCallback add_entities, DiscoveryInfoType|None discovery_info=None)