예제 #1
0
    def __init__(self, prefix, sinkName):
        '''
        Ctor

        :param str prefix: the item name prefix, as defined in the .item file. By\
            convention, other channels of this device will have this naming \
            pattern: {prefix}Idling, {prefix}Title, {prefix}Player, and so on.
        :param str sinkName: the sink name for voice and audio play. The sink \
            name can be retrieved by running "openhab-cli console" and then \
            "smarthome:audio sinks".
        :raise ValueError: if any parameter is invalid
        '''
        Device.__init__(self, PE.createStringItem(
                    'Chromecast-{}-{}'.format(prefix, sinkName)))

        self.sinkName = sinkName
        self.prefix = prefix
        self.streamUrl = None
        self.lastTtsMessage = None

        self._testMode = False
        self._testLastCommand = None

        self._lastCommandTimestamp = time.time()
        self._lastCommand = None
예제 #2
0
    def __init__(self, switchItem):
        '''
        :param org.eclipse.smarthome.core.library.items.SwitchItem switchItem:
        :raise ValueError: if any parameter is invalid
        '''

        Device.__init__(self, switchItem)
예제 #3
0
    def __init__(self, temperatureItem):
        '''
        Ctor

        :param NumberItem temperatureItem: the item to get the humidity reading
        :raise ValueError: if temperatureItem is invalid
        '''
        Device.__init__(self, temperatureItem)
예제 #4
0
    def __init__(self, numberItem):
        '''
        Ctor

        :param org.eclipse.smarthome.core.library.items.NumberItem numberItem:
        :raise ValueError: if any parameter is invalid
        '''
        Device.__init__(self, numberItem)
예제 #5
0
    def __init__(self, powerStatusItem):
        '''
        Ctor

        :param SwitchItem powerStatusItem:
        :raise ValueError: if any parameter is invalid
        '''

        Device.__init__(self, powerStatusItem)
예제 #6
0
    def __init__(self, plugItem, powerReadingItem=None):
        '''
        Ctor

        :param org.eclipse.smarthome.core.library.items.SwitchItem plugItem: \
            the item to indicate if the system is in alarm
        :param org.eclipse.smarthome.core.library.items.NumberItem powerReadingItem: \
            the optional item to get the wattage reading
        :raise ValueError: if plugItem is invalid
        '''
        Device.__init__(self, plugItem)

        self.powerReadingItem = powerReadingItem
예제 #7
0
    def __init__(self, valueItem, stateItem):
        '''
        Ctor

        :param NumberItem valueItem: the item to get the value reading
        :param SwitchItem stateItem: the item to get the state reading
        :raise ValueError: if valueItem is invalid
        '''
        Device.__init__(self, valueItem)

        if None == stateItem:
            raise ValueError('stateItem must not be None')

        self.stateItem = stateItem
예제 #8
0
    def __init__(self, alarmStatusItem, armModeItem):
        '''
        Ctor

        :param org.eclipse.smarthome.core.library.items.SwitchItem alarmStatusItem: \
            the item to indicate if the system is in alarm
        :param org.eclipse.smarthome.core.library.items.NumberItem armModeItem: \
            the item to set the arming/disarming mode
        :raise ValueError: if any parameter is invalid
        '''
        Device.__init__(self, alarmStatusItem)

        if None == armModeItem:
            raise ValueError('armModeItem must not be None')

        self.armModeItem = armModeItem
예제 #9
0
    def __init__(self,
                 cameraNameItem,
                 cameraName,
                 imageLocation='/home/pi/motion-os'):
        '''
        Ctor

        :param org.eclipse.smarthome.core.library.items.StringItem cameraNameItem: \
            a dummy item; won't be used by this device.
        :param string cameraName the optional file location of the still images
        :param string imageLocation the optional file location of the still images
        :raise ValueError: if cameraNameItem is invalid
        '''
        Device.__init__(self, cameraNameItem)

        self._cameraName = cameraName
        self._imageLocation = imageLocation
예제 #10
0
    def __init__(self, timeRangeMap):
        '''
        Ctor

        :param dictionary timeRangeMap: a map from activity string to time \
            range string \
            The supported activities are 'lunch', 'dinner', 'sleep', 'quiet', \
            'wakeup'.
            A time range string can be a single or multiple \
            ranges in the 24-hour format.\
            Example: '10-12', or '6-9, 7-7, 8:30 - 14:45', or '19 - 8' \
            (wrap around)
        :raise ValueError: if any parameter is invalid
        '''
        Device.__init__(self, PE.createStringItem('ActivityTimesItem'))

        acceptableKeys = ['lunch', 'dinner', 'sleep', 'quiet', 'wakeup']
        for key in timeRangeMap.keys():
            if key not in acceptableKeys:
                raise ValueError('Invalid time range key {}'.format(key))

        self.timeRangeMap = timeRangeMap
예제 #11
0
    def __init__(self,
                 switchItem,
                 durationInMinutes,
                 disableTrigeringFromMotionSensor=False):
        '''
        Ctor

        :param org.eclipse.smarthome.core.library.items.SwitchItem switchItem:
        :param int durationInMinutes: how long the switch will be kept on
        :param bool disableTrigeringFromMotionSensor: a flag to indicate whether \
            the switch should be turned on when motion sensor is triggered.\
            There is no logic associate with this value in this class; it is \
            used by external classes through the getter.
        :raise ValueError: if any parameter is invalid
        '''
        Device.__init__(self, switchItem)

        self.disableTrigeringFromMotionSensor = disableTrigeringFromMotionSensor
        self.lastOffTimestampInSeconds = -1

        self.durationInMinutes = durationInMinutes
        self.timer = None