1 """Representation of a fan."""
3 from __future__
import annotations
13 from .const
import DOMAIN, ZWaveMePlatform
14 from .entity
import ZWaveMeEntity
16 DEVICE_NAME = ZWaveMePlatform.FAN
21 config_entry: ConfigEntry,
22 async_add_entities: AddEntitiesCallback,
24 """Set up the fan platform."""
28 controller = hass.data[DOMAIN][config_entry.entry_id]
37 config_entry.async_on_unload(
39 hass, f
"ZWAVE_ME_NEW_{DEVICE_NAME.upper()}", add_new_device
45 """Representation of a ZWaveMe Fan."""
47 _attr_supported_features = (
48 FanEntityFeature.SET_SPEED
49 | FanEntityFeature.TURN_OFF
50 | FanEntityFeature.TURN_ON
52 _enable_turn_on_off_backwards_compatibility =
False
56 """Return the current speed as a percentage."""
57 if self.
devicedevice.level == 99:
59 return self.
devicedevice.level
62 """Set the speed percentage of the fan."""
63 self.
controllercontroller.zwave_api.send_command(
64 self.
devicedevice.id, f
"exact?level={min(percentage, 99)}"
68 """Turn the fan off."""
69 self.
controllercontroller.zwave_api.send_command(self.
devicedevice.id,
"exact?level=0")
73 percentage: int |
None =
None,
74 preset_mode: str |
None =
None,
77 """Turn on the fan."""
None set_percentage(self, int percentage)
None set_percentage(self, int percentage)
None turn_on(self, int|None percentage=None, str|None preset_mode=None, **Any kwargs)
None turn_off(self, **Any kwargs)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
def add_new_device(new_device)
Callable[[], None] async_dispatcher_connect(HomeAssistant hass, str signal, Callable[..., Any] target)