Skip to content

VeSync Thermostats

pyvesync.devices.vesyncthermostat

Thermostat device classes.

pyvesync.base_devices.thermostat_base.ThermostatState

Bases: DeviceState

VeSync Thermostat State.

Parameters:

Name Type Description Default
device VeSyncThermostat

The thermostat device.

required
details ResponseDeviceDetailsModel

The thermostat device details.

required
feature_map ThermostatMap

The thermostat feature map.

required
Source code in src\pyvesync\base_devices\thermostat_base.py
class ThermostatState(DeviceState):
    """VeSync Thermostat State.

    Args:
        device (VeSyncThermostat): The thermostat device.
        details (ResponseDeviceDetailsModel): The thermostat device details.
        feature_map (ThermostatMap): The thermostat feature map.
    """
    __slots__ = (
        "alert_status",
        "configuration",
        "cool_to_temp",
        "deadband",
        "device_config",
        "eco_type",
        "fan_mode",
        "fan_status",
        "heat_to_temp",
        "hold_end_time",
        "hold_option",
        "humidity",
        "lock_status",
        "mode",
        "routine_running_id",
        "routines",
        "schedule_or_hold",
        "temperature",
        "temperature_unit",
        "work_mode",
        "work_status",
    )

    def __init__(
        self,
        device: VeSyncThermostat,
        details: ResponseDeviceDetailsModel,
        feature_map: ThermostatMap,
    ) -> None:
        """Initialize VeSync Thermostat State."""
        super().__init__(device, details, feature_map)
        self.device: VeSyncThermostat = device
        self.configuration: ThermostatMinorDetails | None = None
        self.work_mode: ThermostatWorkModes | None = None
        self.work_status: ThermostatWorkStatusCodes | None = None
        self.fan_mode: ThermostatFanModes | None = None
        self.fan_status: ThermostatFanStatus | None = None
        self.temperature_unit: str | None = None
        self.temperature: float | None = None
        self.humidity: int | None = None
        self.heat_to_temp: int | None = None
        self.cool_to_temp: int | None = None
        self.lock_status: bool = False
        self.schedule_or_hold: ThermostatScheduleOrHoldOptions | None = None
        self.hold_end_time: int | None = None
        self.hold_option: ThermostatHoldOptions | None = None
        self.deadband: int | None = None
        self.eco_type: ThermostatEcoTypes | None = None
        self.alert_status: int | None = None
        self.routines: list[ThermostatSimpleRoutine] = []
        self.routine_running_id: int | None = None

    @property
    def is_running(self) -> bool:
        """Check if the thermostat is running."""
        return self.work_status != ThermostatWorkStatusCodes.OFF

    @property
    def is_heating(self) -> bool:
        """Check if the thermostat is heating."""
        return self.work_status == ThermostatWorkStatusCodes.HEATING

    @property
    def is_cooling(self) -> bool:
        """Check if the thermostat is cooling."""
        return self.work_status == ThermostatWorkStatusCodes.COOLING

    @property
    def is_fan_on(self) -> bool:
        """Check if the fan is on."""
        return self.fan_status == ThermostatFanStatus.ON

device instance-attribute

device: VeSyncThermostat = device

Inherited From DeviceState

is_running property

is_running: bool

Check if the thermostat is running.

is_heating property

is_heating: bool

Check if the thermostat is heating.

is_cooling property

is_cooling: bool

Check if the thermostat is cooling.

is_fan_on property

is_fan_on: bool

Check if the fan is on.

pyvesync.base_devices.thermostat_base.VeSyncThermostat

Bases: VeSyncBaseDevice

Base class for VeSync Thermostat devices.

Parameters:

Name Type Description Default
details ResponseDeviceDetailsModel

The thermostat device details.

required
manager VeSync

The VeSync manager instance.

required
feature_map ThermostatMap

The thermostat feature map.

required
Source code in src\pyvesync\base_devices\thermostat_base.py
class VeSyncThermostat(VeSyncBaseDevice):
    """Base class for VeSync Thermostat devices.

    Args:
        details (ResponseDeviceDetailsModel): The thermostat device details.
        manager (VeSync): The VeSync manager instance.
        feature_map (ThermostatMap): The thermostat feature map.
    """

    __slots__ = ("eco_types", "fan_modes", "hold_options", "work_modes")

    def __init__(
        self,
        details: ResponseDeviceDetailsModel,
        manager: VeSync,
        feature_map: ThermostatMap,
    ) -> None:
        """Initialize VeSync Thermostat."""
        super().__init__(details, manager, feature_map)
        self.state: ThermostatState = ThermostatState(self, details, feature_map)
        self.fan_modes = feature_map.fan_modes
        self.work_modes = feature_map.modes
        self.eco_types = feature_map.eco_types
        self.hold_options = feature_map.hold_options

    async def set_mode(self, mode: ThermostatWorkModes) -> bool:
        """Set the thermostat mode."""
        del mode  # Unused
        _LOGGER.debug("set mode not implemented for %s", self.device_type)
        return False

    async def turn_off(self) -> bool:
        """Set mode to off."""
        return await self.set_mode(ThermostatWorkModes.OFF)

    async def set_mode_cool(self) -> bool:
        """Set mode to cool."""
        return await self.set_mode(ThermostatWorkModes.COOL)

    async def set_mode_heat(self) -> bool:
        """Set mode to heat."""
        return await self.set_mode(ThermostatWorkModes.HEAT)

    async def set_mode_auto(self) -> bool:
        """Set mode to auto."""
        return await self.set_mode(ThermostatWorkModes.AUTO)

    async def set_mode_smart_auto(self) -> bool:
        """Set mode to smart auto."""
        return await self.set_mode(ThermostatWorkModes.SMART_AUTO)

    async def set_mode_emergency_heat(self) -> bool:
        """Set mode to emergency heat."""
        return await self.set_mode(ThermostatWorkModes.EM_HEAT)

    async def set_fan_mode(self, mode: ThermostatFanModes) -> bool:
        """Set thermostat fan mode."""
        del mode
        _LOGGER.debug("set fan mode not implemented for %s", self.device_type)
        return False

    async def set_fan_ciruclate(self) -> bool:
        """Set fan circulate."""
        return await self.set_fan_mode(ThermostatConst.FanMode.CIRCULATE)

    async def set_fan_auto(self) -> bool:
        """Set fan auto."""
        return await self.set_fan_mode(ThermostatConst.FanMode.AUTO)

    async def set_fan_on(self) -> bool:
        """Set fan on."""
        return await self.set_fan_mode(ThermostatConst.FanMode.ON)

    async def get_configuration(self) -> None:
        """Retrieves configuration from API."""
        _LOGGER.debug("get configuration not implemented for %s", self.device_type)

    async def set_temp_point(self, temperature: float) -> bool:
        """Sets the temperature point."""
        del temperature
        _LOGGER.debug("set temp point not implemented for %s", self.device_type)
        return False

    async def cancel_hold(self) -> bool:
        """Cancels the scheduled hold."""
        _LOGGER.debug("cancel hold not implemented for %s", self.device_type)
        return False

    async def set_cool_to_temp(self, temperature: float) -> bool:
        """Sets the cool to temperature.

        Args:
            temperature (float): The cool to temperature.

        Returns:
            bool: True if successful, False otherwise.
        """
        del temperature
        _LOGGER.debug("set cool to temp not implemented for %s", self.device_type)
        return False

    async def set_heat_to_temp(self, temperature: float) -> bool:
        """Set the heat to temperature.

        Args:
            temperature (float): The heat to temperature.

        Returns:
            bool: True if successful, False otherwise.
        """
        del temperature
        _LOGGER.debug("set heat to temp not implemented for %s", self.device_type)
        return False

    async def toggle_lock(self, toggle: bool, pin: int | str | None = None) -> bool:
        """Toggle the thermostat lock status."""
        del toggle, pin
        _LOGGER.debug("toggle lock not implemented for %s", self.device_type)
        return False

    async def turn_on_lock(self, pin: int | str) -> bool:
        """Turn on the thermostat lock.

        Args:
            pin (int | str): The 4-digit PIN code.
        """
        return await self.toggle_lock(True, pin)

    async def turn_off_lock(self) -> bool:
        """Turn off the thermostat lock."""
        return await self.toggle_lock(False)

    async def set_eco_type(self, eco_type: ThermostatEcoTypes) -> bool:
        """Set thermostat eco type.

        Args:
            eco_type (ThermostatEcoTypes): The eco type to set, options are found in
                self.eco_types.

        Returns:
            bool: True if successful, False otherwise.
        """
        del eco_type
        if not self.eco_types:
            _LOGGER.debug("No eco types available for %s", self.device_type)
        else:
            _LOGGER.debug("set_eco_type not configured for %s", self.device_name)
        return False

    async def set_eco_first(self) -> bool:
        """Set eco first."""
        return await self.set_eco_type(ThermostatEcoTypes.ECO_FIRST)

    async def set_eco_second(self) -> bool:
        """Set eco second."""
        return await self.set_eco_type(ThermostatEcoTypes.ECO_SECOND)

    async def set_eco_comfort_first(self) -> bool:
        """Set eco comfort."""
        return await self.set_eco_type(ThermostatEcoTypes.COMFORT_FIRST)

    async def set_eco_comfort_second(self) -> bool:
        """Set eco comfort."""
        return await self.set_eco_type(ThermostatEcoTypes.COMFORT_SECOND)

state instance-attribute

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

Inherited From VeSyncBaseDevice

fan_modes instance-attribute

fan_modes = fan_modes

Inherited From VeSyncThermostat

work_modes instance-attribute

work_modes = modes

Inherited From VeSyncThermostat

eco_types instance-attribute

eco_types = eco_types

Inherited From VeSyncThermostat

hold_options instance-attribute

hold_options = hold_options

Inherited From VeSyncThermostat

set_mode async

set_mode(mode: ThermostatWorkModes) -> bool

Set the thermostat mode.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_mode(self, mode: ThermostatWorkModes) -> bool:
    """Set the thermostat mode."""
    del mode  # Unused
    _LOGGER.debug("set mode not implemented for %s", self.device_type)
    return False

turn_off async

turn_off() -> bool

Inherited From VeSyncThermostat

Set mode to off.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def turn_off(self) -> bool:
    """Set mode to off."""
    return await self.set_mode(ThermostatWorkModes.OFF)

set_mode_cool async

set_mode_cool() -> bool

Inherited From VeSyncThermostat

Set mode to cool.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_mode_cool(self) -> bool:
    """Set mode to cool."""
    return await self.set_mode(ThermostatWorkModes.COOL)

set_mode_heat async

set_mode_heat() -> bool

Inherited From VeSyncThermostat

Set mode to heat.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_mode_heat(self) -> bool:
    """Set mode to heat."""
    return await self.set_mode(ThermostatWorkModes.HEAT)

set_mode_auto async

set_mode_auto() -> bool

Inherited From VeSyncThermostat

Set mode to auto.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_mode_auto(self) -> bool:
    """Set mode to auto."""
    return await self.set_mode(ThermostatWorkModes.AUTO)

set_mode_smart_auto async

set_mode_smart_auto() -> bool

Inherited From VeSyncThermostat

Set mode to smart auto.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_mode_smart_auto(self) -> bool:
    """Set mode to smart auto."""
    return await self.set_mode(ThermostatWorkModes.SMART_AUTO)

set_mode_emergency_heat async

set_mode_emergency_heat() -> bool

Inherited From VeSyncThermostat

Set mode to emergency heat.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_mode_emergency_heat(self) -> bool:
    """Set mode to emergency heat."""
    return await self.set_mode(ThermostatWorkModes.EM_HEAT)

set_fan_mode async

set_fan_mode(mode: ThermostatFanModes) -> bool

Set thermostat fan mode.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_fan_mode(self, mode: ThermostatFanModes) -> bool:
    """Set thermostat fan mode."""
    del mode
    _LOGGER.debug("set fan mode not implemented for %s", self.device_type)
    return False

set_fan_ciruclate async

set_fan_ciruclate() -> bool

Inherited From VeSyncThermostat

Set fan circulate.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_fan_ciruclate(self) -> bool:
    """Set fan circulate."""
    return await self.set_fan_mode(ThermostatConst.FanMode.CIRCULATE)

set_fan_auto async

set_fan_auto() -> bool

Inherited From VeSyncThermostat

Set fan auto.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_fan_auto(self) -> bool:
    """Set fan auto."""
    return await self.set_fan_mode(ThermostatConst.FanMode.AUTO)

set_fan_on async

set_fan_on() -> bool

Inherited From VeSyncThermostat

Set fan on.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_fan_on(self) -> bool:
    """Set fan on."""
    return await self.set_fan_mode(ThermostatConst.FanMode.ON)

get_configuration async

get_configuration() -> None

Retrieves configuration from API.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def get_configuration(self) -> None:
    """Retrieves configuration from API."""
    _LOGGER.debug("get configuration not implemented for %s", self.device_type)

set_temp_point async

set_temp_point(temperature: float) -> bool

Sets the temperature point.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_temp_point(self, temperature: float) -> bool:
    """Sets the temperature point."""
    del temperature
    _LOGGER.debug("set temp point not implemented for %s", self.device_type)
    return False

cancel_hold async

cancel_hold() -> bool

Cancels the scheduled hold.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def cancel_hold(self) -> bool:
    """Cancels the scheduled hold."""
    _LOGGER.debug("cancel hold not implemented for %s", self.device_type)
    return False

set_cool_to_temp async

set_cool_to_temp(temperature: float) -> bool

Sets the cool to temperature.

Parameters:

Name Type Description Default
temperature float

The cool to temperature.

required

Returns:

Name Type Description
bool bool

True if successful, False otherwise.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_cool_to_temp(self, temperature: float) -> bool:
    """Sets the cool to temperature.

    Args:
        temperature (float): The cool to temperature.

    Returns:
        bool: True if successful, False otherwise.
    """
    del temperature
    _LOGGER.debug("set cool to temp not implemented for %s", self.device_type)
    return False

set_heat_to_temp async

set_heat_to_temp(temperature: float) -> bool

Set the heat to temperature.

Parameters:

Name Type Description Default
temperature float

The heat to temperature.

required

Returns:

Name Type Description
bool bool

True if successful, False otherwise.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_heat_to_temp(self, temperature: float) -> bool:
    """Set the heat to temperature.

    Args:
        temperature (float): The heat to temperature.

    Returns:
        bool: True if successful, False otherwise.
    """
    del temperature
    _LOGGER.debug("set heat to temp not implemented for %s", self.device_type)
    return False

toggle_lock async

toggle_lock(
    toggle: bool, pin: int | str | None = None
) -> bool

Toggle the thermostat lock status.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def toggle_lock(self, toggle: bool, pin: int | str | None = None) -> bool:
    """Toggle the thermostat lock status."""
    del toggle, pin
    _LOGGER.debug("toggle lock not implemented for %s", self.device_type)
    return False

turn_on_lock async

turn_on_lock(pin: int | str) -> bool

Inherited From VeSyncThermostat

Turn on the thermostat lock.

Parameters:

Name Type Description Default
pin int | str

The 4-digit PIN code.

required
Source code in src\pyvesync\base_devices\thermostat_base.py
async def turn_on_lock(self, pin: int | str) -> bool:
    """Turn on the thermostat lock.

    Args:
        pin (int | str): The 4-digit PIN code.
    """
    return await self.toggle_lock(True, pin)

turn_off_lock async

turn_off_lock() -> bool

Inherited From VeSyncThermostat

Turn off the thermostat lock.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def turn_off_lock(self) -> bool:
    """Turn off the thermostat lock."""
    return await self.toggle_lock(False)

set_eco_type async

set_eco_type(eco_type: ThermostatEcoTypes) -> bool

Set thermostat eco type.

Parameters:

Name Type Description Default
eco_type ThermostatEcoTypes

The eco type to set, options are found in self.eco_types.

required

Returns:

Name Type Description
bool bool

True if successful, False otherwise.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_eco_type(self, eco_type: ThermostatEcoTypes) -> bool:
    """Set thermostat eco type.

    Args:
        eco_type (ThermostatEcoTypes): The eco type to set, options are found in
            self.eco_types.

    Returns:
        bool: True if successful, False otherwise.
    """
    del eco_type
    if not self.eco_types:
        _LOGGER.debug("No eco types available for %s", self.device_type)
    else:
        _LOGGER.debug("set_eco_type not configured for %s", self.device_name)
    return False

set_eco_first async

set_eco_first() -> bool

Inherited From VeSyncThermostat

Set eco first.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_eco_first(self) -> bool:
    """Set eco first."""
    return await self.set_eco_type(ThermostatEcoTypes.ECO_FIRST)

set_eco_second async

set_eco_second() -> bool

Inherited From VeSyncThermostat

Set eco second.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_eco_second(self) -> bool:
    """Set eco second."""
    return await self.set_eco_type(ThermostatEcoTypes.ECO_SECOND)

set_eco_comfort_first async

set_eco_comfort_first() -> bool

Inherited From VeSyncThermostat

Set eco comfort.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_eco_comfort_first(self) -> bool:
    """Set eco comfort."""
    return await self.set_eco_type(ThermostatEcoTypes.COMFORT_FIRST)

set_eco_comfort_second async

set_eco_comfort_second() -> bool

Inherited From VeSyncThermostat

Set eco comfort.

Source code in src\pyvesync\base_devices\thermostat_base.py
async def set_eco_comfort_second(self) -> bool:
    """Set eco comfort."""
    return await self.set_eco_type(ThermostatEcoTypes.COMFORT_SECOND)