1 """Support for WeMo binary sensors."""
3 from pywemo
import Insight, Maker, StandbyState
10 from .
import async_wemo_dispatcher_connect
11 from .coordinator
import DeviceCoordinator
12 from .entity
import WemoBinaryStateEntity, WemoEntity
17 _config_entry: ConfigEntry,
18 async_add_entities: AddEntitiesCallback,
20 """Set up WeMo binary sensors."""
22 async
def _discovered_wemo(coordinator: DeviceCoordinator) ->
None:
23 """Handle a discovered Wemo device."""
24 if isinstance(coordinator.wemo, Insight):
26 elif isinstance(coordinator.wemo, Maker):
35 """Representation a WeMo binary sensor."""
39 """Maker device's sensor port."""
41 _name_suffix =
"Sensor"
46 """Return true if the Maker's sensor is pulled low."""
47 return self.
wemowemowemo.has_sensor != 0
and self.
wemowemowemo.sensor_state == 0
51 """Sensor representing the device connected to the Insight Switch."""
53 _name_suffix =
"Device"
58 """Return true device connected to the Insight Switch is on."""
59 return super().is_on
and self.
wemowemowemo.standby_state == StandbyState.ON
None async_setup_entry(HomeAssistant hass, ConfigEntry _config_entry, AddEntitiesCallback async_add_entities)
None async_wemo_dispatcher_connect(HomeAssistant hass, DispatchCallback dispatch)