@@ -53,7 +53,12 @@ async def async_setup_entry(hass: HomeAssistant, config_entry, async_add_entitie
5353 wiser_selects .extend (
5454 [WiserLightPowerOnBehaviourSelect (data , light .id )]
5555 )
56-
56+ """ """
57+ if light .is_output_mode_supported :
58+ wiser_selects .extend (
59+ [WiserLightOutputModeSelect (data , light .id )]
60+ )
61+
5762
5863 # Add Shutters
5964 if data .wiserhub .devices .shutters .count > 0 :
@@ -372,6 +377,52 @@ async def async_select_option(self, option: str) -> None:
372377 )
373378
374379
380+ class WiserLightOutputModeSelect (WiserSelectEntity ):
381+ def __init__ (self , data , light_id ) -> None :
382+ """Initialize the sensor."""
383+ self ._device_id = light_id
384+ super ().__init__ (data )
385+ self ._device = self ._data .wiserhub .devices .lights .get_by_id (self ._device_id )
386+ self ._options = self ._device .available_output_mode
387+
388+ @callback
389+ def _handle_coordinator_update (self ) -> None :
390+ """Fetch new state data for the sensor."""
391+ super ()._handle_coordinator_update ()
392+ self ._device = self ._data .wiserhub .devices .lights .get_by_id (self ._device_id )
393+ self ._options = self ._device .available_output_mode
394+ self .async_write_ha_state ()
395+
396+ @property
397+ def unique_id (self ):
398+ """Return unique ID of device."""
399+ return get_unique_id (
400+ self ._data ,
401+ self ._device .product_type ,
402+ "ouput_mode" ,
403+ self ._device_id ,
404+ )
405+
406+ @property
407+ def name (self ):
408+ """Return Name of device."""
409+ return f"{ get_device_name (self ._data , self ._device_id )} Output Mode"
410+
411+ @property
412+ def current_option (self ) -> str :
413+ return self ._device .output_mode
414+
415+ @hub_error_handler
416+ async def async_select_option (self , option : str ) -> None :
417+ _LOGGER .debug (f"Setting { self .name } to { option } " )
418+ if option in self ._options :
419+ await self ._device .set_output_mode (option )
420+ await self .async_force_update ()
421+ else :
422+ _LOGGER .error (
423+ f"{ option } is not a valid { self .name } . Please choose from { self ._options } "
424+ )
425+
375426class WiserSmartplugLedIndicatorSelect (WiserSelectEntity ):
376427 def __init__ (self , data , smartplug_id ) -> None :
377428 """Initialize the sensor."""
0 commit comments