Beispiel #1
0
 def _factory(label, capabilities, status: dict = None):
     device_data = {
         "deviceId":
         str(uuid4()),
         "name":
         "Device Type Handler Name",
         "label":
         label,
         "deviceManufacturerCode":
         "9135fc86-0929-4436-bf73-5d75f523d9db",
         "locationId":
         "fcd829e9-82f4-45b9-acfd-62fda029af80",
         "components": [{
             "id":
             "main",
             "capabilities": [{
                 "id": capability,
                 "version": 1
             } for capability in capabilities],
         }],
         "dth": {
             "deviceTypeId": "b678b29d-2726-4e4f-9c3f-7aa05bd08964",
             "deviceTypeName": "Switch",
             "deviceNetworkType": "ZWAVE",
         },
         "type":
         "DTH",
     }
     device = DeviceEntity(api, data=device_data)
     if status:
         for attribute, value in status.items():
             device.status.apply_attribute_update("main", "", attribute,
                                                  value)
     return device
Beispiel #2
0
def device_fixture(location):
    """Fixture representing devices loaded."""
    item = DeviceEntity(None)
    item.status.refresh = Mock()
    item.status.refresh.return_value = mock_coro()
    item.apply_data({
        "deviceId": "743de49f-036f-4e9c-839a-2f89d57607db",
        "name": "GE In-Wall Smart Dimmer",
        "label": "Front Porch Lights",
        "deviceManufacturerCode": "0063-4944-3038",
        "locationId": location.location_id,
        "deviceTypeId": "8a9d4b1e3b9b1fe3013b9b206a7f000d",
        "deviceTypeName": "Dimmer Switch",
        "deviceNetworkType": "ZWAVE",
        "components": [
            {
                "id": "main",
                "capabilities": [
                    {
                        "id": "switch",
                        "version": 1
                    },
                    {
                        "id": "switchLevel",
                        "version": 1
                    },
                    {
                        "id": "refresh",
                        "version": 1
                    },
                    {
                        "id": "indicator",
                        "version": 1
                    },
                    {
                        "id": "sensor",
                        "version": 1
                    },
                    {
                        "id": "actuator",
                        "version": 1
                    },
                    {
                        "id": "healthCheck",
                        "version": 1
                    },
                    {
                        "id": "light",
                        "version": 1
                    }
                ]
            }
        ],
        "dth": {
            "deviceTypeId": "8a9d4b1e3b9b1fe3013b9b206a7f000d",
            "deviceTypeName": "Dimmer Switch",
            "deviceNetworkType": "ZWAVE",
            "completedSetup": False
        },
        "type": "DTH"
    })
    return item
Beispiel #3
0
def device_fixture(location):
    """Fixture representing devices loaded."""
    item = DeviceEntity(None)
    item.status.refresh = Mock()
    item.status.refresh.return_value = mock_coro()
    item.apply_data({
        "deviceId":
        "743de49f-036f-4e9c-839a-2f89d57607db",
        "name":
        "GE In-Wall Smart Dimmer",
        "label":
        "Front Porch Lights",
        "deviceManufacturerCode":
        "0063-4944-3038",
        "locationId":
        location.location_id,
        "deviceTypeId":
        "8a9d4b1e3b9b1fe3013b9b206a7f000d",
        "deviceTypeName":
        "Dimmer Switch",
        "deviceNetworkType":
        "ZWAVE",
        "components": [{
            "id":
            "main",
            "capabilities": [{
                "id": "switch",
                "version": 1
            }, {
                "id": "switchLevel",
                "version": 1
            }, {
                "id": "refresh",
                "version": 1
            }, {
                "id": "indicator",
                "version": 1
            }, {
                "id": "sensor",
                "version": 1
            }, {
                "id": "actuator",
                "version": 1
            }, {
                "id": "healthCheck",
                "version": 1
            }, {
                "id": "light",
                "version": 1
            }]
        }],
        "dth": {
            "deviceTypeId": "8a9d4b1e3b9b1fe3013b9b206a7f000d",
            "deviceTypeName": "Dimmer Switch",
            "deviceNetworkType": "ZWAVE",
            "completedSetup": False
        },
        "type":
        "DTH"
    })
    return item