Source code for caspia.meadow.services.thermostat

from enum import Enum

from caspia.meadow.value import MemberOf

from .base import Characteristic, ServiceBase


[docs]class ThermostatState(Enum): """ State of a thermostat. """ OFF = 'off' HEATING = 'heating' COOLING = 'cooling'
[docs]class ThermostatBase(ServiceBase): """ Represents a thermsotat. """ type = 'thermostat' target_temp = Characteristic('float', 'RWN') current_temp = Characteristic('float', 'RN') current_state = Characteristic('string', 'RN', validate=MemberOf([m.value for m in ThermostatState])) target_state = Characteristic('string', 'RWN', validate=MemberOf([m.value for m in ThermostatState]))