nod-red не могу выключить xiaomi WallWiredSwitch

Вопросы и информация о скриптах для ioBroker
Antworten
OlegJktu
starter
Beiträge: 23
Registriert: 29.10.2017, 06:48

nod-red не могу выключить xiaomi WallWiredSwitch

Beitrag von OlegJktu » 29.10.2017, 08:29

приветствую всех,
Не могу выключить oднопроводной выключатель Aqara Wall Light Switch Double Key Edition Single Fire line (QBKG03LM zigbee) с помощью nod-red (другие способы не пробовал, хотел делать логику в nod-red).
Проблема выглядит так,
Создал поток в Nod-red, в нем output блок iobroker c топиком одного из реле выключателя. И блок input этого реле. При переключении выключателя из приложения mihome input блок исправно выдает true и false .
Дальше пытаюсь направить сообщение в output - любое сообщение включает, но как выключить не понятно...

[img]
Screenshot_20171029_092053.png
[/img]
Spoiler: Show hidden text

Code: Alles auswählen

[
    {
        "id": "3dba41f3.fcba46",
        "type": "debug",
        "z": "d957aa0.4082dd8",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 490,
        "y": 60,
        "wires": []
    },
    {
        "id": "d21e392e.458bc8",
        "type": "inject",
        "z": "d957aa0.4082dd8",
        "name": "",
        "topic": "",
        "payload": "on",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 170,
        "y": 360,
        "wires": [
            [
                "be3b96ae.33ac1",
                "3dba41f3.fcba46"
            ]
        ]
    },
    {
        "id": "fbafd62f.58b138",
        "type": "inject",
        "z": "d957aa0.4082dd8",
        "name": "",
        "topic": "",
        "payload": "off",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 170,
        "y": 400,
        "wires": [
            [
                "be3b96ae.33ac1",
                "3dba41f3.fcba46"
            ]
        ]
    },
    {
        "id": "44d74e3c.40b9e",
        "type": "inject",
        "z": "d957aa0.4082dd8",
        "name": "",
        "topic": "",
        "payload": "true",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 170,
        "y": 140,
        "wires": [
            [
                "be3b96ae.33ac1",
                "3dba41f3.fcba46"
            ]
        ]
    },
    {
        "id": "e8f670bc.e35b18",
        "type": "inject",
        "z": "d957aa0.4082dd8",
        "name": "",
        "topic": "",
        "payload": "false",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 170,
        "y": 180,
        "wires": [
            [
                "be3b96ae.33ac1",
                "3dba41f3.fcba46"
            ]
        ]
    },
    {
        "id": "be3b96ae.33ac1",
        "type": "ioBroker out",
        "z": "d957aa0.4082dd8",
        "name": "",
        "topic": "mihome.0.devices.ctrl_neutral2_158d00014a9ed4.channel_0",
        "ack": "false",
        "autoCreate": "true",
        "x": 650,
        "y": 140,
        "wires": []
    },
    {
        "id": "8902b6e1.6cd59",
        "type": "ioBroker in",
        "z": "d957aa0.4082dd8",
        "name": "Wall switch 0",
        "topic": "mihome.0.devices.ctrl_neutral2_158d00014a9ed4.channel_0",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 170,
        "y": 520,
        "wires": [
            [
                "30ae897b.07fa5e"
            ]
        ]
    },
    {
        "id": "30ae897b.07fa5e",
        "type": "debug",
        "z": "d957aa0.4082dd8",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 490,
        "y": 520,
        "wires": []
    },
    {
        "id": "960b563b.8fe8c",
        "type": "inject",
        "z": "d957aa0.4082dd8",
        "name": "",
        "topic": "",
        "payload": "On",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 170,
        "y": 240,
        "wires": [
            [
                "be3b96ae.33ac1",
                "3dba41f3.fcba46"
            ]
        ]
    },
    {
        "id": "8ff0cba9.a95188",
        "type": "inject",
        "z": "d957aa0.4082dd8",
        "name": "",
        "topic": "",
        "payload": "Off",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 170,
        "y": 280,
        "wires": [
            [
                "be3b96ae.33ac1",
                "3dba41f3.fcba46"
            ]
        ]
    }
]
вопрос? Как правильно включать/выключать этот xiaomi WallWiredSwitch?

OlegJktu
starter
Beiträge: 23
Registriert: 29.10.2017, 06:48

Re: nod-red не могу выключить xiaomi WallWiredSwitch

Beitrag von OlegJktu » 30.10.2017, 08:32

решил!!!
Нужно посылать 0 и 1 в качестве цифр. Посмотрел как vis делает и сделал аналогично.
Ведь это наверняка где-то написано...
Spoiler: Show hidden text

Code: Alles auswählen

[
    {
        "id": "3dba41f3.fcba46",
        "type": "debug",
        "z": "d957aa0.4082dd8",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 490,
        "y": 60,
        "wires": []
    },
    {
        "id": "be3b96ae.33ac1",
        "type": "ioBroker out",
        "z": "d957aa0.4082dd8",
        "name": "",
        "topic": "mihome.0.devices.ctrl_neutral2_158d00014a9ed4.channel_0",
        "ack": "false",
        "autoCreate": "true",
        "x": 650,
        "y": 140,
        "wires": []
    },
    {
        "id": "8902b6e1.6cd59",
        "type": "ioBroker in",
        "z": "d957aa0.4082dd8",
        "name": "Wall switch 0",
        "topic": "mihome.0.devices.ctrl_neutral2_158d00014a9ed4.channel_0",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 190,
        "y": 260,
        "wires": [
            [
                "30ae897b.07fa5e"
            ]
        ]
    },
    {
        "id": "30ae897b.07fa5e",
        "type": "debug",
        "z": "d957aa0.4082dd8",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 510,
        "y": 260,
        "wires": []
    },
    {
        "id": "960b563b.8fe8c",
        "type": "inject",
        "z": "d957aa0.4082dd8",
        "name": "",
        "topic": "",
        "payload": "0",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 190,
        "y": 140,
        "wires": [
            [
                "be3b96ae.33ac1",
                "3dba41f3.fcba46"
            ]
        ]
    },
    {
        "id": "8ff0cba9.a95188",
        "type": "inject",
        "z": "d957aa0.4082dd8",
        "name": "",
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 190,
        "y": 180,
        "wires": [
            [
                "be3b96ae.33ac1",
                "3dba41f3.fcba46"
            ]
        ]
    }
]

OlegJktu
starter
Beiträge: 23
Registriert: 29.10.2017, 06:48

Re: nod-red не могу выключить xiaomi WallWiredSwitch

Beitrag von OlegJktu » 30.10.2017, 13:15

Работающий код позволяющий включать/выключать aqara wall switch с помощью круглой кнопки xiaomi.
[img]
Screenshot_20171030_141326.png
[/img]
Spoiler: Show hidden text

Code: Alles auswählen

[{"id":"cda1b481.d0ef2","type":"ioBroker out","z":"9501b04f.00fc88","name":"","topic":"mihome.0.devices.ctrl_neutral2_158d00014a9ed4.channel_0","ack":"false","autoCreate":"true","x":1150,"y":200,"wires":[]},{"id":"8edd645b.178898","type":"ioBroker in","z":"9501b04f.00fc88","name":"Wall switch 0","topic":"mihome.0.devices.ctrl_neutral2_158d00014a9ed4.channel_0","payloadType":"value","onlyack":true,"func":"all","gap":"","x":190,"y":560,"wires":[["8087d738.e21b18","3b239be0.42043c"]]},{"id":"8087d738.e21b18","type":"debug","z":"9501b04f.00fc88","name":"Wall switch 0","active":false,"console":"false","complete":"payload","x":190,"y":620,"wires":[]},{"id":"de690b48.cf3d5","type":"inject","z":"9501b04f.00fc88","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"x":630,"y":140,"wires":[["3ec5f813.d65ef8"]]},{"id":"bd9924.89a60ee","type":"inject","z":"9501b04f.00fc88","name":"","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"x":630,"y":260,"wires":[["3ec5f813.d65ef8"]]},{"id":"7d039c57.2d28f4","type":"comment","z":"9501b04f.00fc88","name":"aqara mihome wallswitch (1 wired)","info":"","x":1060.5,"y":164,"wires":[]},{"id":"eccdf34e.155168","type":"debug","z":"9501b04f.00fc88","name":"Simple click","active":false,"console":"false","complete":"payload","x":150,"y":280,"wires":[]},{"id":"5e19eae1.ef70ec","type":"ioBroker in","z":"9501b04f.00fc88","name":"Simple click","topic":"mihome.0.devices.switch_158d00019de56c.click","payloadType":"value","onlyack":false,"func":"all","gap":"","x":150,"y":220,"wires":[["eccdf34e.155168","d1f084cb.5000d8"]]},{"id":"aa37571.0324ca8","type":"comment","z":"9501b04f.00fc88","name":"Mihome button ","info":"","x":160,"y":180,"wires":[]},{"id":"3b239be0.42043c","type":"switch","z":"9501b04f.00fc88","name":"Light is on? status Selector","property":"payload","propertyType":"msg","rules":[{"t":"cont","v":"true","vt":"str"},{"t":"cont","v":"false","vt":"str"}],"checkall":"false","outputs":2,"x":500,"y":500,"wires":[["29b9f765.dfec6"],["be612e94.95701"]]},{"id":"29b9f765.dfec6","type":"change","z":"9501b04f.00fc88","name":" Light on","rules":[{"t":"set","p":"Light_is_on","pt":"flow","to":"true","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":774.6666870117188,"y":439.2833251953125,"wires":[[]]},{"id":"be612e94.95701","type":"change","z":"9501b04f.00fc88","name":" Light off","rules":[{"t":"set","p":"Light_is_on","pt":"flow","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":777.3333129882812,"y":507.79998779296875,"wires":[[]]},{"id":"5fda6053.c56cc","type":"inject","z":"9501b04f.00fc88","name":"","topic":"","payload":"Light_is_on","payloadType":"flow","repeat":"1","crontab":"","once":false,"x":470,"y":600,"wires":[["95a30b3c.d04c48"]]},{"id":"95a30b3c.d04c48","type":"debug","z":"9501b04f.00fc88","name":"Light is on? debag","active":false,"console":"false","complete":"payload","x":730,"y":600,"wires":[]},{"id":"e2001c48.05e47","type":"inject","z":"9501b04f.00fc88","name":"","topic":"","payload":"true","payloadType":"str","repeat":"","crontab":"","once":false,"x":210,"y":440,"wires":[["3b239be0.42043c"]]},{"id":"eec352bc.f9327","type":"inject","z":"9501b04f.00fc88","name":"","topic":"","payload":"false","payloadType":"str","repeat":"","crontab":"","once":false,"x":210,"y":480,"wires":[["3b239be0.42043c"]]},{"id":"f151cca0.9b5b78","type":"switch","z":"9501b04f.00fc88","name":"Light is on?","property":"Light_is_on","propertyType":"flow","rules":[{"t":"eq","v":"true","vt":"str"},{"t":"eq","v":"false","vt":"str"}],"checkall":"true","outputs":2,"x":450,"y":200,"wires":[["46230450.fafb8c"],["bf0139a5.96b5a"]]},{"id":"a37dcaf0.a182c","type":"debug","z":"9501b04f.00fc88","name":"light on debag","active":false,"console":"false","complete":"payload","x":620,"y":300,"wires":[]},{"id":"623ab125.d165c8","type":"debug","z":"9501b04f.00fc88","name":"light off debag","active":false,"console":"false","complete":"payload","x":620,"y":100,"wires":[]},{"id":"46230450.fafb8c","type":"change","z":"9501b04f.00fc88","name":"turn light off","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":180,"wires":[["623ab125.d165c8","3ec5f813.d65ef8"]]},{"id":"bf0139a5.96b5a","type":"change","z":"9501b04f.00fc88","name":"turn light on","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":220,"wires":[["a37dcaf0.a182c","3ec5f813.d65ef8"]]},{"id":"ce44b3e5.b80ee","type":"inject","z":"9501b04f.00fc88","name":"","topic":"","payload":"true","payloadType":"str","repeat":"","crontab":"","once":false,"x":170,"y":80,"wires":[["d1f084cb.5000d8"]]},{"id":"dae9b376.b4d8b8","type":"inject","z":"9501b04f.00fc88","name":"","topic":"","payload":"false","payloadType":"str","repeat":"","crontab":"","once":false,"x":170,"y":120,"wires":[["d1f084cb.5000d8"]]},{"id":"df209c66.cb65f8","type":"debug","z":"9501b04f.00fc88","name":"aqara mihome wallswitch (1 wired)","active":true,"console":"false","complete":"payload","x":1060,"y":100,"wires":[]},{"id":"3ec5f813.d65ef8","type":"switch","z":"9501b04f.00fc88","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"0","vt":"num"},{"t":"eq","v":"true","vt":"str"},{"t":"eq","v":"false","vt":"str"}],"checkall":"true","outputs":4,"x":810,"y":200,"wires":[["cda1b481.d0ef2","df209c66.cb65f8"],["cda1b481.d0ef2","df209c66.cb65f8"],[],[]]},{"id":"d1f084cb.5000d8","type":"switch","z":"9501b04f.00fc88","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"true","vt":"str"},{"t":"eq","v":"false","vt":"str"}],"checkall":"true","outputs":2,"x":310,"y":200,"wires":[["f151cca0.9b5b78"],[]]}]

Antworten