1 """Switch Platform for Chacon Dio REV-LIGHT and switch plug devices."""
6 from dio_chacon_wifi_api.const
import DeviceTypeEnum
12 from .
import ChaconDioConfigEntry
13 from .entity
import ChaconDioEntity
15 _LOGGER = logging.getLogger(__name__)
20 config_entry: ChaconDioConfigEntry,
21 async_add_entities: AddEntitiesCallback,
23 """Set up Chacon Dio switch devices."""
24 data = config_entry.runtime_data
29 for device
in data.list_devices
31 in (DeviceTypeEnum.SWITCH_LIGHT.value, DeviceTypeEnum.SWITCH_PLUG.value)
36 """Object for controlling a Chacon Dio switch."""
38 _attr_device_class = SwitchDeviceClass.SWITCH
42 """Recomputes the attributes values either at init or when the device state changes."""
47 """Turn on the switch.
49 Turned on status is effective after the server callback that triggers callback_device_state.
53 "Turn on the switch %s , %s, %s",
59 await self.
clientclient.switch_switch(self.target_id,
True)
62 """Turn off the switch.
64 Turned on status is effective after the server callback that triggers callback_device_state.
68 "Turn off the switch %s , %s, %s",
74 await self.
clientclient.switch_switch(self.target_id,
False)
None async_turn_on(self, **Any kwargs)
None async_turn_off(self, **Any kwargs)
None _update_attr(self, dict[str, Any] data)
None async_setup_entry(HomeAssistant hass, ChaconDioConfigEntry config_entry, AddEntitiesCallback async_add_entities)