Пример #1
0
 def __init__(self, device: GenericGarageDoorOpener, channel: int):
     """Initialize the cover."""
     self._state_before_move = STATE_UNKNOWN
     self._state = STATE_UNKNOWN
     self._device = device
     self._channel = channel
     self._id = calculate_gerage_door_opener_id(self._device.uuid,
                                                self._channel)
     self._device_name = "%s (channel: %d)" % (self._device.name,
                                               self._channel)
     device.register_event_callback(self.handler)
Пример #2
0
def build_wrapper(
        cloud_client,
        device_type,  # type: str
        device_uuid,  # type: str
        device_specs  # type: dict
):
    if device_type.startswith('msl') or device_type.startswith(
            'mss560m') or device_type.startswith('mss570m'):
        return GenericBulb(cloud_client,
                           device_uuid=device_uuid,
                           **device_specs)
    elif device_type.startswith('mss'):
        return GenericPlug(cloud_client,
                           device_uuid=device_uuid,
                           **device_specs)
    elif device_type.startswith('msg'):
        return GenericGarageDoorOpener(cloud_client,
                                       device_uuid=device_uuid,
                                       **device_specs)
    elif device_type.startswith('msh'):
        return GenericHub(cloud_client,
                          device_uuid=device_uuid,
                          **device_specs)
    elif device_type.startswith('msxh'):
        return GenericHumidifier(cloud_client,
                                 device_uuid=device_uuid,
                                 **device_specs)
    else:
        return GenericPlug(cloud_client,
                           device_uuid=device_uuid,
                           **device_specs)
Пример #3
0
    def __init__(self, device: GenericGarageDoorOpener, channel: int):
        """Initialize the cover."""
        self._state_before_move = STATE_UNKNOWN
        self._state = STATE_UNKNOWN
        self._device = device
        self._channel = channel
        self._id = calculate_gerage_door_opener_id(self._device.uuid, self._channel)
        self._device_name = "%s (channel: %d)" % (self._device.name, self._channel)
        device.register_event_callback(self.handler)

        # If the device is online, we need to update its status from STATE_UNKNOWN
        if device.online and self._state == STATE_UNKNOWN:
            open = device.get_status().get(self._channel)
            if open:
                self._state = STATE_OPEN
            else:
                self._state = STATE_CLOSED
Пример #4
0
    def __init__(self, device: GenericGarageDoorOpener):
        """Initialize the cover."""
        self._state_before_move = STATE_UNKNOWN
        self._state = STATE_UNKNOWN
        self._device = device
        self._device_id = device.uuid
        self._id = device.uuid
        self._device_name = self._device.name
        device.register_event_callback(self.handler)

        if len(self._device.get_channels())>1:
            _LOGGER.error(f"Garage opener {self._id} has more than 1 channel. This is currently not supported.")

        self._channel = 0

        # If the device is online, we need to update its status from STATE_UNKNOWN
        if device.online and self._state == STATE_UNKNOWN:
            open = device.get_status().get(self._channel)
            if open:
                self._state = STATE_OPEN
            else:
                self._state = STATE_CLOSED