binary_sensor.py 701 B

123456789101112131415161718192021
  1. """
  2. Setup for different kinds of Tuya Binary sensors
  3. """
  4. from .generic.binary_sensor import TuyaLocalBinarySensor
  5. from .helpers.config import async_tuya_setup_platform
  6. async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
  7. """Set up the sensor device according to it's type."""
  8. await async_tuya_setup_platform(
  9. hass,
  10. async_add_entities,
  11. discovery_info,
  12. "binary_sensor",
  13. TuyaLocalBinarySensor,
  14. )
  15. async def async_setup_entry(hass, config_entry, async_add_entities):
  16. config = {**config_entry.data, **config_entry.options}
  17. await async_setup_platform(hass, {}, async_add_entities, config)