Source code for caspia.meadow.services.blinds

import enum

from caspia.meadow.value import InRange, MemberOf

from .base import Characteristic, ServiceBase


[docs]class BlindsMovement(enum.Enum): """ Enumeration of possible blind's movements. """ UP = 'up' DOWN = 'down' STEADY = 'steady'
[docs]class BlindsBase(ServiceBase): """ Represents a window blind. """ type = 'blinds' movement = Characteristic('string', 'RN', validate=MemberOf([m.value for m in BlindsMovement]), description=""" Current movement of the blind. See :class:`BlindsMovement`. """) blind = Characteristic('float', 'RN', validate=InRange(0.0, 1.0), description=""" Current blind. - `0.0` ... the blind is fully open. - `1.0` ... the blind is fully closed. """) tilt = Characteristic('float', 'RN', validate=InRange(-90, 90), description=""" Current tilt in degrees. - `0.0` ... horizontal position - `90.0` ... vertical position, top of the slats pointing outside - `-90.0` ... vertical position, bottom of the slats poiting outside """) target_blind = Characteristic('float', 'RWN', validate=InRange(0, 1), accepts_null=True, description='Target blind. See :attr:`current_blind`.') target_tilt = Characteristic('float', 'RWN', validate=InRange(-90, 90), accepts_null=True, description='Target tilt. See :attr:`current_tilt`.') target_position = Characteristic('array', 'RWN', accepts_null=True) calibrate = Characteristic('void', 'W', description='Request calibration.') move_up = Characteristic('void', 'W', description='Switch to manual control and start moving up') move_down = Characteristic('void', 'W', description='Switch to manual control and start moving down.') stop_movement = Characteristic('void', 'W', description='Stop any movement')