米家踢脚线电暖器E NodeRed接入

[
    {
        "id": "e55a2f29.f39e5",
        "type": "Mi-Other",
        "z": "a3dbac8f.e2c18",
        "name": "米家踢脚线电暖器E",
        "device": "e9a55dec.66af1",
        "x": 590,
        "y": 1000,
        "wires": [
            [
                "3c3c16d6.7ed94a",
                "8110eda8.31d46",
                "352981f1.c9098e"
            ]
        ]
    },
    {
        "id": "9e46097.3c8cdf8",
        "type": "inject",
        "z": "a3dbac8f.e2c18",
        "name": "获取全部状态",
        "topic": "",
        "payload": "{\"cmd\":\"miio\",\"method\":\"get_properties\",\"value\":[{\"piid\":1,\"siid\":2},{\"piid\":2,\"siid\":2},{\"piid\":5,\"siid\":2},{\"piid\":6,\"siid\":2},{\"piid\":1,\"siid\":3},{\"piid\":3,\"siid\":7},{\"piid\":7,\"siid\":4},{\"piid\":1,\"siid\":5},{\"piid\":1,\"siid\":6}]}",
        "payloadType": "json",
        "repeat": "3",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 340,
        "y": 1020,
        "wires": [
            [
                "e55a2f29.f39e5"
            ]
        ]
    },
    {
        "id": "8e3ed3cf.e9ba6",
        "type": "inject",
        "z": "a3dbac8f.e2c18",
        "name": "蜂鸣器开",
        "topic": "",
        "payload": "{\"cmd\":\"miio\",\"method\":\"set_properties\",\"value\":[{\"value\":true,\"siid\":6,\"piid\":1}]}",
        "payloadType": "json",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 320,
        "y": 1060,
        "wires": [
            [
                "e55a2f29.f39e5"
            ]
        ]
    },
    {
        "id": "7c9de264.3e263c",
        "type": "inject",
        "z": "a3dbac8f.e2c18",
        "name": "蜂鸣器关",
        "topic": "",
        "payload": "{\"cmd\":\"miio\",\"method\":\"set_properties\",\"value\":[{\"value\":false,\"siid\":6,\"piid\":1}]}",
        "payloadType": "json",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 320,
        "y": 1100,
        "wires": [
            [
                "e55a2f29.f39e5"
            ]
        ]
    },
    {
        "id": "9732add9.1c2c7",
        "type": "mqtt out",
        "z": "a3dbac8f.e2c18",
        "name": "当前温度",
        "topic": "miheater/ac/stat/current_temp",
        "qos": "1",
        "retain": "true",
        "broker": "de883c32.a78c5",
        "x": 900,
        "y": 960,
        "wires": []
    },
    {
        "id": "3c3c16d6.7ed94a",
        "type": "function",
        "z": "a3dbac8f.e2c18",
        "name": "",
        "func": "if( msg.payload.msg.length<7)return\nif(msg.payload.msg[6]){\n   msg.payload = msg.payload.msg[6].value\n    return msg; \n}\n",
        "outputs": 1,
        "noerr": 0,
        "x": 770,
        "y": 960,
        "wires": [
            [
                "9732add9.1c2c7"
            ]
        ]
    },
    {
        "id": "fbcd4d77.83c9d",
        "type": "mqtt out",
        "z": "a3dbac8f.e2c18",
        "name": "工作模式",
        "topic": "miheater/ac/stat/mode",
        "qos": "1",
        "retain": "true",
        "broker": "de883c32.a78c5",
        "x": 900,
        "y": 1000,
        "wires": []
    },
    {
        "id": "8110eda8.31d46",
        "type": "function",
        "z": "a3dbac8f.e2c18",
        "name": "",
        "func": "if( msg.payload.msg.length<9)return\nif(msg.payload.msg[3]){\n    var mode = msg.payload.msg[3].value\n    var statu = msg.payload.msg[0].value\n    if(mode===0){\n        msg.payload = \"auto\"\n    }else if(mode===1){\n        msg.payload = \"dry\"\n    }else if(mode===2){\n        msg.payload = \"heat\"\n    } \n    if(!statu){\n        msg.payload = \"off\"\n    }\n        \n    \n    return msg;\n}\n\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "x": 770,
        "y": 1000,
        "wires": [
            [
                "fbcd4d77.83c9d"
            ]
        ]
    },
    {
        "id": "ac457481.c875e8",
        "type": "mqtt in",
        "z": "a3dbac8f.e2c18",
        "name": "模式",
        "topic": "miheater/ac/cmnd/mode",
        "qos": "2",
        "datatype": "auto",
        "broker": "de883c32.a78c5",
        "x": 250,
        "y": 900,
        "wires": [
            [
                "5fb2e2cc.5f26fc"
            ]
        ]
    },
    {
        "id": "5fb2e2cc.5f26fc",
        "type": "function",
        "z": "a3dbac8f.e2c18",
        "name": "",
        "func": "var mode = msg.payload;\nif(mode===\"off\"){\n    msg.payload = {\"cmd\":\"miio\",\"method\":\"set_properties\",\"value\":[{\"value\":false,\"siid\":2,\"piid\":1}]}\n}else if(mode===\"heat\"){\n    msg.payload = {\"cmd\":\"miio\",\"method\":\"set_properties\",\"value\":[{\"value\":true,\"siid\":2,\"piid\":1},{\"value\":2,\"siid\":2,\"piid\":6}]}\n}else if(mode===\"dry\"){\n    msg.payload = {\"cmd\":\"miio\",\"method\":\"set_properties\",\"value\":[{\"value\":true,\"siid\":2,\"piid\":1},{\"value\":1,\"siid\":2,\"piid\":6}]}\n}else if(mode===\"auto\"){\n    msg.payload = {\"cmd\":\"miio\",\"method\":\"set_properties\",\"value\":[{\"value\":true,\"siid\":2,\"piid\":1},{\"value\":0,\"siid\":2,\"piid\":6}]}\n}\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 370,
        "y": 900,
        "wires": [
            [
                "e55a2f29.f39e5"
            ]
        ]
    },
    {
        "id": "4fd34a0f.5afe54",
        "type": "mqtt in",
        "z": "a3dbac8f.e2c18",
        "name": "温度",
        "topic": "miheater/ac/cmnd/temp",
        "qos": "2",
        "datatype": "auto",
        "broker": "de883c32.a78c5",
        "x": 250,
        "y": 960,
        "wires": [
            [
                "1a45c645.83687a"
            ]
        ]
    },
    {
        "id": "82d6ff05.88928",
        "type": "mqtt out",
        "z": "a3dbac8f.e2c18",
        "name": "目标温度",
        "topic": "miheater/ac/stat/temp",
        "qos": "1",
        "retain": "true",
        "broker": "de883c32.a78c5",
        "x": 900,
        "y": 1040,
        "wires": []
    },
    {
        "id": "352981f1.c9098e",
        "type": "function",
        "z": "a3dbac8f.e2c18",
        "name": "",
        "func": "if( msg.payload.msg.length<9)return\nif(msg.payload.msg[2]){\n   msg.payload = msg.payload.msg[2].value\n    return msg; \n}\n",
        "outputs": 1,
        "noerr": 0,
        "x": 770,
        "y": 1040,
        "wires": [
            [
                "82d6ff05.88928"
            ]
        ]
    },
    {
        "id": "1a45c645.83687a",
        "type": "function",
        "z": "a3dbac8f.e2c18",
        "name": "",
        "func": "var temp = Math.round(msg.payload)\nmsg.payload = {\"cmd\":\"miio\",\"method\":\"set_properties\",\"value\":[{\"value\":true,\"siid\":2,\"piid\":1},{\"value\":temp,\"siid\":2,\"piid\":5}]}\n\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 370,
        "y": 960,
        "wires": [
            [
                "e55a2f29.f39e5"
            ]
        ]
    },
    {
        "id": "e9a55dec.66af1",
        "type": "Mi-Other-Device",
        "z": "",
        "deviceName": "米家踢脚线电暖器E",
        "deviceIP": "192.168.1.10",
        "deviceToken": "",
        "deviceSyncInterval": "0",
        "deviceAttributesArr": [
            {
                "attribute": "",
                "setter": ""
            }
        ]
    },
    {
        "id": "de883c32.a78c5",
        "type": "mqtt-broker",
        "z": "",
        "name": "mqtt服务器",
        "broker": "192.168.1.14",
        "port": "1883",
        "clientid": "nodered",
        "usetls": false,
        "compatmode": true,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closeQos": "0",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    }
]

大佬给力 呀 虽然东北用不上还是支持下