Skip to content

VeSync Fans (NOT Purifiers or Humidifiers)

pyvesync.base_devices.fan_base.FanState

Bases: DeviceState

Base state class for Fans.

Not all attributes are supported by all devices.

Attributes:

Name Type Description
display_set_status str

Display set status.

display_status str

Display status.

displaying_type str

Displaying type.

fan_level int

Fan level.

fan_set_level int

Fan set level.

humidity int

Humidity level.

mode str

Mode of device.

mute_set_status str

Mute set status.

mute_status str

Mute status.

oscillation_set_status str

Oscillation set status.

oscillation_status str

Oscillation status.

sleep_change_fan_level str

Sleep change fan level.

sleep_fallasleep_remain str

Sleep fall asleep remain.

sleep_oscillation_switch str

Sleep oscillation switch.

sleep_preference_type str

Sleep preference type.

temperature int

Temperature.

thermal_comfort int

Thermal comfort.

timer Timer

Timer object.

Source code in src/pyvesync/base_devices/fan_base.py
class FanState(DeviceState):
    """Base state class for Fans.

    Not all attributes are supported by all devices.


    Attributes:
        display_set_status (str): Display set status.
        display_status (str): Display status.
        displaying_type (str): Displaying type.
        fan_level (int): Fan level.
        fan_set_level (int): Fan set level.
        humidity (int): Humidity level.
        mode (str): Mode of device.
        mute_set_status (str): Mute set status.
        mute_status (str): Mute status.
        oscillation_set_status (str): Oscillation set status.
        oscillation_status (str): Oscillation status.
        sleep_change_fan_level (str): Sleep change fan level.
        sleep_fallasleep_remain (str): Sleep fall asleep remain.
        sleep_oscillation_switch (str): Sleep oscillation switch.
        sleep_preference_type (str): Sleep preference type.
        temperature (int): Temperature.
        thermal_comfort (int): Thermal comfort.
        timer (Timer): Timer object.
    """

    __slots__ = (
        '_oscillation_status',
        'child_lock',
        'display_set_status',
        'display_status',
        'displaying_type',
        'fan_level',
        'fan_set_level',
        'horizontal_oscillation_status',
        'humidity',
        'mode',
        'mute_set_status',
        'mute_status',
        'oscillation_coordinates',
        'oscillation_range',
        'oscillation_set_status',
        'sleep_change_fan_level',
        'sleep_fallasleep_remain',
        'sleep_oscillation_switch',
        'sleep_preference_type',
        'temperature',
        'thermal_comfort',
        'vertical_oscillation_status',
    )

    def __init__(
        self,
        device: VeSyncFanBase,
        details: ResponseDeviceDetailsModel,
        feature_map: FanMap,
    ) -> None:
        """Initialize Fan State.

        Args:
            device (VeSyncFanBase): Device object.
            details (ResponseDeviceDetailsModel): Device details.
            feature_map (FanMap): Feature map.
        """
        super().__init__(device, details, feature_map)
        self.mode: str = FanModes.UNKNOWN
        self.fan_level: int | None = None
        self.fan_set_level: int | None = None
        self.child_lock: str | None = None
        self.humidity: float | None = None
        self.temperature: float | None = None
        self.thermal_comfort: int | None = None
        self.sleep_preference_type: str | None = None
        self.sleep_fallasleep_remain: str | None = None
        self.sleep_oscillation_switch: str | None = None
        self.sleep_change_fan_level: str | None = None
        self.mute_status: str | None = None
        self.mute_set_status: str | None = None
        self.horizontal_oscillation_status: str | None = None
        self.vertical_oscillation_status: str | None = None
        self._oscillation_status: str | None = None
        self.oscillation_set_status: str | None = None
        self.display_status: str | None = None
        self.display_set_status: str | None = None
        self.displaying_type: str | None = None
        self.oscillation_coordinates: OscillationCoordinates | None = None
        if FanFeatures.SET_OSCILLATION_RANGE in feature_map.features:
            self.oscillation_range: OscillationRange | None = OscillationRange(
                left=0, right=0, top=0, bottom=0
            )
        else:
            self.oscillation_range = None

    @property
    def oscillation_status(self) -> str | None:
        """Get oscillation status.

        Returns:
            str | None: Oscillation status.
        """
        if self.horizontal_oscillation_status and self.vertical_oscillation_status:
            return self.horizontal_oscillation_status or self.vertical_oscillation_status
        return self._oscillation_status

    @oscillation_status.setter
    def oscillation_status(self, value: str | None) -> None:
        self._oscillation_status = value

Attributes

active_time instance-attribute

active_time: int | None = None

Inherited From DeviceState

child_lock instance-attribute

child_lock: str | None = None

connection_status instance-attribute

connection_status: str = connectionStatus or UNKNOWN

Inherited From DeviceState

device instance-attribute

device = device

Inherited From DeviceState

device_status instance-attribute

device_status: str = deviceStatus or UNKNOWN

Inherited From DeviceState

display_set_status instance-attribute

display_set_status: str | None = None

display_status instance-attribute

display_status: str | None = None

displaying_type instance-attribute

displaying_type: str | None = None

fan_level instance-attribute

fan_level: int | None = None

fan_set_level instance-attribute

fan_set_level: int | None = None

features instance-attribute

features = features

Inherited From DeviceState

horizontal_oscillation_status instance-attribute

horizontal_oscillation_status: str | None = None

humidity instance-attribute

humidity: float | None = None

last_update_ts instance-attribute

last_update_ts: int | None = None

Inherited From DeviceState

mode instance-attribute

mode: str = UNKNOWN

mute_set_status instance-attribute

mute_set_status: str | None = None

mute_status instance-attribute

mute_status: str | None = None

oscillation_coordinates instance-attribute

oscillation_coordinates: OscillationCoordinates | None = (
    None
)

oscillation_range instance-attribute

oscillation_range: OscillationRange | None = (
    OscillationRange(left=0, right=0, top=0, bottom=0)
)

oscillation_set_status instance-attribute

oscillation_set_status: str | None = None

oscillation_status property writable

oscillation_status: str | None

Get oscillation status.

Returns:

Type Description
str | None

str | None: Oscillation status.

sleep_change_fan_level instance-attribute

sleep_change_fan_level: str | None = None

sleep_fallasleep_remain instance-attribute

sleep_fallasleep_remain: str | None = None

sleep_oscillation_switch instance-attribute

sleep_oscillation_switch: str | None = None

sleep_preference_type instance-attribute

sleep_preference_type: str | None = None

temperature instance-attribute

temperature: float | None = None

thermal_comfort instance-attribute

thermal_comfort: int | None = None

timer instance-attribute

timer: Timer | None = None

Inherited From DeviceState

vertical_oscillation_status instance-attribute

vertical_oscillation_status: str | None = None

Functions

as_tuple

as_tuple() -> tuple[tuple[str, Any], ...]

Inherited From DeviceState

Convert state to tuple of (name, value) tuples.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
def as_tuple(self) -> tuple[tuple[str, Any], ...]:
    """Convert state to tuple of (name, value) tuples."""
    return tuple((k, v) for k, v in self._serialize().items())

display

display() -> None

Inherited From DeviceState

Print formatted state to stdout.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
def display(self) -> None:
    """Print formatted state to stdout."""
    for name, val in self._serialize().items():
        print(f'{name:.<30} {val}')  # noqa: T201

to_dict

to_dict() -> dict[str, Any]

Inherited From DeviceState

Convert state to dictionary.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
def to_dict(self) -> dict[str, Any]:
    """Convert state to dictionary."""
    return self._serialize()

to_json

to_json(indent: bool = False) -> str

Inherited From DeviceState

Dump state to JSON string.

Parameters:

Name Type Description Default
indent bool

If True, indent JSON output, defaults to False.

False

Returns:

Name Type Description
str str

JSON formatted string of device state.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
def to_json(self, indent: bool = False) -> str:
    """Dump state to JSON string.

    Args:
        indent (bool): If True, indent JSON output, defaults to False.

    Returns:
        str: JSON formatted string of device state.
    """
    return self.to_jsonb(indent=indent).decode()

to_jsonb

to_jsonb(indent: bool = False) -> bytes

Inherited From DeviceState

Convert state to JSON bytes.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
def to_jsonb(self, indent: bool = False) -> bytes:
    """Convert state to JSON bytes."""
    if indent:
        return orjson.dumps(
            self._serialize(), option=orjson.OPT_NON_STR_KEYS | orjson.OPT_INDENT_2
        )
    return orjson.dumps(self._serialize(), option=orjson.OPT_NON_STR_KEYS)

update_ts

update_ts() -> None

Inherited From DeviceState

Update last update timestamp as UTC timestamp.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
def update_ts(self) -> None:
    """Update last update timestamp as UTC timestamp."""
    self.last_update_ts = int(dt.now(tz=UTC).timestamp())

pyvesync.devices.vesyncfan.VeSyncTowerFan

VeSyncTowerFan(
    details: ResponseDeviceDetailsModel,
    manager: VeSync,
    feature_map: FanMap,
)

Bases: BypassV2Mixin, VeSyncFanBase

Levoit Tower Fan Device Class.

Inherited From VeSyncFanBase

Initialize the VeSync Base API V2 Fan Class.

Attributes

cid instance-attribute

cid: str = cid

Inherited From VeSyncBaseDevice

config_module instance-attribute

config_module: str = configModule

Inherited From VeSyncBaseDevice

connection_type instance-attribute

connection_type: str | None = connectionType

Inherited From VeSyncBaseDevice

current_firm_version instance-attribute

current_firm_version = currentFirmVersion

Inherited From VeSyncBaseDevice

device_image instance-attribute

device_image: str | None = deviceImg

Inherited From VeSyncBaseDevice

device_name instance-attribute

device_name: str = deviceName

Inherited From VeSyncBaseDevice

device_region instance-attribute

device_region: str | None = deviceRegion

Inherited From VeSyncBaseDevice

device_type instance-attribute

device_type: str = deviceType

Inherited From VeSyncBaseDevice

enabled instance-attribute

enabled: bool = True

Inherited From VeSyncBaseDevice

fan_levels instance-attribute

fan_levels: list[int] = fan_levels

Inherited From VeSyncFanBase

features instance-attribute

features: list[str] = features

Inherited From VeSyncBaseDevice

firmware_update property

firmware_update: bool

Inherited From VeSyncBaseDevice

Return True if firmware update available.

This is going to be updated.

is_on property

is_on: bool

Inherited From VeSyncBaseDevice

Return true if device is on.

last_response instance-attribute

last_response: ResponseInfo | None = None

Inherited From VeSyncBaseDevice

latest_firm_version instance-attribute

latest_firm_version: str | None = None

Inherited From VeSyncBaseDevice

mac_id instance-attribute

mac_id: str | None = macID

Inherited From VeSyncBaseDevice

manager instance-attribute

manager: VeSync

Inherited From BypassV2Mixin

modes instance-attribute

modes: list[str] = modes

Inherited From VeSyncFanBase

pid instance-attribute

pid: str | None = None

Inherited From VeSyncBaseDevice

product_type instance-attribute

product_type: str = product_type

Inherited From VeSyncBaseDevice

request_keys class-attribute

request_keys: list[str] = [
    'acceptLanguage',
    'appVersion',
    'phoneBrand',
    'phoneOS',
    'accountID',
    'cid',
    'configModule',
    'debugMode',
    'traceId',
    'timeZone',
    'token',
    'userCountryCode',
    'configModel',
    'deviceId',
]

Inherited From BypassV2Mixin

sleep_preferences instance-attribute

sleep_preferences: list[str] = sleep_preferences

Inherited From VeSyncFanBase

state instance-attribute

state: FanState = FanState(self, details, feature_map)

Inherited From VeSyncBaseDevice

sub_device_no instance-attribute

sub_device_no: int | None = subDeviceNo

Inherited From VeSyncBaseDevice

supports_displaying_type property

supports_displaying_type: bool

Inherited From VeSyncFanBase

Return True if device supports displaying type.

supports_horizontal_oscillation property

supports_horizontal_oscillation: bool

Inherited From VeSyncFanBase

Return True if device supports horizontal oscillation.

supports_mute property

supports_mute: bool

Inherited From VeSyncFanBase

Return True if device supports mute.

supports_oscillation property

supports_oscillation: bool

Inherited From VeSyncFanBase

Return True if device supports oscillation.

supports_set_oscillation_range property

supports_set_oscillation_range: bool

Inherited From VeSyncFanBase

Return True if device supports setting oscillation range.

supports_vertical_oscillation property

supports_vertical_oscillation: bool

Inherited From VeSyncFanBase

Return True if device supports vertical oscillation.

type instance-attribute

type: str | None = type

Inherited From VeSyncBaseDevice

uuid instance-attribute

uuid: str | None = uuid

Inherited From VeSyncBaseDevice

Functions

advanced_sleep_mode async deprecated

advanced_sleep_mode() -> bool

Inherited From VeSyncFanBase

Deprecated

Use set_advanced_sleep_mode method instead

Set advanced sleep mode.

call_bypassv2_api async

call_bypassv2_api(
    payload_method: str,
    data: dict | None = None,
    method: str = 'bypassV2',
    endpoint: str = 'bypassV2',
    payload_update: dict | None = None,
) -> dict | None

Inherited From BypassV2Mixin

Send Bypass V2 API request.

This uses the _build_request method to send API requests to the Bypass V2 API.

Parameters:

Name Type Description Default
payload_method str

The method to use in the payload dict.

required
data dict | None

The data to send in the request.

None
method str

The method to use in the outer body.

'bypassV2'
endpoint str | None

The last part of the API url, defaults to bypassV2, e.g. /cloud/v2/deviceManaged/bypassV2.

'bypassV2'
payload_update dict | None

Additional keys to add to the payload.

None

Returns:

Name Type Description
bytes dict | None

The response from the API request.

clear_timer async

clear_timer() -> bool

Inherited From VeSyncBaseDevice

Clear timer for device from API.

This may not be implemented for all devices. Please open an issue if there is an error.

Returns:

Name Type Description
bool bool

True if successful, False otherwise.

display

display(state: bool = True) -> None

Inherited From VeSyncBaseDevice

Print formatted static device info to stdout.

Parameters:

Name Type Description Default
state bool

If True, include state in display, defaults to True.

True

Example:

Device Name:..................Living Room Lamp
Model:........................ESL100
Subdevice No:.................0
Type:.........................wifi
CID:..........................1234567890abcdef

get_details async

get_details() -> None

Inherited From VeSyncBaseDevice

Get device details.

This method is defined in each device class to contain the logic to pull the device state from the API and update the device's state attribute. The update() method should be called to update the device state.

get_state

get_state(state_attr: str) -> Any

Inherited From VeSyncBaseDevice

Get device state attribute.

get_timer async

get_timer() -> None

Inherited From VeSyncBaseDevice

Get timer for device from API and set the state.Timer attribute.

This may not be implemented for all devices. Please open an issue if there is an error.

Note

This method may not be implemented for all devices. Please open an issue if there is an error.

manual_mode async deprecated

manual_mode() -> bool

Inherited From VeSyncFanBase

Deprecated

Use set_manual_mode method instead

Adapter to set mode to normal.

mode_toggle async deprecated

mode_toggle(mode: str) -> bool

Inherited From VeSyncFanBase

Deprecated

Use set_mode method instead

Set mode to specified mode.

normal_mode async deprecated

normal_mode() -> bool

Inherited From VeSyncFanBase

Deprecated

Use set_normal_mode method instead

Set mode to normal.

set_advanced_sleep_mode async

set_advanced_sleep_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Advanced Sleep Mode.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

set_auto_mode async

set_auto_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Auto Mode.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

set_fan_speed async

set_fan_speed(speed: int | None = None) -> bool

Inherited From VeSyncFanBase

Set Fan Fan Speed.

Parameters:

Name Type Description Default
speed int

Fan speed level according to device specs.

None

Returns:

Name Type Description
bool bool

Success of request.

set_horizontal_oscillation_range async

set_horizontal_oscillation_range(
    *, left: int = 0, right: int = 0
) -> bool

Inherited From VeSyncFanBase

Set Horizontal Oscillation Range.

Parameters:

Name Type Description Default
left int

Left range.

0
right int

Right range.

0

Returns:

Name Type Description
bool bool

true if success.

set_manual_mode async

set_manual_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Manual Mode - Normal Mode.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

set_mode async

set_mode(mode: str) -> bool

Inherited From VeSyncFanBase

Set Fan Mode.

Parameters:

Name Type Description Default
mode str

Mode to set, varies by device type.

required

Returns:

Name Type Description
bool bool

Success of request.

set_normal_mode async

set_normal_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Normal Mode.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

set_sleep_mode async

set_sleep_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Sleep Mode.

This is also referred to as Advanced Sleep Mode on some devices.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

set_state

set_state(state_attr: str, stat_value: Any) -> None

Inherited From VeSyncBaseDevice

Set device state attribute.

set_timer async

set_timer(duration: int, action: str | None = None) -> bool

Inherited From VeSyncBaseDevice

Set timer for device.

This may not be implemented for all devices. Please open an issue if there is an error.

Parameters:

Name Type Description Default
duration int

Duration in seconds.

required
action str | None

Action to take when timer expires.

None

Returns:

Name Type Description
bool bool

True if successful, False otherwise.

set_turbo_mode async

set_turbo_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Turbo Mode.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

set_vertical_oscillation_range async

set_vertical_oscillation_range(
    *, top: int = 0, bottom: int = 0
) -> bool

Inherited From VeSyncFanBase

Set Vertical Oscillation Range.

Parameters:

Name Type Description Default
top int

Top range.

0
bottom int

Bottom range.

0

Returns:

Name Type Description
bool bool

true if success.

sleep_mode async deprecated

sleep_mode() -> bool

Inherited From VeSyncFanBase

Deprecated

Use set_sleep_mode method instead

Adapter to set advanced sleep mode.

to_dict

to_dict(state: bool = True) -> dict[str, Any]

Inherited From VeSyncBaseDevice

Return device information as a dictionary.

Parameters:

Name Type Description Default
state bool

If True, include state in dictionary, defaults to True.

True

Returns:

Type Description
dict[str, Any]

dict[str, Any]: Dictionary containing device information.

to_json

to_json(state: bool = True, indent: bool = True) -> str

Inherited From VeSyncBaseDevice

Print JSON API string for device details.

Parameters:

Name Type Description Default
state bool

If True, include state in JSON output, defaults to True.

True
indent bool

If True, indent JSON output, defaults to True.

True

Returns:

Name Type Description
str str

JSON formatted string of device details.

to_jsonb

to_jsonb(state: bool = True, indent: bool = True) -> bytes

Inherited From VeSyncBaseDevice

JSON API bytes for device details.

Parameters:

Name Type Description Default
state bool

If True, include state in JSON output, defaults to True.

True
indent bool

If True, indent JSON output, defaults to True.

True

Returns:

Name Type Description
bytes bytes

JSON formatted bytes of device details.

Example

This is an example without state.

{
    "Device Name": "Living Room Lamp",
    "Model": "ESL100",
    "Subdevice No": "0",
    "Type": "wifi",
    "CID": "1234567890abcdef"
}

toggle_display async

toggle_display(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle Display on/off.

Parameters:

Name Type Description Default
toggle bool

Display state.

required

Returns:

Name Type Description
bool bool

Success of request.

toggle_displaying_type async

toggle_displaying_type(toggle: bool) -> bool

Inherited From VeSyncFanBase

Set displaying type on/off - Unknown functionality.

toggle_horizontal_oscillation async

toggle_horizontal_oscillation(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle Horizontal Oscillation on/off.

Parameters:

Name Type Description Default
toggle bool

Horizontal Oscillation state.

required

Returns:

Name Type Description
bool bool

true if success.

toggle_mute async

toggle_mute(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle mute on/off.

Parameters:

Name Type Description Default
toggle bool

True to turn mute on, False to turn off

required

Returns:

Name Type Description
bool bool

True if successful, False if not

toggle_oscillation async

toggle_oscillation(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle Oscillation on/off.

Parameters:

Name Type Description Default
toggle bool

Oscillation state.

required

Returns:

Name Type Description
bool bool

true if success.

toggle_switch async

toggle_switch(toggle: bool | None = None) -> bool

Inherited From VeSyncBaseToggleDevice

Toggle device power on or off.

Parameters:

Name Type Description Default
toggle bool | None

True to turn on, False to turn off, None to toggle.

None

Returns:

Name Type Description
bool bool

True if successful, False otherwise.

toggle_vertical_oscillation async

toggle_vertical_oscillation(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle Vertical Oscillation on/off.

Parameters:

Name Type Description Default
toggle bool

Vertical Oscillation state.

required

Returns:

Name Type Description
bool bool

true if success.

turn_off async

turn_off() -> bool

Inherited From VeSyncBaseToggleDevice

Turn device off.

turn_off_display async

turn_off_display() -> bool

Inherited From VeSyncFanBase

Turn off Display.

Returns:

Name Type Description
bool bool

Success of request

turn_off_horizontal_oscillation async

turn_off_horizontal_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_horizontal_oscillation to off.

turn_off_mute async

turn_off_mute() -> bool

Inherited From VeSyncFanBase

Set toggle_mute to off.

turn_off_oscillation async

turn_off_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_oscillation to off.

turn_off_vertical_oscillation async

turn_off_vertical_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_vertical_oscillation to off.

turn_on async

turn_on() -> bool

Inherited From VeSyncBaseToggleDevice

Turn device on.

turn_on_display async

turn_on_display() -> bool

Inherited From VeSyncFanBase

Turn on Display.

Returns:

Name Type Description
bool bool

Success of request

turn_on_horizontal_oscillation async

turn_on_horizontal_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_horizontal_oscillation to on.

turn_on_mute async

turn_on_mute() -> bool

Inherited From VeSyncFanBase

Set toggle_mute to on.

turn_on_oscillation async

turn_on_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_oscillation to on.

turn_on_vertical_oscillation async

turn_on_vertical_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_vertical_oscillation to on.

update async

update() -> None

Inherited From VeSyncBaseDevice

Update device details.

pyvesync.devices.vesyncfan.VeSyncPedestalFan

VeSyncPedestalFan(
    details: ResponseDeviceDetailsModel,
    manager: VeSync,
    feature_map: FanMap,
)

Bases: BypassV2Mixin, VeSyncFanBase

Levoit Pedestal Fan Device Class.

Inherited From VeSyncFanBase

Initialize the VeSync Base API V2 Fan Class.

Attributes

cid instance-attribute

cid: str = cid

Inherited From VeSyncBaseDevice

config_module instance-attribute

config_module: str = configModule

Inherited From VeSyncBaseDevice

connection_type instance-attribute

connection_type: str | None = connectionType

Inherited From VeSyncBaseDevice

current_firm_version instance-attribute

current_firm_version = currentFirmVersion

Inherited From VeSyncBaseDevice

device_image instance-attribute

device_image: str | None = deviceImg

Inherited From VeSyncBaseDevice

device_name instance-attribute

device_name: str = deviceName

Inherited From VeSyncBaseDevice

device_region instance-attribute

device_region: str | None = deviceRegion

Inherited From VeSyncBaseDevice

device_type instance-attribute

device_type: str = deviceType

Inherited From VeSyncBaseDevice

enabled instance-attribute

enabled: bool = True

Inherited From VeSyncBaseDevice

fan_levels instance-attribute

fan_levels: list[int] = fan_levels

Inherited From VeSyncFanBase

features instance-attribute

features: list[str] = features

Inherited From VeSyncBaseDevice

firmware_update property

firmware_update: bool

Inherited From VeSyncBaseDevice

Return True if firmware update available.

This is going to be updated.

is_on property

is_on: bool

Inherited From VeSyncBaseDevice

Return true if device is on.

last_response instance-attribute

last_response: ResponseInfo | None = None

Inherited From VeSyncBaseDevice

latest_firm_version instance-attribute

latest_firm_version: str | None = None

Inherited From VeSyncBaseDevice

mac_id instance-attribute

mac_id: str | None = macID

Inherited From VeSyncBaseDevice

manager instance-attribute

manager: VeSync

Inherited From BypassV2Mixin

modes instance-attribute

modes: list[str] = modes

Inherited From VeSyncFanBase

pid instance-attribute

pid: str | None = None

Inherited From VeSyncBaseDevice

product_type instance-attribute

product_type: str = product_type

Inherited From VeSyncBaseDevice

request_keys class-attribute

request_keys: list[str] = [
    'acceptLanguage',
    'appVersion',
    'phoneBrand',
    'phoneOS',
    'accountID',
    'cid',
    'configModule',
    'debugMode',
    'traceId',
    'timeZone',
    'token',
    'userCountryCode',
    'configModel',
    'deviceId',
]

Inherited From BypassV2Mixin

sleep_preferences instance-attribute

sleep_preferences: list[str] = sleep_preferences

Inherited From VeSyncFanBase

state instance-attribute

state: FanState = FanState(self, details, feature_map)

Inherited From VeSyncBaseDevice

sub_device_no instance-attribute

sub_device_no: int | None = subDeviceNo

Inherited From VeSyncBaseDevice

supports_displaying_type property

supports_displaying_type: bool

Inherited From VeSyncFanBase

Return True if device supports displaying type.

supports_horizontal_oscillation property

supports_horizontal_oscillation: bool

Inherited From VeSyncFanBase

Return True if device supports horizontal oscillation.

supports_mute property

supports_mute: bool

Inherited From VeSyncFanBase

Return True if device supports mute.

supports_oscillation property

supports_oscillation: bool

Inherited From VeSyncFanBase

Return True if device supports oscillation.

supports_set_oscillation_range property

supports_set_oscillation_range: bool

Inherited From VeSyncFanBase

Return True if device supports setting oscillation range.

supports_vertical_oscillation property

supports_vertical_oscillation: bool

Inherited From VeSyncFanBase

Return True if device supports vertical oscillation.

type instance-attribute

type: str | None = type

Inherited From VeSyncBaseDevice

uuid instance-attribute

uuid: str | None = uuid

Inherited From VeSyncBaseDevice

Functions

advanced_sleep_mode async deprecated

advanced_sleep_mode() -> bool

Inherited From VeSyncFanBase

Deprecated

Use set_advanced_sleep_mode method instead

Set advanced sleep mode.

call_bypassv2_api async

call_bypassv2_api(
    payload_method: str,
    data: dict | None = None,
    method: str = 'bypassV2',
    endpoint: str = 'bypassV2',
    payload_update: dict | None = None,
) -> dict | None

Inherited From BypassV2Mixin

Send Bypass V2 API request.

This uses the _build_request method to send API requests to the Bypass V2 API.

Parameters:

Name Type Description Default
payload_method str

The method to use in the payload dict.

required
data dict | None

The data to send in the request.

None
method str

The method to use in the outer body.

'bypassV2'
endpoint str | None

The last part of the API url, defaults to bypassV2, e.g. /cloud/v2/deviceManaged/bypassV2.

'bypassV2'
payload_update dict | None

Additional keys to add to the payload.

None

Returns:

Name Type Description
bytes dict | None

The response from the API request.

clear_timer async

clear_timer() -> bool

Inherited From VeSyncBaseDevice

Clear timer for device from API.

This may not be implemented for all devices. Please open an issue if there is an error.

Returns:

Name Type Description
bool bool

True if successful, False otherwise.

display

display(state: bool = True) -> None

Inherited From VeSyncBaseDevice

Print formatted static device info to stdout.

Parameters:

Name Type Description Default
state bool

If True, include state in display, defaults to True.

True

Example:

Device Name:..................Living Room Lamp
Model:........................ESL100
Subdevice No:.................0
Type:.........................wifi
CID:..........................1234567890abcdef

get_details async

get_details() -> None

Inherited From VeSyncBaseDevice

Get device details.

This method is defined in each device class to contain the logic to pull the device state from the API and update the device's state attribute. The update() method should be called to update the device state.

get_state

get_state(state_attr: str) -> Any

Inherited From VeSyncBaseDevice

Get device state attribute.

get_timer async

get_timer() -> Timer | None

Inherited From VeSyncBaseDevice

Get timer for device from API and set the state.Timer attribute.

This may not be implemented for all devices. Please open an issue if there is an error.

Note

This method may not be implemented for all devices. Please open an issue if there is an error.

manual_mode async deprecated

manual_mode() -> bool

Inherited From VeSyncFanBase

Deprecated

Use set_manual_mode method instead

Adapter to set mode to normal.

mode_toggle async deprecated

mode_toggle(mode: str) -> bool

Inherited From VeSyncFanBase

Deprecated

Use set_mode method instead

Set mode to specified mode.

normal_mode async deprecated

normal_mode() -> bool

Inherited From VeSyncFanBase

Deprecated

Use set_normal_mode method instead

Set mode to normal.

set_advanced_sleep_mode async

set_advanced_sleep_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Advanced Sleep Mode.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

set_auto_mode async

set_auto_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Auto Mode.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

set_fan_speed async

set_fan_speed(speed: int | None = None) -> bool

Inherited From VeSyncFanBase

Set Fan Fan Speed.

Parameters:

Name Type Description Default
speed int

Fan speed level according to device specs.

None

Returns:

Name Type Description
bool bool

Success of request.

set_horizontal_oscillation_range async

set_horizontal_oscillation_range(
    *, left: int = 0, right: int = 0
) -> bool

Inherited From VeSyncFanBase

Set horizontal oscillation range.

Parameters:

Name Type Description Default
left int

Left range for oscillation.

0
right int

Right range for oscillation.

0

Returns:

Name Type Description
bool bool

true if success.

set_manual_mode async

set_manual_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Manual Mode - Normal Mode.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

set_mode async

set_mode(mode: str) -> bool

Inherited From VeSyncFanBase

Set Fan Mode.

Parameters:

Name Type Description Default
mode str

Mode to set, varies by device type.

required

Returns:

Name Type Description
bool bool

Success of request.

set_normal_mode async

set_normal_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Normal Mode.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

set_sleep_mode async

set_sleep_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Sleep Mode.

This is also referred to as Advanced Sleep Mode on some devices.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

set_state

set_state(state_attr: str, stat_value: Any) -> None

Inherited From VeSyncBaseDevice

Set device state attribute.

set_timer async

set_timer(duration: int, action: str | None = None) -> bool

Inherited From VeSyncBaseDevice

Set timer for device.

This may not be implemented for all devices. Please open an issue if there is an error.

Parameters:

Name Type Description Default
duration int

Duration in seconds.

required
action str | None

Action to take when timer expires.

None

Returns:

Name Type Description
bool bool

True if successful, False otherwise.

set_turbo_mode async

set_turbo_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Turbo Mode.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

set_vertical_oscillation_range async

set_vertical_oscillation_range(
    *, top: int = 0, bottom: int = 0
) -> bool

Inherited From VeSyncFanBase

Set vertical oscillation range.

Parameters:

Name Type Description Default
top int

Top range for oscillation.

0
bottom int

Bottom range for oscillation.

0

Returns:

Name Type Description
bool bool

true if success.

sleep_mode async deprecated

sleep_mode() -> bool

Inherited From VeSyncFanBase

Deprecated

Use set_sleep_mode method instead

Adapter to set advanced sleep mode.

to_dict

to_dict(state: bool = True) -> dict[str, Any]

Inherited From VeSyncBaseDevice

Return device information as a dictionary.

Parameters:

Name Type Description Default
state bool

If True, include state in dictionary, defaults to True.

True

Returns:

Type Description
dict[str, Any]

dict[str, Any]: Dictionary containing device information.

to_json

to_json(state: bool = True, indent: bool = True) -> str

Inherited From VeSyncBaseDevice

Print JSON API string for device details.

Parameters:

Name Type Description Default
state bool

If True, include state in JSON output, defaults to True.

True
indent bool

If True, indent JSON output, defaults to True.

True

Returns:

Name Type Description
str str

JSON formatted string of device details.

to_jsonb

to_jsonb(state: bool = True, indent: bool = True) -> bytes

Inherited From VeSyncBaseDevice

JSON API bytes for device details.

Parameters:

Name Type Description Default
state bool

If True, include state in JSON output, defaults to True.

True
indent bool

If True, indent JSON output, defaults to True.

True

Returns:

Name Type Description
bytes bytes

JSON formatted bytes of device details.

Example

This is an example without state.

{
    "Device Name": "Living Room Lamp",
    "Model": "ESL100",
    "Subdevice No": "0",
    "Type": "wifi",
    "CID": "1234567890abcdef"
}

toggle_display async

toggle_display(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle Display on/off.

Parameters:

Name Type Description Default
toggle bool

Display state.

required

Returns:

Name Type Description
bool bool

Success of request.

toggle_displaying_type async

toggle_displaying_type(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle displaying type on/off.

This functionality is unknown but was in the API calls.

Parameters:

Name Type Description Default
toggle bool

Displaying type state.

required

Returns:

Name Type Description
bool bool

true if success.

toggle_horizontal_oscillation async

toggle_horizontal_oscillation(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle horizontal oscillation on/off.

Parameters:

Name Type Description Default
toggle bool

True to enable, False to disable.

required

Returns:

Name Type Description
bool bool

true if success.

toggle_mute async

toggle_mute(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle mute on/off.

Parameters:

Name Type Description Default
toggle bool

True to turn mute on, False to turn off

required

Returns:

Name Type Description
bool bool

True if successful, False if not

toggle_oscillation async

toggle_oscillation(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle Oscillation on/off.

Parameters:

Name Type Description Default
toggle bool

Oscillation state.

required

Returns:

Name Type Description
bool bool

true if success.

toggle_switch async

toggle_switch(toggle: bool | None = None) -> bool

Inherited From VeSyncBaseToggleDevice

Toggle device power on or off.

Parameters:

Name Type Description Default
toggle bool | None

True to turn on, False to turn off, None to toggle.

None

Returns:

Name Type Description
bool bool

True if successful, False otherwise.

toggle_vertical_oscillation async

toggle_vertical_oscillation(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle vertical oscillation on/off.

Parameters:

Name Type Description Default
toggle bool

True to enable, False to disable.

required

Returns:

Name Type Description
bool bool

true if success.

turn_off async

turn_off() -> bool

Inherited From VeSyncBaseToggleDevice

Turn device off.

turn_off_display async

turn_off_display() -> bool

Inherited From VeSyncFanBase

Turn off Display.

Returns:

Name Type Description
bool bool

Success of request

turn_off_horizontal_oscillation async

turn_off_horizontal_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_horizontal_oscillation to off.

turn_off_mute async

turn_off_mute() -> bool

Inherited From VeSyncFanBase

Set toggle_mute to off.

turn_off_oscillation async

turn_off_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_oscillation to off.

turn_off_vertical_oscillation async

turn_off_vertical_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_vertical_oscillation to off.

turn_on async

turn_on() -> bool

Inherited From VeSyncBaseToggleDevice

Turn device on.

turn_on_display async

turn_on_display() -> bool

Inherited From VeSyncFanBase

Turn on Display.

Returns:

Name Type Description
bool bool

Success of request

turn_on_horizontal_oscillation async

turn_on_horizontal_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_horizontal_oscillation to on.

turn_on_mute async

turn_on_mute() -> bool

Inherited From VeSyncFanBase

Set toggle_mute to on.

turn_on_oscillation async

turn_on_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_oscillation to on.

turn_on_vertical_oscillation async

turn_on_vertical_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_vertical_oscillation to on.

update async

update() -> None

Inherited From VeSyncBaseDevice

Update device details.

pyvesync.base_devices.fan_base.VeSyncFanBase

Bases: VeSyncBaseToggleDevice

Base device for VeSync tower fans.

Inherits from VeSyncBaseToggleDevice and VeSyncBaseDevice.

Attributes:

Name Type Description
fan_levels list[int]

Fan levels supported by device.

modes list[str]

Modes supported by device.

sleep_preferences list[str]

Sleep preferences supported by device.

Source code in src/pyvesync/base_devices/fan_base.py
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
class VeSyncFanBase(VeSyncBaseToggleDevice):
    """Base device for VeSync tower fans.

    Inherits from
    [VeSyncBaseToggleDevice][pyvesync.base_devices.vesyncbasedevice.VeSyncBaseToggleDevice]
    and [VeSyncBaseDevice][pyvesync.base_devices.vesyncbasedevice.VeSyncBaseDevice].

    Attributes:
        fan_levels (list[int]): Fan levels supported by device.
        modes (list[str]): Modes supported by device.
        sleep_preferences (list[str]): Sleep preferences supported by device.
    """

    __slots__ = (
        'fan_levels',
        'modes',
        'sleep_preferences',
    )

    def __init__(
        self,
        details: ResponseDeviceDetailsModel,
        manager: VeSync,
        feature_map: FanMap,
    ) -> None:
        """Initialize VeSync Tower Fan Base Class.

        Args:
            details (ResponseDeviceDetailsModel): Device details.
            manager (VeSync): Manager.
            feature_map (FanMap): Feature map.

        See Also:
            See [device_map][pyvesync.device_map] for configured features and modes.
        """
        super().__init__(details, manager, feature_map)
        self.features: list[str] = feature_map.features
        self.state: FanState = FanState(self, details, feature_map)
        self.modes: list[str] = feature_map.modes
        self.fan_levels: list[int] = feature_map.fan_levels
        self.sleep_preferences: list[str] = feature_map.sleep_preferences

    @property
    def supports_oscillation(self) -> bool:
        """Return True if device supports oscillation."""
        return FanFeatures.OSCILLATION in self.features

    @property
    def supports_set_oscillation_range(self) -> bool:
        """Return True if device supports setting oscillation range."""
        return FanFeatures.SET_OSCILLATION_RANGE in self.features

    @property
    def supports_vertical_oscillation(self) -> bool:
        """Return True if device supports vertical oscillation."""
        return FanFeatures.VERTICAL_OSCILLATION in self.features

    @property
    def supports_horizontal_oscillation(self) -> bool:
        """Return True if device supports horizontal oscillation."""
        return FanFeatures.HORIZONTAL_OSCILLATION in self.features

    @property
    def supports_mute(self) -> bool:
        """Return True if device supports mute."""
        return FanFeatures.SOUND in self.features

    @property
    def supports_displaying_type(self) -> bool:
        """Return True if device supports displaying type."""
        return FanFeatures.DISPLAYING_TYPE in self.features

    async def toggle_display(self, toggle: bool) -> bool:
        """Toggle Display on/off.

        Args:
            toggle (bool): Display state.

        Returns:
            bool: Success of request.
        """
        del toggle
        return False

    async def turn_on_display(self) -> bool:
        """Turn on Display.

        Returns:
            bool: Success of request
        """
        return await self.toggle_display(True)

    async def turn_off_display(self) -> bool:
        """Turn off Display.

        Returns:
            bool: Success of request
        """
        return await self.toggle_display(False)

    @abstractmethod
    async def set_mode(self, mode: str) -> bool:
        """Set Fan Mode.

        Args:
            mode (str): Mode to set, varies by device type.

        Returns:
            bool: Success of request.
        """

    @abstractmethod
    async def set_fan_speed(self, speed: int | None = None) -> bool:
        """Set Fan Fan Speed.

        Args:
            speed (int, optional): Fan speed level according to device specs.

        Returns:
            bool: Success of request.
        """

    async def set_auto_mode(self) -> bool:
        """Set Fan to Auto Mode.

        Returns:
            bool: Success of request.

        Note:
            This method is not supported by all devices, will return
            false with warning debug message if not supported.
        """
        if FanModes.AUTO in self.modes:
            return await self.set_mode(FanModes.AUTO)
        logger.warning('Auto mode not supported for this device.')
        return False

    async def set_advanced_sleep_mode(self) -> bool:
        """Set Fan to Advanced Sleep Mode.

        Returns:
            bool: Success of request.

        Note:
            This method is not supported by all devices, will return
            false with warning debug message if not supported.
        """
        if FanModes.ADVANCED_SLEEP in self.modes:
            return await self.set_mode(FanModes.ADVANCED_SLEEP)
        logger.warning('Advanced Sleep mode not supported for this device.')
        return False

    async def set_sleep_mode(self) -> bool:
        """Set Fan to Sleep Mode.

        This is also referred to as Advanced Sleep Mode on some devices.

        Returns:
            bool: Success of request.

        Note:
            This method is not supported by all devices, will return
            false with warning debug message if not supported.
        """
        if FanModes.ADVANCED_SLEEP in self.modes:
            return await self.set_mode(FanModes.ADVANCED_SLEEP)
        logger.warning('Sleep mode not supported for this device.')
        return False

    async def set_manual_mode(self) -> bool:
        """Set Fan to Manual Mode - Normal Mode.

        Returns:
            bool: Success of request.

        Note:
            This method is not supported by all devices, will return
            false with warning debug message if not supported.
        """
        if FanModes.NORMAL in self.modes:
            return await self.set_mode(FanModes.NORMAL)
        logger.warning('Manual mode not supported for this device.')
        return False

    async def set_normal_mode(self) -> bool:
        """Set Fan to Normal Mode.

        Returns:
            bool: Success of request.

        Note:
            This method is not supported by all devices, will return
            false with warning debug message if not supported.
        """
        if FanModes.NORMAL in self.modes:
            return await self.set_mode(FanModes.NORMAL)
        logger.warning('Normal mode not supported for this device.')
        return False

    async def set_turbo_mode(self) -> bool:
        """Set Fan to Turbo Mode.

        Returns:
            bool: Success of request.

        Note:
            This method is not supported by all devices, will return
            false with warning debug message if not supported.
        """
        if FanModes.TURBO in self.modes:
            return await self.set_mode(FanModes.TURBO)
        logger.warning('Turbo mode not supported for this device.')
        return False

    async def toggle_oscillation(self, toggle: bool) -> bool:
        """Toggle Oscillation on/off.

        Args:
            toggle (bool): Oscillation state.

        Returns:
            bool: true if success.
        """
        del toggle
        if self.supports_oscillation:
            logger.debug('Oscillation not configured for this device.')
        else:
            logger.debug('Oscillation not supported for this device.')
        return False

    async def turn_on_oscillation(self) -> bool:
        """Set toggle_oscillation to on."""
        return await self.toggle_oscillation(True)

    async def turn_off_oscillation(self) -> bool:
        """Set toggle_oscillation to off."""
        return await self.toggle_oscillation(False)

    async def toggle_vertical_oscillation(self, toggle: bool) -> bool:
        """Toggle Vertical Oscillation on/off.

        Args:
            toggle (bool): Vertical Oscillation state.

        Returns:
            bool: true if success.
        """
        del toggle
        if self.supports_vertical_oscillation:
            logger.debug('Vertical Oscillation not configured for this device.')
        else:
            logger.debug('Vertical Oscillation not supported for this device.')
        return False

    async def turn_on_vertical_oscillation(self) -> bool:
        """Set toggle_vertical_oscillation to on."""
        return await self.toggle_vertical_oscillation(True)

    async def turn_off_vertical_oscillation(self) -> bool:
        """Set toggle_vertical_oscillation to off."""
        return await self.toggle_vertical_oscillation(False)

    async def toggle_horizontal_oscillation(self, toggle: bool) -> bool:
        """Toggle Horizontal Oscillation on/off.

        Args:
            toggle (bool): Horizontal Oscillation state.

        Returns:
            bool: true if success.
        """
        del toggle
        if self.supports_horizontal_oscillation:
            logger.debug('Horizontal Oscillation not configured for this device.')
        else:
            logger.debug('Horizontal Oscillation not supported for this device.')
        return False

    async def turn_on_horizontal_oscillation(self) -> bool:
        """Set toggle_horizontal_oscillation to on."""
        return await self.toggle_horizontal_oscillation(True)

    async def turn_off_horizontal_oscillation(self) -> bool:
        """Set toggle_horizontal_oscillation to off."""
        return await self.toggle_horizontal_oscillation(False)

    async def set_vertical_oscillation_range(
        self, *, top: int = 0, bottom: int = 0
    ) -> bool:
        """Set Vertical Oscillation Range.

        Args:
            top (int): Top range.
            bottom (int): Bottom range.

        Returns:
            bool: true if success.
        """
        del top, bottom
        if self.supports_set_oscillation_range:
            logger.debug('Vertical oscillation range not configured for this device.')
        else:
            logger.debug('Vertical oscillation range not supported for this device.')
        return False

    async def set_horizontal_oscillation_range(
        self, *, left: int = 0, right: int = 0
    ) -> bool:
        """Set Horizontal Oscillation Range.

        Args:
            left (int): Left range.
            right (int): Right range.

        Returns:
            bool: true if success.
        """
        del left, right
        if self.supports_set_oscillation_range:
            logger.debug('Horizontal oscillation range not configured for this device.')
        else:
            logger.debug('Horizontal oscillation range not supported for this device.')
        return False

    async def toggle_mute(self, toggle: bool) -> bool:
        """Toggle mute on/off.

        Parameters:
            toggle (bool): True to turn mute on, False to turn off

        Returns:
            bool : True if successful, False if not
        """
        del toggle
        if self.supports_mute:
            logger.debug('Mute not configured for this device.')
        else:
            logger.debug('Mute not supported for this device.')
        return False

    async def turn_on_mute(self) -> bool:
        """Set toggle_mute to on."""
        return await self.toggle_mute(True)

    async def turn_off_mute(self) -> bool:
        """Set toggle_mute to off."""
        return await self.toggle_mute(False)

    async def toggle_displaying_type(self, toggle: bool) -> bool:
        """Toggle displaying type on/off.

        This functionality is unknown but was in the API calls.

        Args:
            toggle (bool): Displaying type state.

        Returns:
            bool: true if success.
        """
        del toggle
        if self.supports_displaying_type:
            logger.debug('Displaying type not configured for this device.')
        else:
            logger.debug('Displaying type not supported for this device.')
        return False

    @deprecated('Use `set_normal_mode` method instead')
    async def normal_mode(self) -> bool:
        """Set mode to normal."""
        return await self.set_normal_mode()

    @deprecated('Use `set_manual_mode` method instead')
    async def manual_mode(self) -> bool:
        """Adapter to set mode to normal."""
        return await self.set_normal_mode()

    @deprecated('Use `set_advanced_sleep_mode` method instead')
    async def advanced_sleep_mode(self) -> bool:
        """Set advanced sleep mode."""
        return await self.set_mode('advancedSleep')

    @deprecated('Use `set_sleep_mode` method instead')
    async def sleep_mode(self) -> bool:
        """Adapter to set advanced sleep mode."""
        return await self.set_advanced_sleep_mode()

    @deprecated('Use `set_mode` method instead')
    async def mode_toggle(self, mode: str) -> bool:
        """Set mode to specified mode."""
        return await self.set_mode(mode)

Attributes

cid instance-attribute

cid: str = cid

Inherited From VeSyncBaseDevice

config_module instance-attribute

config_module: str = configModule

Inherited From VeSyncBaseDevice

connection_type instance-attribute

connection_type: str | None = connectionType

Inherited From VeSyncBaseDevice

current_firm_version instance-attribute

current_firm_version = currentFirmVersion

Inherited From VeSyncBaseDevice

device_image instance-attribute

device_image: str | None = deviceImg

Inherited From VeSyncBaseDevice

device_name instance-attribute

device_name: str = deviceName

Inherited From VeSyncBaseDevice

device_region instance-attribute

device_region: str | None = deviceRegion

Inherited From VeSyncBaseDevice

device_type instance-attribute

device_type: str = deviceType

Inherited From VeSyncBaseDevice

enabled instance-attribute

enabled: bool = True

Inherited From VeSyncBaseDevice

fan_levels instance-attribute

fan_levels: list[int] = fan_levels

Inherited From VeSyncFanBase

features instance-attribute

features: list[str] = features

Inherited From VeSyncBaseDevice

firmware_update property

firmware_update: bool

Inherited From VeSyncBaseDevice

Return True if firmware update available.

This is going to be updated.

is_on property

is_on: bool

Inherited From VeSyncBaseDevice

Return true if device is on.

last_response instance-attribute

last_response: ResponseInfo | None = None

Inherited From VeSyncBaseDevice

latest_firm_version instance-attribute

latest_firm_version: str | None = None

Inherited From VeSyncBaseDevice

mac_id instance-attribute

mac_id: str | None = macID

Inherited From VeSyncBaseDevice

manager instance-attribute

manager = manager

Inherited From VeSyncBaseDevice

modes instance-attribute

modes: list[str] = modes

Inherited From VeSyncFanBase

pid instance-attribute

pid: str | None = None

Inherited From VeSyncBaseDevice

product_type instance-attribute

product_type: str = product_type

Inherited From VeSyncBaseDevice

sleep_preferences instance-attribute

sleep_preferences: list[str] = sleep_preferences

Inherited From VeSyncFanBase

state instance-attribute

state: FanState = FanState(self, details, feature_map)

Inherited From VeSyncBaseDevice

sub_device_no instance-attribute

sub_device_no: int | None = subDeviceNo

Inherited From VeSyncBaseDevice

supports_displaying_type property

supports_displaying_type: bool

Inherited From VeSyncFanBase

Return True if device supports displaying type.

supports_horizontal_oscillation property

supports_horizontal_oscillation: bool

Inherited From VeSyncFanBase

Return True if device supports horizontal oscillation.

supports_mute property

supports_mute: bool

Inherited From VeSyncFanBase

Return True if device supports mute.

supports_oscillation property

supports_oscillation: bool

Inherited From VeSyncFanBase

Return True if device supports oscillation.

supports_set_oscillation_range property

supports_set_oscillation_range: bool

Inherited From VeSyncFanBase

Return True if device supports setting oscillation range.

supports_vertical_oscillation property

supports_vertical_oscillation: bool

Inherited From VeSyncFanBase

Return True if device supports vertical oscillation.

type instance-attribute

type: str | None = type

Inherited From VeSyncBaseDevice

uuid instance-attribute

uuid: str | None = uuid

Inherited From VeSyncBaseDevice

Functions

advanced_sleep_mode async deprecated

advanced_sleep_mode() -> bool

Inherited From VeSyncFanBase

Deprecated

Use set_advanced_sleep_mode method instead

Set advanced sleep mode.

Source code in src/pyvesync/base_devices/fan_base.py
@deprecated('Use `set_advanced_sleep_mode` method instead')
async def advanced_sleep_mode(self) -> bool:
    """Set advanced sleep mode."""
    return await self.set_mode('advancedSleep')

clear_timer async

clear_timer() -> bool

Inherited From VeSyncBaseDevice

Clear timer for device from API.

This may not be implemented for all devices. Please open an issue if there is an error.

Returns:

Name Type Description
bool bool

True if successful, False otherwise.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
async def clear_timer(self) -> bool:
    """Clear timer for device from API.

    This may not be implemented for all devices. Please open an issue
    if there is an error.

    Returns:
        bool: True if successful, False otherwise.
    """
    logger.debug('Not implemented - clear_timer')
    return False

display

display(state: bool = True) -> None

Inherited From VeSyncBaseDevice

Print formatted static device info to stdout.

Parameters:

Name Type Description Default
state bool

If True, include state in display, defaults to True.

True

Example:

Device Name:..................Living Room Lamp
Model:........................ESL100
Subdevice No:.................0
Type:.........................wifi
CID:..........................1234567890abcdef

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
def display(self, state: bool = True) -> None:
    """Print formatted static device info to stdout.

    Args:
        state (bool): If True, include state in display, defaults to True.

    Example:
    ```
    Device Name:..................Living Room Lamp
    Model:........................ESL100
    Subdevice No:.................0
    Type:.........................wifi
    CID:..........................1234567890abcdef
    ```
    """
    # noinspection SpellCheckingInspection
    display_list = [
        ('Device Name:', self.device_name),
        ('Product Type: ', self.product_type),
        ('Model: ', self.device_type),
        ('Subdevice No: ', str(self.sub_device_no)),
        ('Type: ', self.type),
        ('CID: ', self.cid),
        ('Config Module: ', self.config_module),
        ('Connection Type: ', self.connection_type),
        ('Features', self.features),
        ('Last Response: ', self.last_response),
    ]
    if self.uuid is not None:
        display_list.append(('UUID: ', self.uuid))

    for line in display_list:
        print(f'{line[0]:.<30} {line[1]}')  # noqa: T201
    if state:
        self.state.display()

get_details abstractmethod async

get_details() -> None

Inherited From VeSyncBaseDevice

Get device details.

This method is defined in each device class to contain the logic to pull the device state from the API and update the device's state attribute. The update() method should be called to update the device state.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
@abstractmethod
async def get_details(self) -> None:
    """Get device details.

    This method is defined in each device class to contain
    the logic to pull the device state from the API and update
    the device's `state` attribute. The `update()` method should
    be called to update the device state.
    """

get_state

get_state(state_attr: str) -> Any

Inherited From VeSyncBaseDevice

Get device state attribute.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
def get_state(self, state_attr: str) -> Any:  # noqa: ANN401
    """Get device state attribute."""
    return getattr(self.state, state_attr)

get_timer async

get_timer() -> Timer | None

Inherited From VeSyncBaseDevice

Get timer for device from API and set the state.Timer attribute.

This may not be implemented for all devices. Please open an issue if there is an error.

Note

This method may not be implemented for all devices. Please open an issue if there is an error.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
async def get_timer(self) -> Timer | None:
    """Get timer for device from API and set the `state.Timer` attribute.

    This may not be implemented for all devices. Please open an issue
    if there is an error.

    Note:
        This method may not be implemented for all devices. Please
        open an issue if there is an error.
    """
    logger.debug('Not implemented - get_timer')
    return None

manual_mode async deprecated

manual_mode() -> bool

Inherited From VeSyncFanBase

Deprecated

Use set_manual_mode method instead

Adapter to set mode to normal.

Source code in src/pyvesync/base_devices/fan_base.py
@deprecated('Use `set_manual_mode` method instead')
async def manual_mode(self) -> bool:
    """Adapter to set mode to normal."""
    return await self.set_normal_mode()

mode_toggle async deprecated

mode_toggle(mode: str) -> bool

Inherited From VeSyncFanBase

Deprecated

Use set_mode method instead

Set mode to specified mode.

Source code in src/pyvesync/base_devices/fan_base.py
@deprecated('Use `set_mode` method instead')
async def mode_toggle(self, mode: str) -> bool:
    """Set mode to specified mode."""
    return await self.set_mode(mode)

normal_mode async deprecated

normal_mode() -> bool

Inherited From VeSyncFanBase

Deprecated

Use set_normal_mode method instead

Set mode to normal.

Source code in src/pyvesync/base_devices/fan_base.py
@deprecated('Use `set_normal_mode` method instead')
async def normal_mode(self) -> bool:
    """Set mode to normal."""
    return await self.set_normal_mode()

set_advanced_sleep_mode async

set_advanced_sleep_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Advanced Sleep Mode.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

Source code in src/pyvesync/base_devices/fan_base.py
async def set_advanced_sleep_mode(self) -> bool:
    """Set Fan to Advanced Sleep Mode.

    Returns:
        bool: Success of request.

    Note:
        This method is not supported by all devices, will return
        false with warning debug message if not supported.
    """
    if FanModes.ADVANCED_SLEEP in self.modes:
        return await self.set_mode(FanModes.ADVANCED_SLEEP)
    logger.warning('Advanced Sleep mode not supported for this device.')
    return False

set_auto_mode async

set_auto_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Auto Mode.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

Source code in src/pyvesync/base_devices/fan_base.py
async def set_auto_mode(self) -> bool:
    """Set Fan to Auto Mode.

    Returns:
        bool: Success of request.

    Note:
        This method is not supported by all devices, will return
        false with warning debug message if not supported.
    """
    if FanModes.AUTO in self.modes:
        return await self.set_mode(FanModes.AUTO)
    logger.warning('Auto mode not supported for this device.')
    return False

set_fan_speed abstractmethod async

set_fan_speed(speed: int | None = None) -> bool

Inherited From VeSyncFanBase

Set Fan Fan Speed.

Parameters:

Name Type Description Default
speed int

Fan speed level according to device specs.

None

Returns:

Name Type Description
bool bool

Success of request.

Source code in src/pyvesync/base_devices/fan_base.py
@abstractmethod
async def set_fan_speed(self, speed: int | None = None) -> bool:
    """Set Fan Fan Speed.

    Args:
        speed (int, optional): Fan speed level according to device specs.

    Returns:
        bool: Success of request.
    """

set_horizontal_oscillation_range async

set_horizontal_oscillation_range(
    *, left: int = 0, right: int = 0
) -> bool

Inherited From VeSyncFanBase

Set Horizontal Oscillation Range.

Parameters:

Name Type Description Default
left int

Left range.

0
right int

Right range.

0

Returns:

Name Type Description
bool bool

true if success.

Source code in src/pyvesync/base_devices/fan_base.py
async def set_horizontal_oscillation_range(
    self, *, left: int = 0, right: int = 0
) -> bool:
    """Set Horizontal Oscillation Range.

    Args:
        left (int): Left range.
        right (int): Right range.

    Returns:
        bool: true if success.
    """
    del left, right
    if self.supports_set_oscillation_range:
        logger.debug('Horizontal oscillation range not configured for this device.')
    else:
        logger.debug('Horizontal oscillation range not supported for this device.')
    return False

set_manual_mode async

set_manual_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Manual Mode - Normal Mode.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

Source code in src/pyvesync/base_devices/fan_base.py
async def set_manual_mode(self) -> bool:
    """Set Fan to Manual Mode - Normal Mode.

    Returns:
        bool: Success of request.

    Note:
        This method is not supported by all devices, will return
        false with warning debug message if not supported.
    """
    if FanModes.NORMAL in self.modes:
        return await self.set_mode(FanModes.NORMAL)
    logger.warning('Manual mode not supported for this device.')
    return False

set_mode abstractmethod async

set_mode(mode: str) -> bool

Inherited From VeSyncFanBase

Set Fan Mode.

Parameters:

Name Type Description Default
mode str

Mode to set, varies by device type.

required

Returns:

Name Type Description
bool bool

Success of request.

Source code in src/pyvesync/base_devices/fan_base.py
@abstractmethod
async def set_mode(self, mode: str) -> bool:
    """Set Fan Mode.

    Args:
        mode (str): Mode to set, varies by device type.

    Returns:
        bool: Success of request.
    """

set_normal_mode async

set_normal_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Normal Mode.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

Source code in src/pyvesync/base_devices/fan_base.py
async def set_normal_mode(self) -> bool:
    """Set Fan to Normal Mode.

    Returns:
        bool: Success of request.

    Note:
        This method is not supported by all devices, will return
        false with warning debug message if not supported.
    """
    if FanModes.NORMAL in self.modes:
        return await self.set_mode(FanModes.NORMAL)
    logger.warning('Normal mode not supported for this device.')
    return False

set_sleep_mode async

set_sleep_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Sleep Mode.

This is also referred to as Advanced Sleep Mode on some devices.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

Source code in src/pyvesync/base_devices/fan_base.py
async def set_sleep_mode(self) -> bool:
    """Set Fan to Sleep Mode.

    This is also referred to as Advanced Sleep Mode on some devices.

    Returns:
        bool: Success of request.

    Note:
        This method is not supported by all devices, will return
        false with warning debug message if not supported.
    """
    if FanModes.ADVANCED_SLEEP in self.modes:
        return await self.set_mode(FanModes.ADVANCED_SLEEP)
    logger.warning('Sleep mode not supported for this device.')
    return False

set_state

set_state(state_attr: str, stat_value: Any) -> None

Inherited From VeSyncBaseDevice

Set device state attribute.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
def set_state(self, state_attr: str, stat_value: Any) -> None:  # noqa: ANN401
    """Set device state attribute."""
    setattr(self, state_attr, stat_value)

set_timer async

set_timer(duration: int, action: str | None = None) -> bool

Inherited From VeSyncBaseDevice

Set timer for device.

This may not be implemented for all devices. Please open an issue if there is an error.

Parameters:

Name Type Description Default
duration int

Duration in seconds.

required
action str | None

Action to take when timer expires.

None

Returns:

Name Type Description
bool bool

True if successful, False otherwise.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
async def set_timer(self, duration: int, action: str | None = None) -> bool:
    """Set timer for device.

    This may not be implemented for all devices. Please open an issue
    if there is an error.

    Args:
        duration (int): Duration in seconds.
        action (str | None): Action to take when timer expires.

    Returns:
        bool: True if successful, False otherwise.
    """
    del duration
    del action
    logger.debug('Not implemented - set_timer')
    return False

set_turbo_mode async

set_turbo_mode() -> bool

Inherited From VeSyncFanBase

Set Fan to Turbo Mode.

Returns:

Name Type Description
bool bool

Success of request.

Note

This method is not supported by all devices, will return false with warning debug message if not supported.

Source code in src/pyvesync/base_devices/fan_base.py
async def set_turbo_mode(self) -> bool:
    """Set Fan to Turbo Mode.

    Returns:
        bool: Success of request.

    Note:
        This method is not supported by all devices, will return
        false with warning debug message if not supported.
    """
    if FanModes.TURBO in self.modes:
        return await self.set_mode(FanModes.TURBO)
    logger.warning('Turbo mode not supported for this device.')
    return False

set_vertical_oscillation_range async

set_vertical_oscillation_range(
    *, top: int = 0, bottom: int = 0
) -> bool

Inherited From VeSyncFanBase

Set Vertical Oscillation Range.

Parameters:

Name Type Description Default
top int

Top range.

0
bottom int

Bottom range.

0

Returns:

Name Type Description
bool bool

true if success.

Source code in src/pyvesync/base_devices/fan_base.py
async def set_vertical_oscillation_range(
    self, *, top: int = 0, bottom: int = 0
) -> bool:
    """Set Vertical Oscillation Range.

    Args:
        top (int): Top range.
        bottom (int): Bottom range.

    Returns:
        bool: true if success.
    """
    del top, bottom
    if self.supports_set_oscillation_range:
        logger.debug('Vertical oscillation range not configured for this device.')
    else:
        logger.debug('Vertical oscillation range not supported for this device.')
    return False

sleep_mode async deprecated

sleep_mode() -> bool

Inherited From VeSyncFanBase

Deprecated

Use set_sleep_mode method instead

Adapter to set advanced sleep mode.

Source code in src/pyvesync/base_devices/fan_base.py
@deprecated('Use `set_sleep_mode` method instead')
async def sleep_mode(self) -> bool:
    """Adapter to set advanced sleep mode."""
    return await self.set_advanced_sleep_mode()

to_dict

to_dict(state: bool = True) -> dict[str, Any]

Inherited From VeSyncBaseDevice

Return device information as a dictionary.

Parameters:

Name Type Description Default
state bool

If True, include state in dictionary, defaults to True.

True

Returns:

Type Description
dict[str, Any]

dict[str, Any]: Dictionary containing device information.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
def to_dict(self, state: bool = True) -> dict[str, Any]:
    """Return device information as a dictionary.

    Args:
        state (bool): If True, include state in dictionary, defaults to True.

    Returns:
        dict[str, Any]: Dictionary containing device information.
    """
    device_dict = {
        'device_name': self.device_name,
        'product_type': self.product_type,
        'model': self.device_type,
        'subdevice_no': str(self.sub_device_no),
        'type': self.type,
        'cid': self.cid,
        'features:': self.features,
        'config_module': self.config_module,
        'connection_type': self.connection_type,
        'last_response': self.last_response,
    }
    state_dict = self.state.to_dict() if state else {}
    return device_dict | state_dict

to_json

to_json(state: bool = True, indent: bool = True) -> str

Inherited From VeSyncBaseDevice

Print JSON API string for device details.

Parameters:

Name Type Description Default
state bool

If True, include state in JSON output, defaults to True.

True
indent bool

If True, indent JSON output, defaults to True.

True

Returns:

Name Type Description
str str

JSON formatted string of device details.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
def to_json(self, state: bool = True, indent: bool = True) -> str:
    """Print JSON API string for device details.

    Args:
        state (bool): If True, include state in JSON output, defaults to True.
        indent (bool): If True, indent JSON output, defaults to True.

    Returns:
        str: JSON formatted string of device details.
    """
    return self.to_jsonb(state, indent).decode()

to_jsonb

to_jsonb(state: bool = True, indent: bool = True) -> bytes

Inherited From VeSyncBaseDevice

JSON API bytes for device details.

Parameters:

Name Type Description Default
state bool

If True, include state in JSON output, defaults to True.

True
indent bool

If True, indent JSON output, defaults to True.

True

Returns:

Name Type Description
bytes bytes

JSON formatted bytes of device details.

Example

This is an example without state.

{
    "Device Name": "Living Room Lamp",
    "Model": "ESL100",
    "Subdevice No": "0",
    "Type": "wifi",
    "CID": "1234567890abcdef"
}

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
def to_jsonb(self, state: bool = True, indent: bool = True) -> bytes:
    """JSON API bytes for device details.

    Args:
        state (bool): If True, include state in JSON output, defaults to True.
        indent (bool): If True, indent JSON output, defaults to True.

    Returns:
        bytes: JSON formatted bytes of device details.

    Example:
        This is an example without state.
        ```
        {
            "Device Name": "Living Room Lamp",
            "Model": "ESL100",
            "Subdevice No": "0",
            "Type": "wifi",
            "CID": "1234567890abcdef"
        }
        ```
    """
    return_dict = self.to_dict(state=state)
    if indent:
        return orjson.dumps(
            return_dict,
            option=orjson.OPT_INDENT_2 | orjson.OPT_NON_STR_KEYS,
        )

    return orjson.dumps(return_dict, option=orjson.OPT_NON_STR_KEYS)

toggle_display async

toggle_display(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle Display on/off.

Parameters:

Name Type Description Default
toggle bool

Display state.

required

Returns:

Name Type Description
bool bool

Success of request.

Source code in src/pyvesync/base_devices/fan_base.py
async def toggle_display(self, toggle: bool) -> bool:
    """Toggle Display on/off.

    Args:
        toggle (bool): Display state.

    Returns:
        bool: Success of request.
    """
    del toggle
    return False

toggle_displaying_type async

toggle_displaying_type(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle displaying type on/off.

This functionality is unknown but was in the API calls.

Parameters:

Name Type Description Default
toggle bool

Displaying type state.

required

Returns:

Name Type Description
bool bool

true if success.

Source code in src/pyvesync/base_devices/fan_base.py
async def toggle_displaying_type(self, toggle: bool) -> bool:
    """Toggle displaying type on/off.

    This functionality is unknown but was in the API calls.

    Args:
        toggle (bool): Displaying type state.

    Returns:
        bool: true if success.
    """
    del toggle
    if self.supports_displaying_type:
        logger.debug('Displaying type not configured for this device.')
    else:
        logger.debug('Displaying type not supported for this device.')
    return False

toggle_horizontal_oscillation async

toggle_horizontal_oscillation(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle Horizontal Oscillation on/off.

Parameters:

Name Type Description Default
toggle bool

Horizontal Oscillation state.

required

Returns:

Name Type Description
bool bool

true if success.

Source code in src/pyvesync/base_devices/fan_base.py
async def toggle_horizontal_oscillation(self, toggle: bool) -> bool:
    """Toggle Horizontal Oscillation on/off.

    Args:
        toggle (bool): Horizontal Oscillation state.

    Returns:
        bool: true if success.
    """
    del toggle
    if self.supports_horizontal_oscillation:
        logger.debug('Horizontal Oscillation not configured for this device.')
    else:
        logger.debug('Horizontal Oscillation not supported for this device.')
    return False

toggle_mute async

toggle_mute(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle mute on/off.

Parameters:

Name Type Description Default
toggle bool

True to turn mute on, False to turn off

required

Returns:

Name Type Description
bool bool

True if successful, False if not

Source code in src/pyvesync/base_devices/fan_base.py
async def toggle_mute(self, toggle: bool) -> bool:
    """Toggle mute on/off.

    Parameters:
        toggle (bool): True to turn mute on, False to turn off

    Returns:
        bool : True if successful, False if not
    """
    del toggle
    if self.supports_mute:
        logger.debug('Mute not configured for this device.')
    else:
        logger.debug('Mute not supported for this device.')
    return False

toggle_oscillation async

toggle_oscillation(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle Oscillation on/off.

Parameters:

Name Type Description Default
toggle bool

Oscillation state.

required

Returns:

Name Type Description
bool bool

true if success.

Source code in src/pyvesync/base_devices/fan_base.py
async def toggle_oscillation(self, toggle: bool) -> bool:
    """Toggle Oscillation on/off.

    Args:
        toggle (bool): Oscillation state.

    Returns:
        bool: true if success.
    """
    del toggle
    if self.supports_oscillation:
        logger.debug('Oscillation not configured for this device.')
    else:
        logger.debug('Oscillation not supported for this device.')
    return False

toggle_switch abstractmethod async

toggle_switch(toggle: bool | None = None) -> bool

Inherited From VeSyncBaseToggleDevice

Toggle device power on or off.

Parameters:

Name Type Description Default
toggle bool | None

True to turn on, False to turn off, None to toggle.

None

Returns:

Name Type Description
bool bool

True if successful, False otherwise.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
@abstractmethod
async def toggle_switch(self, toggle: bool | None = None) -> bool:
    """Toggle device power on or off.

    Args:
        toggle (bool | None): True to turn on, False to turn off, None to toggle.

    Returns:
        bool: True if successful, False otherwise.
    """

toggle_vertical_oscillation async

toggle_vertical_oscillation(toggle: bool) -> bool

Inherited From VeSyncFanBase

Toggle Vertical Oscillation on/off.

Parameters:

Name Type Description Default
toggle bool

Vertical Oscillation state.

required

Returns:

Name Type Description
bool bool

true if success.

Source code in src/pyvesync/base_devices/fan_base.py
async def toggle_vertical_oscillation(self, toggle: bool) -> bool:
    """Toggle Vertical Oscillation on/off.

    Args:
        toggle (bool): Vertical Oscillation state.

    Returns:
        bool: true if success.
    """
    del toggle
    if self.supports_vertical_oscillation:
        logger.debug('Vertical Oscillation not configured for this device.')
    else:
        logger.debug('Vertical Oscillation not supported for this device.')
    return False

turn_off async

turn_off() -> bool

Inherited From VeSyncBaseToggleDevice

Turn device off.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
async def turn_off(self) -> bool:
    """Turn device off."""
    return await self.toggle_switch(False)

turn_off_display async

turn_off_display() -> bool

Inherited From VeSyncFanBase

Turn off Display.

Returns:

Name Type Description
bool bool

Success of request

Source code in src/pyvesync/base_devices/fan_base.py
async def turn_off_display(self) -> bool:
    """Turn off Display.

    Returns:
        bool: Success of request
    """
    return await self.toggle_display(False)

turn_off_horizontal_oscillation async

turn_off_horizontal_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_horizontal_oscillation to off.

Source code in src/pyvesync/base_devices/fan_base.py
async def turn_off_horizontal_oscillation(self) -> bool:
    """Set toggle_horizontal_oscillation to off."""
    return await self.toggle_horizontal_oscillation(False)

turn_off_mute async

turn_off_mute() -> bool

Inherited From VeSyncFanBase

Set toggle_mute to off.

Source code in src/pyvesync/base_devices/fan_base.py
async def turn_off_mute(self) -> bool:
    """Set toggle_mute to off."""
    return await self.toggle_mute(False)

turn_off_oscillation async

turn_off_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_oscillation to off.

Source code in src/pyvesync/base_devices/fan_base.py
async def turn_off_oscillation(self) -> bool:
    """Set toggle_oscillation to off."""
    return await self.toggle_oscillation(False)

turn_off_vertical_oscillation async

turn_off_vertical_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_vertical_oscillation to off.

Source code in src/pyvesync/base_devices/fan_base.py
async def turn_off_vertical_oscillation(self) -> bool:
    """Set toggle_vertical_oscillation to off."""
    return await self.toggle_vertical_oscillation(False)

turn_on async

turn_on() -> bool

Inherited From VeSyncBaseToggleDevice

Turn device on.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
async def turn_on(self) -> bool:
    """Turn device on."""
    return await self.toggle_switch(True)

turn_on_display async

turn_on_display() -> bool

Inherited From VeSyncFanBase

Turn on Display.

Returns:

Name Type Description
bool bool

Success of request

Source code in src/pyvesync/base_devices/fan_base.py
async def turn_on_display(self) -> bool:
    """Turn on Display.

    Returns:
        bool: Success of request
    """
    return await self.toggle_display(True)

turn_on_horizontal_oscillation async

turn_on_horizontal_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_horizontal_oscillation to on.

Source code in src/pyvesync/base_devices/fan_base.py
async def turn_on_horizontal_oscillation(self) -> bool:
    """Set toggle_horizontal_oscillation to on."""
    return await self.toggle_horizontal_oscillation(True)

turn_on_mute async

turn_on_mute() -> bool

Inherited From VeSyncFanBase

Set toggle_mute to on.

Source code in src/pyvesync/base_devices/fan_base.py
async def turn_on_mute(self) -> bool:
    """Set toggle_mute to on."""
    return await self.toggle_mute(True)

turn_on_oscillation async

turn_on_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_oscillation to on.

Source code in src/pyvesync/base_devices/fan_base.py
async def turn_on_oscillation(self) -> bool:
    """Set toggle_oscillation to on."""
    return await self.toggle_oscillation(True)

turn_on_vertical_oscillation async

turn_on_vertical_oscillation() -> bool

Inherited From VeSyncFanBase

Set toggle_vertical_oscillation to on.

Source code in src/pyvesync/base_devices/fan_base.py
async def turn_on_vertical_oscillation(self) -> bool:
    """Set toggle_vertical_oscillation to on."""
    return await self.toggle_vertical_oscillation(True)

update async

update() -> None

Inherited From VeSyncBaseDevice

Update device details.

Source code in src/pyvesync/base_devices/vesyncbasedevice.py
async def update(self) -> None:
    """Update device details."""
    await self.get_details()