[
    {
        "id": "b3b5156e.cdf988",
        "type": "group",
        "z": "eeb8b00c.2c18c",
        "name": "Air Quality with Battery: input only sensor",
        "style": {
            "stroke": "#999999",
            "fill": "none",
            "label": true,
            "label-position": "nw",
            "color": "#a4a4a4"
        },
        "nodes": [
            "8088a797.e1a7c",
            "a70b3192.dfb4f",
            "d5708f5.036c87",
            "90b692e4.b9f6c",
            "54bfafbc.396898",
            "560fc866.6de558",
            "61e113b2.dbb714"
        ],
        "x": 94,
        "y": 239,
        "w": 758,
        "h": 208,
        "info": "# Air Quality Sensor\n\nThis sensor will inject random values for all of the air quality metrics available in the HomeKit spec. It will also inject random values for a linked battery service.\n\nWatch the input and Home app to learn how to see how things are working."
    },
    {
        "id": "8088a797.e1a7c",
        "type": "homekit-service",
        "z": "eeb8b00c.2c18c",
        "g": "b3b5156e.cdf988",
        "isParent": true,
        "hostType": "0",
        "bridge": "409001a1.3e7a78",
        "accessoryId": "",
        "parentService": "",
        "name": "Air Quality",
        "serviceName": "AirQualitySensor",
        "topic": "",
        "filter": false,
        "manufacturer": "Quality",
        "model": "Battery",
        "serialNo": "777",
        "firmwareRev": "8.3",
        "hardwareRev": "2.1",
        "softwareRev": "1.0.0",
        "cameraConfigVideoProcessor": "ffmpeg",
        "cameraConfigSource": "",
        "cameraConfigStillImageSource": "",
        "cameraConfigMaxStreams": 2,
        "cameraConfigMaxWidth": 1280,
        "cameraConfigMaxHeight": 720,
        "cameraConfigMaxFPS": 10,
        "cameraConfigMaxBitrate": 300,
        "cameraConfigVideoCodec": "libx264",
        "cameraConfigAudioCodec": "libfdk_aac",
        "cameraConfigAudio": false,
        "cameraConfigPacketSize": 1316,
        "cameraConfigVerticalFlip": false,
        "cameraConfigHorizontalFlip": false,
        "cameraConfigMapVideo": "0:0",
        "cameraConfigMapAudio": "0:1",
        "cameraConfigVideoFilter": "scale=1280:720",
        "cameraConfigAdditionalCommandLine": "-tune zerolatency",
        "cameraConfigDebug": false,
        "cameraConfigSnapshotOutput": "disabled",
        "cameraConfigInterfaceName": "",
        "characteristicProperties": "{    \"AirQuality\":true,    \"PM2_5Density\":true,    \"PM10Density\":true}",
        "waitForSetupMsg": false,
        "outputs": 2,
        "x": 750,
        "y": 280,
        "wires": [
            [],
            []
        ]
    },
    {
        "id": "a70b3192.dfb4f",
        "type": "inject",
        "z": "eeb8b00c.2c18c",
        "g": "b3b5156e.cdf988",
        "name": "Air quality random",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "15",
        "crontab": "",
        "once": true,
        "onceDelay": "5",
        "topic": "",
        "payload": "{}",
        "payloadType": "json",
        "x": 230,
        "y": 280,
        "wires": [
            [
                "560fc866.6de558"
            ]
        ]
    },
    {
        "id": "d5708f5.036c87",
        "type": "inject",
        "z": "eeb8b00c.2c18c",
        "g": "b3b5156e.cdf988",
        "name": "Battery random",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "30",
        "crontab": "",
        "once": true,
        "onceDelay": "5",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 220,
        "y": 380,
        "wires": [
            [
                "90b692e4.b9f6c"
            ]
        ]
    },
    {
        "id": "90b692e4.b9f6c",
        "type": "function",
        "z": "eeb8b00c.2c18c",
        "g": "b3b5156e.cdf988",
        "name": "Batt",
        "func": "// Define random battery level\nconst level = Math.floor(Math.random() * Math.floor(100))\nvar newMsg = {\n    payload: {\n        \"BatteryLevel\": level\n    }\n};\n\n// Show \"Low Battery\" if less than 10%\nif (level < 10)newMsg.payload.StatusLowBattery = 1;\nelse newMsg.payload.StatusLowBattery = 0;\n\n// Show \"Charging\" if greater than 60%\nif (level > 60) newMsg.payload.ChargingState = 1;\nelse newMsg.payload.ChargingState = 0;\n\nreturn newMsg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 470,
        "y": 380,
        "wires": [
            [
                "5cd5342a.cfd72c"
            ]
        ]
    },
    {
        "id": "54bfafbc.396898",
        "type": "inject",
        "z": "eeb8b00c.2c18c",
        "g": "b3b5156e.cdf988",
        "name": "NO RESPONSE",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"AirQuality\":\"NO_RESPONSE\"}",
        "payloadType": "json",
        "x": 500,
        "y": 320,
        "wires": [
            [
                "8088a797.e1a7c"
            ]
        ]
    },
    {
        "id": "560fc866.6de558",
        "type": "function",
        "z": "eeb8b00c.2c18c",
        "g": "b3b5156e.cdf988",
        "name": "Random values",
        "func": "var newMsg = {\n    \"payload\":{\n        \"AirQuality\":Math.floor(Math.random() * Math.floor(5)),\n        \"PM2_5Density\":Math.floor(Math.random() * Math.floor(1000)),\n        \"PM10Density\":Math.floor(Math.random() * Math.floor(1000)),\n        \"OzoneDensity\":Math.floor(Math.random() * Math.floor(1000)),\n        \"NitrogenDioxideDensity\":Math.floor(Math.random() * Math.floor(1000)),\n        \"SulphurDioxideDensity\": Math.floor(Math.random() * Math.floor(1000))\n    }\n}\n\n\n\nreturn newMsg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 500,
        "y": 280,
        "wires": [
            [
                "8088a797.e1a7c"
            ]
        ]
    },
    {
        "id": "61e113b2.dbb714",
        "type": "group",
        "z": "eeb8b00c.2c18c",
        "g": "b3b5156e.cdf988",
        "name": "LINKED",
        "style": {
            "stroke": "#0070c0",
            "fill": "#bfdbef",
            "label": true
        },
        "nodes": [
            "5cd5342a.cfd72c"
        ],
        "x": 654,
        "y": 339,
        "w": 172,
        "h": 82
    },
    {
        "id": "5cd5342a.cfd72c",
        "type": "homekit-service",
        "z": "eeb8b00c.2c18c",
        "g": "61e113b2.dbb714",
        "isParent": false,
        "hostType": "0",
        "bridge": "",
        "accessoryId": "",
        "parentService": "8088a797.e1a7c",
        "name": "Battery",
        "serviceName": "Battery",
        "topic": "Air Quality",
        "filter": false,
        "manufacturer": "Default Manufacturer",
        "model": "Default Model",
        "serialNo": "Default Serial Number",
        "firmwareRev": "1.0.0",
        "hardwareRev": "1.0.0",
        "softwareRev": "1.0.0",
        "cameraConfigVideoProcessor": "ffmpeg",
        "cameraConfigSource": "",
        "cameraConfigStillImageSource": "",
        "cameraConfigMaxStreams": 2,
        "cameraConfigMaxWidth": 1280,
        "cameraConfigMaxHeight": 720,
        "cameraConfigMaxFPS": 10,
        "cameraConfigMaxBitrate": 300,
        "cameraConfigVideoCodec": "libx264",
        "cameraConfigAudioCodec": "libfdk_aac",
        "cameraConfigAudio": false,
        "cameraConfigPacketSize": 1316,
        "cameraConfigVerticalFlip": false,
        "cameraConfigHorizontalFlip": false,
        "cameraConfigMapVideo": "0:0",
        "cameraConfigMapAudio": "0:1",
        "cameraConfigVideoFilter": "scale=1280:720",
        "cameraConfigAdditionalCommandLine": "-tune zerolatency",
        "cameraConfigDebug": false,
        "cameraConfigSnapshotOutput": "disabled",
        "cameraConfigInterfaceName": "",
        "characteristicProperties": "{}",
        "waitForSetupMsg": false,
        "outputs": 2,
        "x": 740,
        "y": 380,
        "wires": [
            [],
            []
        ]
    },
    {
        "id": "409001a1.3e7a78",
        "type": "homekit-bridge",
        "bridgeName": "Demo 1",
        "pinCode": "153-10-538",
        "port": "",
        "allowInsecureRequest": false,
        "manufacturer": "NRCHKB",
        "model": "Demo",
        "serialNo": "1.1.2",
        "customMdnsConfig": false,
        "mdnsMulticast": true,
        "mdnsInterface": "",
        "mdnsPort": "",
        "mdnsIp": "",
        "mdnsTtl": "",
        "mdnsLoopback": true,
        "mdnsReuseAddr": true,
        "allowMessagePassthrough": true
    }
]
