google_nest_sdm.thermostat_traits
Traits for thermostats.
1"""Traits for thermostats.""" 2 3from __future__ import annotations 4 5from dataclasses import dataclass, field 6from typing import Final, ClassVar 7 8import aiohttp 9from mashumaro import field_options, DataClassDictMixin 10 11from .traits import CommandDataClass, TraitType 12 13__all__ = [ 14 "ThermostatEcoTrait", 15 "ThermostatHvacTrait", 16 "ThermostatModeTrait", 17 "ThermostatTemperatureSetpointTrait", 18] 19 20STATUS: Final = "status" 21AVAILABLE_MODES: Final = "availableModes" 22MODE: Final = "mode" 23 24 25@dataclass 26class ThermostatEcoTrait(DataClassDictMixin, CommandDataClass): 27 """This trait belongs to any device that has a sensor to measure temperature.""" 28 29 NAME: ClassVar[TraitType] = TraitType.THERMOSTAT_ECO 30 31 available_modes: list[str] = field( 32 metadata=field_options(alias="availableModes"), default_factory=list 33 ) 34 """List of supported Eco modes.""" 35 36 mode: str = field(metadata=field_options(alias="mode"), default="OFF") 37 """Eco mode of the thermostat.""" 38 39 heat_celsius: float | None = field( 40 metadata=field_options(alias="heatCelsius"), default=None 41 ) 42 """Lowest temperature where thermostat begins heating.""" 43 44 cool_celsius: float | None = field( 45 metadata=field_options(alias="coolCelsius"), default=None 46 ) 47 """Highest cooling temperature where thermostat begins cooling.""" 48 49 async def set_mode(self, mode: str) -> aiohttp.ClientResponse: 50 """Change the thermostat Eco mode.""" 51 data = { 52 "command": "sdm.devices.commands.ThermostatEco.SetMode", 53 "params": {"mode": mode}, 54 } 55 return await self.cmd.execute(data) 56 57 58@dataclass 59class ThermostatHvacTrait: 60 """This trait belongs to devices that can report HVAC details.""" 61 62 NAME: ClassVar[TraitType] = TraitType.THERMOSTAT_HVAC 63 64 status: str 65 """HVAC status of the thermostat.""" 66 67 68@dataclass 69class ThermostatModeTrait(DataClassDictMixin, CommandDataClass): 70 """This trait belongs to devices that support different thermostat modes.""" 71 72 NAME: ClassVar[TraitType] = TraitType.THERMOSTAT_MODE 73 74 available_modes: list[str] = field(metadata=field_options(alias="availableModes")) 75 """List of supported thermostat modes.""" 76 77 mode: str = field(metadata=field_options(alias="mode")) 78 """Mode of the thermostat.""" 79 80 async def set_mode(self, mode: str) -> aiohttp.ClientResponse: 81 """Change the thermostat Eco mode.""" 82 data = { 83 "command": "sdm.devices.commands.ThermostatMode.SetMode", 84 "params": {"mode": mode}, 85 } 86 return await self.cmd.execute(data) 87 88 89@dataclass 90class ThermostatTemperatureSetpointTrait(DataClassDictMixin, CommandDataClass): 91 """This trait belongs to devices that support setting target temperature.""" 92 93 NAME: ClassVar[TraitType] = TraitType.THERMOSTAT_TEMPERATURE_SETPOINT 94 95 heat_celsius: float | None = field( 96 metadata=field_options(alias="heatCelsius"), default=None 97 ) 98 """Lowest temperature where thermostat begins heating.""" 99 100 cool_celsius: float | None = field( 101 metadata=field_options(alias="coolCelsius"), default=None 102 ) 103 """Highest cooling temperature where thermostat begins cooling.""" 104 105 async def set_heat(self, heat: float) -> aiohttp.ClientResponse: 106 """Change the thermostat Eco mode.""" 107 data = { 108 "command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetHeat", 109 "params": {"heatCelsius": heat}, 110 } 111 return await self.cmd.execute(data) 112 113 async def set_cool(self, cool: float) -> aiohttp.ClientResponse: 114 """Change the thermostat Eco mode.""" 115 data = { 116 "command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetCool", 117 "params": {"coolCelsius": cool}, 118 } 119 return await self.cmd.execute(data) 120 121 async def set_range(self, heat: float, cool: float) -> aiohttp.ClientResponse: 122 """Change the thermostat Eco mode.""" 123 data = { 124 "command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetRange", 125 "params": { 126 "heatCelsius": heat, 127 "coolCelsius": cool, 128 }, 129 } 130 return await self.cmd.execute(data)
@dataclass
class
ThermostatEcoTrait26@dataclass 27class ThermostatEcoTrait(DataClassDictMixin, CommandDataClass): 28 """This trait belongs to any device that has a sensor to measure temperature.""" 29 30 NAME: ClassVar[TraitType] = TraitType.THERMOSTAT_ECO 31 32 available_modes: list[str] = field( 33 metadata=field_options(alias="availableModes"), default_factory=list 34 ) 35 """List of supported Eco modes.""" 36 37 mode: str = field(metadata=field_options(alias="mode"), default="OFF") 38 """Eco mode of the thermostat.""" 39 40 heat_celsius: float | None = field( 41 metadata=field_options(alias="heatCelsius"), default=None 42 ) 43 """Lowest temperature where thermostat begins heating.""" 44 45 cool_celsius: float | None = field( 46 metadata=field_options(alias="coolCelsius"), default=None 47 ) 48 """Highest cooling temperature where thermostat begins cooling.""" 49 50 async def set_mode(self, mode: str) -> aiohttp.ClientResponse: 51 """Change the thermostat Eco mode.""" 52 data = { 53 "command": "sdm.devices.commands.ThermostatEco.SetMode", 54 "params": {"mode": mode}, 55 } 56 return await self.cmd.execute(data)
This trait belongs to any device that has a sensor to measure temperature.
ThermostatEcoTrait( available_modes: list[str] = <factory>, mode: str = 'OFF', heat_celsius: float | None = None, cool_celsius: float | None = None)
NAME: ClassVar[google_nest_sdm.traits.TraitType] =
<TraitType.THERMOSTAT_ECO: 'sdm.devices.traits.ThermostatEco'>
async def
set_mode(self, mode: str) -> aiohttp.client_reqrep.ClientResponse:
50 async def set_mode(self, mode: str) -> aiohttp.ClientResponse: 51 """Change the thermostat Eco mode.""" 52 data = { 53 "command": "sdm.devices.commands.ThermostatEco.SetMode", 54 "params": {"mode": mode}, 55 } 56 return await self.cmd.execute(data)
Change the thermostat Eco mode.
@dataclass
class
ThermostatHvacTrait:
59@dataclass 60class ThermostatHvacTrait: 61 """This trait belongs to devices that can report HVAC details.""" 62 63 NAME: ClassVar[TraitType] = TraitType.THERMOSTAT_HVAC 64 65 status: str 66 """HVAC status of the thermostat."""
This trait belongs to devices that can report HVAC details.
@dataclass
class
ThermostatModeTrait69@dataclass 70class ThermostatModeTrait(DataClassDictMixin, CommandDataClass): 71 """This trait belongs to devices that support different thermostat modes.""" 72 73 NAME: ClassVar[TraitType] = TraitType.THERMOSTAT_MODE 74 75 available_modes: list[str] = field(metadata=field_options(alias="availableModes")) 76 """List of supported thermostat modes.""" 77 78 mode: str = field(metadata=field_options(alias="mode")) 79 """Mode of the thermostat.""" 80 81 async def set_mode(self, mode: str) -> aiohttp.ClientResponse: 82 """Change the thermostat Eco mode.""" 83 data = { 84 "command": "sdm.devices.commands.ThermostatMode.SetMode", 85 "params": {"mode": mode}, 86 } 87 return await self.cmd.execute(data)
This trait belongs to devices that support different thermostat modes.
NAME: ClassVar[google_nest_sdm.traits.TraitType] =
<TraitType.THERMOSTAT_MODE: 'sdm.devices.traits.ThermostatMode'>
async def
set_mode(self, mode: str) -> aiohttp.client_reqrep.ClientResponse:
81 async def set_mode(self, mode: str) -> aiohttp.ClientResponse: 82 """Change the thermostat Eco mode.""" 83 data = { 84 "command": "sdm.devices.commands.ThermostatMode.SetMode", 85 "params": {"mode": mode}, 86 } 87 return await self.cmd.execute(data)
Change the thermostat Eco mode.
@dataclass
class
ThermostatTemperatureSetpointTrait90@dataclass 91class ThermostatTemperatureSetpointTrait(DataClassDictMixin, CommandDataClass): 92 """This trait belongs to devices that support setting target temperature.""" 93 94 NAME: ClassVar[TraitType] = TraitType.THERMOSTAT_TEMPERATURE_SETPOINT 95 96 heat_celsius: float | None = field( 97 metadata=field_options(alias="heatCelsius"), default=None 98 ) 99 """Lowest temperature where thermostat begins heating.""" 100 101 cool_celsius: float | None = field( 102 metadata=field_options(alias="coolCelsius"), default=None 103 ) 104 """Highest cooling temperature where thermostat begins cooling.""" 105 106 async def set_heat(self, heat: float) -> aiohttp.ClientResponse: 107 """Change the thermostat Eco mode.""" 108 data = { 109 "command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetHeat", 110 "params": {"heatCelsius": heat}, 111 } 112 return await self.cmd.execute(data) 113 114 async def set_cool(self, cool: float) -> aiohttp.ClientResponse: 115 """Change the thermostat Eco mode.""" 116 data = { 117 "command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetCool", 118 "params": {"coolCelsius": cool}, 119 } 120 return await self.cmd.execute(data) 121 122 async def set_range(self, heat: float, cool: float) -> aiohttp.ClientResponse: 123 """Change the thermostat Eco mode.""" 124 data = { 125 "command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetRange", 126 "params": { 127 "heatCelsius": heat, 128 "coolCelsius": cool, 129 }, 130 } 131 return await self.cmd.execute(data)
This trait belongs to devices that support setting target temperature.
ThermostatTemperatureSetpointTrait(heat_celsius: float | None = None, cool_celsius: float | None = None)
NAME: ClassVar[google_nest_sdm.traits.TraitType] =
<TraitType.THERMOSTAT_TEMPERATURE_SETPOINT: 'sdm.devices.traits.ThermostatTemperatureSetpoint'>
async def
set_heat(self, heat: float) -> aiohttp.client_reqrep.ClientResponse:
106 async def set_heat(self, heat: float) -> aiohttp.ClientResponse: 107 """Change the thermostat Eco mode.""" 108 data = { 109 "command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetHeat", 110 "params": {"heatCelsius": heat}, 111 } 112 return await self.cmd.execute(data)
Change the thermostat Eco mode.
async def
set_cool(self, cool: float) -> aiohttp.client_reqrep.ClientResponse:
114 async def set_cool(self, cool: float) -> aiohttp.ClientResponse: 115 """Change the thermostat Eco mode.""" 116 data = { 117 "command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetCool", 118 "params": {"coolCelsius": cool}, 119 } 120 return await self.cmd.execute(data)
Change the thermostat Eco mode.
async def
set_range(self, heat: float, cool: float) -> aiohttp.client_reqrep.ClientResponse:
122 async def set_range(self, heat: float, cool: float) -> aiohttp.ClientResponse: 123 """Change the thermostat Eco mode.""" 124 data = { 125 "command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetRange", 126 "params": { 127 "heatCelsius": heat, 128 "coolCelsius": cool, 129 }, 130 } 131 return await self.cmd.execute(data)
Change the thermostat Eco mode.