Ejemplo n.º 1
0
 def test_no_type(self):
     """Test convert_frame_to_node with no type (convert_frame_to_node should return None)."""
     frame = FrameGetNodeInformationNotification()
     frame.node_id = 23
     frame.name = "Fnord23"
     frame.node_type = NodeTypeWithSubtype.NO_TYPE
     pyvlx = PyVLX()
     self.assertEqual(convert_frame_to_node(pyvlx, frame), None)
Ejemplo n.º 2
0
 def test_blade(self):
     """Test convert_frame_to_node blade."""
     frame = FrameGetNodeInformationNotification()
     frame.node_id = 23
     frame.name = "Fnord23"
     frame.node_type = NodeTypeWithSubtype.BLADE_OPENER
     pyvlx = PyVLX()
     node = convert_frame_to_node(pyvlx, frame)
     self.assertEqual(node, Blade(pyvlx=pyvlx, name="Fnord23", node_id=23))
Ejemplo n.º 3
0
 def test_blind(self):
     """Test convert_frame_to_node with blind."""
     frame = FrameGetNodeInformationNotification()
     frame.node_id = 23
     frame.name = "Fnord23"
     frame.node_type = NodeTypeWithSubtype.INTERIOR_VENETIAN_BLIND
     pyvlx = PyVLX()
     node = convert_frame_to_node(pyvlx, frame)
     self.assertEqual(node, Blind(pyvlx=pyvlx, name="Fnord23", node_id=23))
Ejemplo n.º 4
0
 def test_gate_with_angular_position(self):
     """Test convert_frame_to_node gate."""
     frame = FrameGetNodeInformationNotification()
     frame.node_id = 23
     frame.name = "Fnord23"
     frame.node_type = NodeTypeWithSubtype.GATE_OPENER_ANGULAR_POSITION
     pyvlx = PyVLX()
     node = convert_frame_to_node(pyvlx, frame)
     self.assertEqual(node, Gate(pyvlx=pyvlx, name="Fnord23", node_id=23))
Ejemplo n.º 5
0
 def test_window(self):
     """Test convert_frame_to_node with window."""
     frame = FrameGetNodeInformationNotification()
     frame.node_id = 23
     frame.name = "Fnord23"
     frame.node_type = NodeTypeWithSubtype.WINDOW_OPENER
     pyvlx = PyVLX()
     node = convert_frame_to_node(pyvlx, frame)
     self.assertEqual(node, Window(pyvlx=pyvlx, name="Fnord23", node_id=23))
Ejemplo n.º 6
0
 def test_light(self):
     """Test convert_frame_to_node with light."""
     frame = FrameGetNodeInformationNotification()
     frame.node_id = 23
     frame.name = "Fnord23"
     frame.node_type = NodeTypeWithSubtype.LIGHT
     pyvlx = PyVLX()
     node = convert_frame_to_node(pyvlx, frame)
     self.assertEqual(node, Light(pyvlx=pyvlx, name="Fnord23", node_id=23))
Ejemplo n.º 7
0
 def test_garage_door(self):
     """Test convert_frame_to_node garage door."""
     frame = FrameGetNodeInformationNotification()
     frame.node_id = 23
     frame.name = "Fnord23"
     frame.node_type = NodeTypeWithSubtype.GARAGE_DOOR_OPENER
     pyvlx = PyVLX()
     node = convert_frame_to_node(pyvlx, frame)
     self.assertEqual(node,
                      GarageDoor(pyvlx=pyvlx, name="Fnord23", node_id=23))
Ejemplo n.º 8
0
 def test_roller_shutter(self):
     """Test convert_frame_to_node roller shutter."""
     frame = FrameGetNodeInformationNotification()
     frame.node_id = 23
     frame.name = "Fnord23"
     frame.node_type = NodeTypeWithSubtype.ROLLER_SHUTTER
     pyvlx = PyVLX()
     node = convert_frame_to_node(pyvlx, frame)
     self.assertEqual(
         node, RollerShutter(pyvlx=pyvlx, name="Fnord23", node_id=23))
Ejemplo n.º 9
0
 def test_window_with_rain_sensor(self):
     """Test convert_frame_to_node with window with rain sensor."""
     frame = FrameGetNodeInformationNotification()
     frame.node_id = 23
     frame.name = "Fnord23"
     frame.node_type = NodeTypeWithSubtype.WINDOW_OPENER_WITH_RAIN_SENSOR
     pyvlx = PyVLX()
     node = convert_frame_to_node(pyvlx, frame)
     self.assertEqual(
         node,
         Window(pyvlx=pyvlx, name="Fnord23", node_id=23, rain_sensor=True))
 def test_bytes(self):
     """Test FrameGetNodeInformationNotification."""
     frame = FrameGetNodeInformationNotification()
     frame.node_id = 23
     frame.order = 1234
     frame.placement = 2
     frame.name = "Fnord23"
     frame.velocity = Velocity.SILENT
     frame.node_type = NodeTypeWithSubtype.INTERIOR_VENETIAN_BLIND
     frame.product_group = 23
     frame.product_type = 13
     frame.node_variation = NodeVariation.TOPHUNG
     frame.power_mode = 1
     frame.build_number = 7
     frame._serial_number = b'\x01\x02\x03\x04\x05\x06\x06\x08'  # pylint: disable=protected-access
     frame.state = 1
     frame.current_position = Position(position=12)
     frame.target = Position(position=123)
     frame.current_position_fp1 = Position(position=1234)
     frame.current_position_fp2 = Position(position=2345)
     frame.current_position_fp3 = Position(position=3456)
     frame.current_position_fp4 = Position(position=4567)
     frame.remaining_time = 1
     frame.timestamp = 50528771
     frame.alias_array = AliasArray(raw=b'\x0501234567890123456789')
     self.assertEqual(bytes(frame), self.EXAMPLE_FRAME)
Ejemplo n.º 11
0
def create_frame(command):
    """Create and return empty Frame from Command."""
    # pylint: disable=too-many-branches,too-many-return-statements
    if command == Command.GW_ERROR_NTF:
        return FrameErrorNotification()
    if command == Command.GW_COMMAND_SEND_REQ:
        return FrameCommandSendRequest()
    if command == Command.GW_COMMAND_SEND_CFM:
        return FrameCommandSendConfirmation()
    if command == Command.GW_COMMAND_RUN_STATUS_NTF:
        return FrameCommandRunStatusNotification()
    if command == Command.GW_COMMAND_REMAINING_TIME_NTF:
        return FrameCommandRemainingTimeNotification()
    if command == Command.GW_SESSION_FINISHED_NTF:
        return FrameSessionFinishedNotification()

    if command == Command.GW_PASSWORD_ENTER_REQ:
        return FramePasswordEnterRequest()
    if command == Command.GW_PASSWORD_ENTER_CFM:
        return FramePasswordEnterConfirmation()

    if command == Command.GW_CS_DISCOVER_NODES_REQ:
        return FrameDiscoverNodesRequest()
    if command == Command.GW_CS_DISCOVER_NODES_CFM:
        return FrameDiscoverNodesConfirmation()
    if command == Command.GW_CS_DISCOVER_NODES_NTF:
        return FrameDiscoverNodesNotification()

    if command == Command.GW_GET_SCENE_LIST_REQ:
        return FrameGetSceneListRequest()
    if command == Command.GW_GET_SCENE_LIST_CFM:
        return FrameGetSceneListConfirmation()
    if command == Command.GW_GET_SCENE_LIST_NTF:
        return FrameGetSceneListNotification()

    if command == Command.GW_GET_NODE_INFORMATION_REQ:
        return FrameGetNodeInformationRequest()
    if command == Command.GW_GET_NODE_INFORMATION_CFM:
        return FrameGetNodeInformationConfirmation()
    if command == Command.GW_GET_NODE_INFORMATION_NTF:
        return FrameGetNodeInformationNotification()

    if command == Command.GW_GET_ALL_NODES_INFORMATION_REQ:
        return FrameGetAllNodesInformationRequest()
    if command == Command.GW_GET_ALL_NODES_INFORMATION_CFM:
        return FrameGetAllNodesInformationConfirmation()
    if command == Command.GW_GET_ALL_NODES_INFORMATION_NTF:
        return FrameGetAllNodesInformationNotification()
    if command == Command.GW_GET_ALL_NODES_INFORMATION_FINISHED_NTF:
        return FrameGetAllNodesInformationFinishedNotification()

    if command == Command.GW_ACTIVATE_SCENE_REQ:
        return FrameActivateSceneRequest()
    if command == Command.GW_ACTIVATE_SCENE_CFM:
        return FrameActivateSceneConfirmation()

    if command == Command.GW_GET_VERSION_REQ:
        return FrameGetVersionRequest()
    if command == Command.GW_GET_VERSION_CFM:
        return FrameGetVersionConfirmation()
    if command == Command.GW_GET_PROTOCOL_VERSION_REQ:
        return FrameGetProtocolVersionRequest()
    if command == Command.GW_GET_PROTOCOL_VERSION_CFM:
        return FrameGetProtocolVersionConfirmation()

    if command == Command.GW_SET_NODE_NAME_REQ:
        return FrameSetNodeNameRequest()
    if command == Command.GW_SET_NODE_NAME_CFM:
        return FrameSetNodeNameConfirmation()

    if command == Command.GW_NODE_INFORMATION_CHANGED_NTF:
        return FrameNodeInformationChangedNotification()

    if command == Command.GW_GET_STATE_REQ:
        return FrameGetStateRequest()
    if command == Command.GW_GET_STATE_CFM:
        return FrameGetStateConfirmation()

    if command == Command.GW_SET_UTC_REQ:
        return FrameSetUTCRequest()
    if command == Command.GW_SET_UTC_CFM:
        return FrameSetUTCConfirmation()

    if command == Command.GW_ACTIVATION_LOG_UPDATED_NTF:
        return FrameActivationLogUpdatedNotification()

    if command == Command.GW_HOUSE_STATUS_MONITOR_ENABLE_REQ:
        return FrameHouseStatusMonitorEnableRequest()
    if command == Command.GW_HOUSE_STATUS_MONITOR_ENABLE_CFM:
        return FrameHouseStatusMonitorEnableConfirmation()
    if command == Command.GW_HOUSE_STATUS_MONITOR_DISABLE_REQ:
        return FrameHouseStatusMonitorDisableRequest()
    if command == Command.GW_HOUSE_STATUS_MONITOR_DISABLE_CFM:
        return FrameHouseStatusMonitorDisableConfirmation()

    if command == Command.GW_NODE_STATE_POSITION_CHANGED_NTF:
        return FrameNodeStatePositionChangedNotification()

    return None