『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
12
返回列表 发新帖
楼主: Lee

[教程系列] KNX调光对接NR,实现HomeKit和小爱双语音平台调光控制

[复制链接]

9

主题

256

帖子

2659

积分

金牌会员

Rank: 6Rank: 6

积分
2659
金钱
2393
HASS币
60
 楼主| 发表于 2020-8-24 16:39:17 | 显示全部楼层
smc326 发表于 2020-8-23 08:52
{"Brightness":38}
{"On":false}
{"On":ture}

我没明白你的意思,你是只想调色温吗?
回复

使用道具 举报

9

主题

165

帖子

718

积分

高级会员

Rank: 4

积分
718
金钱
553
HASS币
0
发表于 2020-8-26 18:43:04 | 显示全部楼层
本帖最后由 smc326 于 2020-8-26 18:46 编辑
[
    {
        "id": "abf1e0fe.7300d",
        "type": "function",
        "z": "e739a64b.fc5348",
        "name": "HomeKit指令数据色温处理",
        "func": "if(msg.payload.ColorTemperature !== "" && msg.payload.ColorTemperature !== undefined){\n    msg.payload = parseInt(1000000 / msg.payload.ColorTemperature);\n    return msg\n} ",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 440,
        "y": 240,
        "wires": [
            [
                "d5ca76.4758e588",
                "658d212.a90c5e"
            ]
        ]
    },
    {
        "id": "f9d284da.b40fd8",
        "type": "SmartHome-Bot",
        "z": "e739a64b.fc5348",
        "d": true,
        "name": "调光灯",
        "account": "6a8d050f.e4f6ec",
        "jsonConfig": "5983ef64.4ac27",
        "deviceId": "light1-5f2fba5c48d88d63b29a0793",
        "auto": false,
        "x": 430,
        "y": 294,
        "wires": [
            [],
            [
                "c21dd720.bb1678"
            ]
        ]
    },
    {
        "id": "c21dd720.bb1678",
        "type": "function",
        "z": "e739a64b.fc5348",
        "name": "小爱指令处理",
        "func": "var b = context.get('b')||0;\nif(msg.payload.brightness){\n    b = msg.payload.brightness;\n    context.set('b',b);\n    msg.payload=b\n}\n\n// Uncomment lines 9 and 20 to prevent looping\n//if (msg.hap.context !== undefined) {\n    if(msg.payload.brightness === 0){\n        msg.payload = 0\n    }\n    if(msg.payload.on === false){\n        msg.payload = 0\n    }\n    if(msg.payload.on === true){\n        msg.payload = b\n    }\n    return msg\n//}",
        "outputs": 1,
        "noerr": 0,
        "x": 460,
        "y": 354,
        "wires": [
            [
                "19091ef1.cd5121",
                "13a4dfe5.c6919"
            ]
        ]
    },
    {
        "id": "6dec54ac.d848ac",
        "type": "debug",
        "z": "e739a64b.fc5348",
        "name": "KNX处理信息反馈",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 470,
        "y": 74,
        "wires": []
    },
    {
        "id": "72f185ba.8db21c",
        "type": "inject",
        "z": "e739a64b.fc5348",
        "name": "",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "false",
        "payloadType": "bool",
        "x": 710,
        "y": 540,
        "wires": [
            [
                "1eb611b1.73dbfe"
            ]
        ]
    },
    {
        "id": "2e0f8462.f6a63c",
        "type": "homekit-service",
        "z": "e739a64b.fc5348",
        "isParent": true,
        "bridge": "99fc853f.2a5148",
        "parentService": "",
        "name": "客厅射灯",
        "serviceName": "Lightbulb",
        "topic": "",
        "filter": false,
        "manufacturer": "SMC",
        "model": "射灯",
        "serialNo": "10011",
        "firmwareRev": "",
        "hardwareRev": "",
        "softwareRev": "",
        "cameraConfigVideoProcessor": "",
        "cameraConfigSource": "",
        "cameraConfigStillImageSource": "",
        "cameraConfigMaxStreams": "",
        "cameraConfigMaxWidth": "",
        "cameraConfigMaxHeight": "",
        "cameraConfigMaxFPS": "",
        "cameraConfigMaxBitrate": "",
        "cameraConfigVideoCodec": "",
        "cameraConfigAudioCodec": "",
        "cameraConfigAudio": false,
        "cameraConfigPacketSize": "",
        "cameraConfigVerticalFlip": false,
        "cameraConfigHorizontalFlip": false,
        "cameraConfigMapVideo": "",
        "cameraConfigMapAudio": "",
        "cameraConfigVideoFilter": "",
        "cameraConfigAdditionalCommandLine": "",
        "cameraConfigDebug": false,
        "cameraConfigInterfaceName": "",
        "characteristicProperties": "{"Brightness":true,"ColorTemperature":{"minValue":166,"maxValue":334}}",
        "waitForSetupMsg": false,
        "outputs": 2,
        "x": 440,
        "y": 114,
        "wires": [
            [
                "c34dbf3f.a3d36",
                "abf1e0fe.7300d",
                "1d2bb82f.efcd18"
            ],
            []
        ]
    },
    {
        "id": "c34dbf3f.a3d36",
        "type": "function",
        "z": "e739a64b.fc5348",
        "name": "HomeKit指令数据亮度处理",
        "func": "var b = context.get('b')||100;\nif(msg.payload.Brightness){\n    b = msg.payload.Brightness;\n    context.set('b',b);\n    msg.payload=b\n}\n\n// Uncomment lines 9 and 20 to prevent looping\n//if (msg.hap.context !== undefined) {\n    if(msg.payload.ColorTemperature){\n        return null\n    }\n    if(msg.payload.Brightness === 0){\n        msg.payload = 0\n    }\n    if(msg.payload.On === false){\n        msg.payload = 0\n    }\n    if(msg.payload.On === true){\n        msg.payload = b\n    } \n//    if(msg.payload.On === true && b === 0){\n//        msg.payload = true\n//    }\n    return msg\n//}",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 440,
        "y": 192,
        "wires": [
            [
                "be3ffc9d.9eeab",
                "19091ef1.cd5121"
            ]
        ]
    },
    {
        "id": "54df8373.e6bdec",
        "type": "function",
        "z": "e739a64b.fc5348",
        "name": "开关亮度状态反馈数据处理",
        "func": "var input = msg.payload;\nif (input < 101){\n    if (input < 1) {\n        msg.payload = {\n        "On": false\n    }\n    }\n    else {\n        msg.payload = {\n        "Brightness": input,\n        "On": true\n    }\n    }\n    return msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 200,
        "y": 114,
        "wires": [
            [
                "2e0f8462.f6a63c",
                "6dec54ac.d848ac"
            ]
        ]
    },
    {
        "id": "74b67dc6.d35e24",
        "type": "knxUltimate",
        "z": "e739a64b.fc5348",
        "server": "dfc0eb7e.f83d28",
        "topic": "1/2/62",
        "outputtopic": "Switch",
        "dpt": "1.001",
        "initialread": false,
        "notifyreadrequest": false,
        "notifyresponse": false,
        "notifywrite": true,
        "notifyreadrequestalsorespondtobus": false,
        "notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
        "listenallga": false,
        "name": "KNX-DALI开关反馈",
        "outputtype": "write",
        "outputRBE": true,
        "inputRBE": false,
        "formatmultiplyvalue": 1,
        "formatnegativevalue": "leave",
        "formatdecimalsvalue": 999,
        "passthrough": "no",
        "x": 190,
        "y": 294,
        "wires": [
            [
                "53b842e8.4fa0ac"
            ]
        ]
    },
    {
        "id": "53b842e8.4fa0ac",
        "type": "switch",
        "z": "e739a64b.fc5348",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "false"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 130,
        "y": 241,
        "wires": [
            [
                "4946e48.2ff171c"
            ]
        ]
    },
    {
        "id": "4946e48.2ff171c",
        "type": "change",
        "z": "e739a64b.fc5348",
        "name": "数据转换-关",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "0",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 150,
        "y": 191,
        "wires": [
            [
                "54df8373.e6bdec"
            ]
        ]
    },
    {
        "id": "99baa99d.93a2a8",
        "type": "knxUltimate",
        "z": "e739a64b.fc5348",
        "server": "dfc0eb7e.f83d28",
        "topic": "1/4/62",
        "outputtopic": "Brightness",
        "dpt": "5.001",
        "initialread": false,
        "notifyreadrequest": false,
        "notifyresponse": false,
        "notifywrite": true,
        "notifyreadrequestalsorespondtobus": false,
        "notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
        "listenallga": false,
        "name": "KNX-DALI调光反馈",
        "outputtype": "write",
        "outputRBE": true,
        "inputRBE": false,
        "formatmultiplyvalue": 1,
        "formatnegativevalue": "leave",
        "formatdecimalsvalue": 999,
        "passthrough": "no",
        "x": 190,
        "y": 354,
        "wires": [
            [
                "54df8373.e6bdec"
            ]
        ]
    },
    {
        "id": "f8c0aacb.e38698",
        "type": "knxUltimate",
        "z": "e739a64b.fc5348",
        "server": "dfc0eb7e.f83d28",
        "topic": "1/5/62",
        "outputtopic": "ColorTemperature",
        "dpt": "7.600",
        "initialread": false,
        "notifyreadrequest": false,
        "notifyresponse": false,
        "notifywrite": true,
        "notifyreadrequestalsorespondtobus": false,
        "notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
        "listenallga": false,
        "name": "KNX-DALI色温反馈",
        "outputtype": "write",
        "outputRBE": true,
        "inputRBE": false,
        "formatmultiplyvalue": 1,
        "formatnegativevalue": "leave",
        "formatdecimalsvalue": 999,
        "passthrough": "no",
        "x": 190,
        "y": 414,
        "wires": [
            [
                "71f9d412.f4c5fc"
            ]
        ]
    },
    {
        "id": "19091ef1.cd5121",
        "type": "knxUltimate",
        "z": "e739a64b.fc5348",
        "server": "dfc0eb7e.f83d28",
        "topic": "1/4/2",
        "outputtopic": "",
        "dpt": "5.001",
        "initialread": false,
        "notifyreadrequest": false,
        "notifyresponse": false,
        "notifywrite": true,
        "notifyreadrequestalsorespondtobus": false,
        "notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
        "listenallga": false,
        "name": "KNX-DALI调光",
        "outputtype": "write",
        "outputRBE": true,
        "inputRBE": false,
        "formatmultiplyvalue": 1,
        "formatnegativevalue": "leave",
        "formatdecimalsvalue": 999,
        "passthrough": "no",
        "x": 761,
        "y": 193,
        "wires": [
            [
                "5175a67d.233348",
                "54df8373.e6bdec"
            ]
        ]
    },
    {
        "id": "13a4dfe5.c6919",
        "type": "debug",
        "z": "e739a64b.fc5348",
        "name": "小爱信息反馈",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 740,
        "y": 354,
        "wires": []
    },
    {
        "id": "1d2bb82f.efcd18",
        "type": "debug",
        "z": "e739a64b.fc5348",
        "name": "HOMEKIT输出信息",
        "active": true,
        "tosidebar": true,
        "console": true,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 761,
        "y": 74,
        "wires": []
    },
    {
        "id": "658d212.a90c5e",
        "type": "knxUltimate",
        "z": "e739a64b.fc5348",
        "server": "dfc0eb7e.f83d28",
        "topic": "1/5/2",
        "outputtopic": "",
        "dpt": "7.600",
        "initialread": false,
        "notifyreadrequest": false,
        "notifyresponse": false,
        "notifywrite": true,
        "notifyreadrequestalsorespondtobus": false,
        "notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
        "listenallga": false,
        "name": "KNX-DALI色温调节",
        "outputtype": "write",
        "outputRBE": true,
        "inputRBE": false,
        "formatmultiplyvalue": 1,
        "formatnegativevalue": "leave",
        "formatdecimalsvalue": 999,
        "passthrough": "no",
        "x": 770,
        "y": 241,
        "wires": [
            [
                "5175a67d.233348"
            ]
        ]
    },
    {
        "id": "503b9297.41ae8c",
        "type": "knxUltimate",
        "z": "e739a64b.fc5348",
        "server": "dfc0eb7e.f83d28",
        "topic": "1/5/2",
        "outputtopic": "",
        "dpt": "7.600",
        "initialread": false,
        "notifyreadrequest": false,
        "notifyresponse": false,
        "notifywrite": true,
        "notifyreadrequestalsorespondtobus": false,
        "notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
        "listenallga": false,
        "name": "色温",
        "outputtype": "write",
        "outputRBE": true,
        "inputRBE": false,
        "formatmultiplyvalue": 1,
        "formatnegativevalue": "leave",
        "formatdecimalsvalue": 999,
        "passthrough": "no",
        "x": 860,
        "y": 540,
        "wires": [
            []
        ]
    },
    {
        "id": "3bb5b6dc.72053a",
        "type": "knxUltimateWatchDog",
        "z": "e739a64b.fc5348",
        "server": "dfc0eb7e.f83d28",
        "topic": "1/1/1",
        "maxRetry": 6,
        "retryInterval": 10,
        "name": "KNX Watchdog",
        "autoStart": true,
        "checkLevel": "Ethernet",
        "x": 200,
        "y": 521,
        "wires": [
            [
                "6bf82e01.8086d"
            ]
        ]
    },
    {
        "id": "6bf82e01.8086d",
        "type": "debug",
        "z": "e739a64b.fc5348",
        "name": "KNX总线查看",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 440,
        "y": 541,
        "wires": []
    },
    {
        "id": "5189ee04.3733d",
        "type": "knxUltimateLogger",
        "z": "e739a64b.fc5348",
        "server": "dfc0eb7e.f83d28",
        "topic": "",
        "intervalCreateETSXML": 15,
        "name": "",
        "autoStartTimerCreateETSXML": true,
        "maxRowsInETSXML": 0,
        "x": 150,
        "y": 581,
        "wires": [
            [
                "6bf82e01.8086d"
            ]
        ]
    },
    {
        "id": "d5ca76.4758e588",
        "type": "debug",
        "z": "e739a64b.fc5348",
        "name": "色温homekit反馈",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 750,
        "y": 314,
        "wires": []
    },
    {
        "id": "71f9d412.f4c5fc",
        "type": "function",
        "z": "e739a64b.fc5348",
        "name": "色温状态反馈数据处理",
        "func": "var input = msg.payload;\n    if(input !==""){\n\n        msg.payload = {\n        "ColorTemperature": input\n    }\n        return msg\n    }",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 180,
        "y": 74,
        "wires": [
            [
                "2e0f8462.f6a63c",
                "6dec54ac.d848ac"
            ]
        ]
    },
    {
        "id": "1eb611b1.73dbfe",
        "type": "knxUltimate",
        "z": "e739a64b.fc5348",
        "server": "dfc0eb7e.f83d28",
        "topic": "1/2/2",
        "outputtopic": "",
        "dpt": "1.001",
        "initialread": false,
        "notifyreadrequest": false,
        "notifyresponse": false,
        "notifywrite": true,
        "notifyreadrequestalsorespondtobus": false,
        "notifyreadrequestalsorespondtobusdefaultvalueifnotinitialized": "0",
        "listenallga": false,
        "name": "KNX-DALI开关",
        "outputtype": "write",
        "outputRBE": true,
        "inputRBE": false,
        "formatmultiplyvalue": 1,
        "formatnegativevalue": "leave",
        "formatdecimalsvalue": 999,
        "passthrough": "no",
        "x": 820,
        "y": 480,
        "wires": [
            []
        ]
    },
    {
        "id": "5175a67d.233348",
        "type": "debug",
        "z": "e739a64b.fc5348",
        "name": "DALI输出后反馈",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1030,
        "y": 254,
        "wires": []
    },
    {
        "id": "be3ffc9d.9eeab",
        "type": "debug",
        "z": "e739a64b.fc5348",
        "name": "HOMEKIT处理后亮度信息",
        "active": true,
        "tosidebar": true,
        "console": true,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 779,
        "y": 121,
        "wires": []
    },
    {
        "id": "103d8bd0.817614",
        "type": "comment",
        "z": "e739a64b.fc5348",
        "name": "下面的功能没用",
        "info": "",
        "x": 760,
        "y": 440,
        "wires": []
    },
    {
        "id": "a9f808f0.852b68",
        "type": "comment",
        "z": "e739a64b.fc5348",
        "name": "下面的功能也没用",
        "info": "",
        "x": 246,
        "y": 480,
        "wires": []
    },
    {
        "id": "6a8d050f.e4f6ec",
        "type": "SmartHome-Bot-Account",
        "z": "",
        "name": "默认配置"
    },
    {
        "id": "5983ef64.4ac27",
        "type": "SmartHome-Bot-Config",
        "z": "",
        "name": "调光灯",
        "jsonConfig": "{\n  "2": {\n    "1": "on",\n    "3": "brightness",\n    "4": "color"\n  },\n  "3": {\n    "1": "battery-level",\n    "3": "voltage"\n  }\n}"
    },
    {
        "id": "99fc853f.2a5148",
        "type": "homekit-bridge",
        "z": "",
        "bridgeName": "客厅射灯",
        "pinCode": "325-00-327",
        "port": "",
        "allowInsecureRequest": false,
        "manufacturer": "NRCHKB",
        "model": "1.2.0",
        "serialNo": "Default Serial Number",
        "firmwareRev": "1.2.0",
        "hardwareRev": "1.2.0",
        "softwareRev": "1.2.0",
        "customMdnsConfig": false,
        "mdnsMulticast": true,
        "mdnsInterface": "",
        "mdnsPort": "",
        "mdnsIp": "",
        "mdnsTtl": "",
        "mdnsLoopback": true,
        "mdnsReuseAddr": true,
        "allowMessagePassthrough": true
    },
    {
        "id": "dfc0eb7e.f83d28",
        "type": "knxUltimate-config",
        "z": "",
        "host": "192.168.124.15",
        "port": "3671",
        "physAddr": "1.1.22",
        "suppressACKRequest": false,
        "csv": "",
        "KNXEthInterface": "Auto",
        "KNXEthInterfaceManuallyInput": "",
        "statusDisplayLastUpdate": true,
        "statusDisplayDeviceNameWhenALL": true,
        "statusDisplayDataPoint": false,
        "stopETSImportIfNoDatapoint": "stop",
        "loglevel": "error",
        "name": "KNX Gateway",
        "localEchoInTunneling": true,
        "delaybetweentelegrams": "50",
        "delaybetweentelegramsfurtherdelayREAD": "1"
    }
]
回复

使用道具 举报

9

主题

165

帖子

718

积分

高级会员

Rank: 4

积分
718
金钱
553
HASS币
0
发表于 2020-8-26 18:49:57 | 显示全部楼层
我增加了色温功能,并且把亮度B的默认值改成100,如果亮度没有初始值默认为0的话,怎么按开关都打不开灯。
回复

使用道具 举报

9

主题

256

帖子

2659

积分

金牌会员

Rank: 6Rank: 6

积分
2659
金钱
2393
HASS币
60
 楼主| 发表于 2020-8-27 08:52:58 | 显示全部楼层
smc326 发表于 2020-8-26 18:49
我增加了色温功能,并且把亮度B的默认值改成100,如果亮度没有初始值默认为0的话,怎么按开关都打不开灯。 ...

我手上目前没有双色温的灯,我测试不了,你说的后面这个问题我试过,后面调光的时候可能会有冲突,所以就是改成了打开开关恢复上一次的亮度值,一般很少会直接在手机是把亮度滑到0,直接点击关闭就好了,所以我觉得影响不大,你试试按你的这个开关灯和调光穿插操作,看灯的状态有没有异常。
回复

使用道具 举报

0

主题

209

帖子

1487

积分

金牌会员

Rank: 6Rank: 6

积分
1487
金钱
1278
HASS币
0
QQ
发表于 2020-9-17 15:36:39 | 显示全部楼层
你好,正常调光组地址应该是1个地址,这里两个组地址是怎么回事?一个是调光的状态反馈吗?
回复

使用道具 举报

1

主题

15

帖子

57

积分

注册会员

Rank: 2

积分
57
金钱
42
HASS币
0
发表于 2022-5-18 14:06:43 | 显示全部楼层
学习一下。
回复

使用道具 举报

0

主题

11

帖子

50

积分

注册会员

Rank: 2

积分
50
金钱
39
HASS币
0
发表于 2023-5-25 12:29:37 | 显示全部楼层
为什么下载不了啊
回复

使用道具 举报

0

主题

1

帖子

16

积分

新手上路

Rank: 1

积分
16
金钱
15
HASS币
0
发表于 2024-3-14 11:00:33 | 显示全部楼层
怎么不能下载呀
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-27 04:53 , Processed in 0.082833 second(s), 29 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表