Skip to content

Commit

Permalink
Add operating state to thermostat
Browse files Browse the repository at this point in the history
  • Loading branch information
natekspencer committed Sep 16, 2021
1 parent b5e8e25 commit 3501c0f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = vivintpy
version = 2021.9.4
version = 2021.9.5
author = Nathan Spencer
author_email = [email protected]
description = Python library for interacting with the Vivint Sky API.
Expand Down
8 changes: 6 additions & 2 deletions vivintpy/devices/thermostat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging

from ..const import ThermostatAttribute as Attribute
from ..enums import FanMode, HoldMode, OperatingMode
from ..enums import FanMode, HoldMode, OperatingMode, OperatingState
from . import VivintDevice
from .alarm_panel import AlarmPanel

Expand Down Expand Up @@ -47,7 +47,7 @@ def is_fan_on(self) -> bool:

@property
def is_on(self) -> int:
return self.data.get(Attribute.OPERATING_STATE) == 1
return self.operating_state != OperatingState.IDLE

@property
def maximum_temperature(self) -> float:
Expand All @@ -61,6 +61,10 @@ def minimum_temperature(self) -> float:
def operating_mode(self) -> OperatingMode:
return OperatingMode(self.data.get(Attribute.OPERATING_MODE))

@property
def operating_state(self) -> OperatingState:
return OperatingState(self.data.get(Attribute.OPERATING_STATE))

@property
def temperature(self) -> float:
return self.data.get(Attribute.CURRENT_TEMPERATURE)
Expand Down
9 changes: 9 additions & 0 deletions vivintpy/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,15 @@ class OperatingMode(IntEnum):
ECO = 100


@unique
class OperatingState(IntEnum):
"""Operating state."""

IDLE = 0
HEATING = 1
COOLING = 2


@unique
class SensorType(IntEnum):
"""Sensor type."""
Expand Down

0 comments on commit 3501c0f

Please sign in to comment.