[NodeRed] Werte Shelly Pro 4PM aus MQTT extrahieren und Aktion auslösen

  • Hallo zusammen,

    nach den Shely Plus geht es heute um die Werte der Shelly Pro 4PM.

    Die per MQTT im ioBroker vorhandenen Daten werden in manuell angelegte Datenpunkte geschrieben und können so weiter verarbeitet werden.

    Das Anlegen der Datenpunkte hatte ich bereits hier beschrieben.

    Für den Shelly Pro 4PM sehen die für mich relevanten Datenpunkte (Schaltzustand der Ausgänge und jeweilige Leistung so aus:

    Bildschirmfoto vom 2021-10-03 14-12-23.png

    Und hier nun der neue Flow zum Parsen der Werte Schaltzustand der Ausgänge und jeweiliger Leistungswert.

    Bildschirmfoto vom 2021-10-03 14-18-14.png


    der Flow zum Importieren:

    Spoiler anzeigen

    [

    {

    "id": "a16b5792.d1842",

    "type": "tab",

    "label": "Shelly Pro 4PM",

    "disabled": false,

    "info": ""

    },

    {

    "id": "c8b09232.4ab94",

    "type": "comment",

    "z": "a16b5792.d1842",

    "name": "Shelly Pro 4PM - Werkstatt",

    "info": "",

    "x": 190,

    "y": 100,

    "wires": []

    },

    {

    "id": "000000000000",

    "type": "mqtt in",

    "z": "a16b5792.d1842",

    "name": "",

    "topic": "ShellyPro4PM_Werkbank/events/rpc",

    "qos": "2",

    "datatype": "auto",

    "broker": "f56dd7d5.a4df",

    "nl": false,

    "rap": true,

    "rh": 0,

    "x": 220,

    "y": 240,

    "wires": [

    [

    "4a04620a.907f9c",

    "5bed796b.b72b48"

    ]

    ]

    },

    {

    "id": "4a04620a.907f9c",

    "type": "debug",

    "z": "a16b5792.d1842",

    "name": "",

    "active": false,

    "tosidebar": true,

    "console": false,

    "tostatus": false,

    "complete": "false",

    "statusVal": "",

    "statusType": "auto",

    "x": 510,

    "y": 80,

    "wires": []

    },

    {

    "id": "5bed796b.b72b48",

    "type": "switch",

    "z": "a16b5792.d1842",

    "name": "Channel x",

    "property": "payload",

    "propertyType": "msg",

    "rules": [

    {

    "t": "cont",

    "v": "\"switch:0\"",

    "vt": "str"

    },

    {

    "t": "cont",

    "v": "\"switch:1\"",

    "vt": "str"

    },

    {

    "t": "cont",

    "v": "\"switch:2\"",

    "vt": "str"

    },

    {

    "t": "cont",

    "v": "\"switch:3\"",

    "vt": "str"

    }

    ],

    "checkall": "true",

    "repair": false,

    "outputs": 4,

    "x": 480,

    "y": 400,

    "wires": [

    [

    "1fe2ee0b.179bd2",

    "7905d5e1.ba4914"

    ],

    [

    "bf3eb196.cbadf8"

    ],

    [

    "c42c1944.072d68"

    ],

    [

    "b16ffc4f.76f59"

    ]

    ]

    },

    {

    "id": "1fe2ee0b.179bd2",

    "type": "debug",

    "z": "a16b5792.d1842",

    "name": "",

    "active": false,

    "tosidebar": true,

    "console": false,

    "tostatus": false,

    "complete": "false",

    "statusVal": "",

    "statusType": "auto",

    "x": 690,

    "y": 80,

    "wires": []

    },

    {

    "id": "7905d5e1.ba4914",

    "type": "json",

    "z": "a16b5792.d1842",

    "name": "",

    "property": "payload",

    "action": "",

    "pretty": false,

    "x": 690,

    "y": 140,

    "wires": [

    [

    "1cafc498.a8ecab",

    "fb8c563e.deadc",

    "f1785f03.d71bc"

    ]

    ]

    },

    {

    "id": "1cafc498.a8ecab",

    "type": "debug",

    "z": "a16b5792.d1842",

    "name": "",

    "active": false,

    "tosidebar": true,

    "console": false,

    "tostatus": false,

    "complete": "false",

    "statusVal": "",

    "statusType": "auto",

    "x": 870,

    "y": 80,

    "wires": []

    },

    {

    "id": "2364a45a.c1620c",

    "type": "debug",

    "z": "a16b5792.d1842",

    "name": "",

    "active": true,

    "tosidebar": true,

    "console": false,

    "tostatus": false,

    "complete": "false",

    "statusVal": "",

    "statusType": "auto",

    "x": 1130,

    "y": 80,

    "wires": []

    },

    {

    "id": "fb8c563e.deadc",

    "type": "change",

    "z": "a16b5792.d1842",

    "name": "",

    "rules": [

    {

    "t": "set",

    "p": "payload",

    "pt": "msg",

    "to": "payload.params[\"switch:0\"].output",

    "tot": "msg"

    }

    ],

    "action": "",

    "property": "",

    "from": "",

    "to": "",

    "reg": false,

    "x": 930,

    "y": 120,

    "wires": [

    [

    "2364a45a.c1620c",

    "140d8a19.82010e"

    ]

    ]

    },

    {

    "id": "140d8a19.82010e",

    "type": "ioBroker out",

    "z": "a16b5792.d1842",

    "name": "",

    "topic": "0_userdata.0.Shelly_Pro.Shelly_Pro_4PM.Ausgang_1",

    "ack": "false",

    "autoCreate": "false",

    "stateName": "",

    "role": "",

    "payloadType": "",

    "readonly": "",

    "stateUnit": "",

    "stateMin": "",

    "stateMax": "",

    "x": 1340,

    "y": 120,

    "wires": []

    },

    {

    "id": "f1785f03.d71bc",

    "type": "change",

    "z": "a16b5792.d1842",

    "name": "",

    "rules": [

    {

    "t": "set",

    "p": "payload",

    "pt": "msg",

    "to": "payload.params[\"switch:0\"].apower",

    "tot": "msg"

    }

    ],

    "action": "",

    "property": "",

    "from": "",

    "to": "",

    "reg": false,

    "x": 930,

    "y": 180,

    "wires": [

    [

    "6565113c.7feeb"

    ]

    ]

    },

    {

    "id": "6565113c.7feeb",

    "type": "ioBroker out",

    "z": "a16b5792.d1842",

    "name": "",

    "topic": "0_userdata.0.Shelly_Pro.Shelly_Pro_4PM.Leistung_Ausgang_1",

    "ack": "false",

    "autoCreate": "false",

    "stateName": "",

    "role": "",

    "payloadType": "",

    "readonly": "",

    "stateUnit": "",

    "stateMin": "",

    "stateMax": "",

    "x": 1370,

    "y": 180,

    "wires": []

    },

    {

    "id": "35bf20cf.e6c2",

    "type": "change",

    "z": "a16b5792.d1842",

    "name": "",

    "rules": [

    {

    "t": "set",

    "p": "payload",

    "pt": "msg",

    "to": "payload.params[\"switch:1\"].output",

    "tot": "msg"

    }

    ],

    "action": "",

    "property": "",

    "from": "",

    "to": "",

    "reg": false,

    "x": 930,

    "y": 280,

    "wires": [

    [

    "72ad3f10.93a12"

    ]

    ]

    },

    {

    "id": "72ad3f10.93a12",

    "type": "ioBroker out",

    "z": "a16b5792.d1842",

    "name": "",

    "topic": "0_userdata.0.Shelly_Pro.Shelly_Pro_4PM.Ausgang_2",

    "ack": "false",

    "autoCreate": "false",

    "stateName": "",

    "role": "",

    "payloadType": "",

    "readonly": "",

    "stateUnit": "",

    "stateMin": "",

    "stateMax": "",

    "x": 1340,

    "y": 280,

    "wires": []

    },

    {

    "id": "12db4543.bbf3fb",

    "type": "ioBroker out",

    "z": "a16b5792.d1842",

    "name": "",

    "topic": "0_userdata.0.Shelly_Pro.Shelly_Pro_4PM.Leistung_Ausgang_2",

    "ack": "false",

    "autoCreate": "false",

    "stateName": "",

    "role": "",

    "payloadType": "",

    "readonly": "",

    "stateUnit": "",

    "stateMin": "",

    "stateMax": "",

    "x": 1370,

    "y": 340,

    "wires": []

    },

    {

    "id": "15b87436.67632c",

    "type": "change",

    "z": "a16b5792.d1842",

    "name": "",

    "rules": [

    {

    "t": "set",

    "p": "payload",

    "pt": "msg",

    "to": "payload.params[\"switch:1\"].apower",

    "tot": "msg"

    }

    ],

    "action": "",

    "property": "",

    "from": "",

    "to": "",

    "reg": false,

    "x": 930,

    "y": 340,

    "wires": [

    [

    "12db4543.bbf3fb"

    ]

    ]

    },

    {

    "id": "2dc89dc4.f16ba2",

    "type": "change",

    "z": "a16b5792.d1842",

    "name": "",

    "rules": [

    {

    "t": "set",

    "p": "payload",

    "pt": "msg",

    "to": "payload.params[\"switch:2\"].output",

    "tot": "msg"

    }

    ],

    "action": "",

    "property": "",

    "from": "",

    "to": "",

    "reg": false,

    "x": 930,

    "y": 460,

    "wires": [

    [

    "7ce27df7.c0e54c"

    ]

    ]

    },

    {

    "id": "7ce27df7.c0e54c",

    "type": "ioBroker out",

    "z": "a16b5792.d1842",

    "name": "",

    "topic": "0_userdata.0.Shelly_Pro.Shelly_Pro_4PM.Ausgang_3",

    "ack": "false",

    "autoCreate": "false",

    "stateName": "",

    "role": "",

    "payloadType": "",

    "readonly": "",

    "stateUnit": "",

    "stateMin": "",

    "stateMax": "",

    "x": 1340,

    "y": 460,

    "wires": []

    },

    {

    "id": "6b92859a.7f52ac",

    "type": "ioBroker out",

    "z": "a16b5792.d1842",

    "name": "",

    "topic": "0_userdata.0.Shelly_Pro.Shelly_Pro_4PM.Leistung_Ausgang_3",

    "ack": "false",

    "autoCreate": "false",

    "stateName": "",

    "role": "",

    "payloadType": "",

    "readonly": "",

    "stateUnit": "",

    "stateMin": "",

    "stateMax": "",

    "x": 1370,

    "y": 520,

    "wires": []

    },

    {

    "id": "caddec51.eb77a",

    "type": "change",

    "z": "a16b5792.d1842",

    "name": "",

    "rules": [

    {

    "t": "set",

    "p": "payload",

    "pt": "msg",

    "to": "payload.params[\"switch:2\"].apower",

    "tot": "msg"

    }

    ],

    "action": "",

    "property": "",

    "from": "",

    "to": "",

    "reg": false,

    "x": 930,

    "y": 520,

    "wires": [

    [

    "6b92859a.7f52ac"

    ]

    ]

    },

    {

    "id": "1091e8b2.ffeeff",

    "type": "change",

    "z": "a16b5792.d1842",

    "name": "",

    "rules": [

    {

    "t": "set",

    "p": "payload",

    "pt": "msg",

    "to": "payload.params[\"switch:3\"].output",

    "tot": "msg"

    }

    ],

    "action": "",

    "property": "",

    "from": "",

    "to": "",

    "reg": false,

    "x": 930,

    "y": 620,

    "wires": [

    [

    "7819a910.fb2f08"

    ]

    ]

    },

    {

    "id": "7819a910.fb2f08",

    "type": "ioBroker out",

    "z": "a16b5792.d1842",

    "name": "",

    "topic": "0_userdata.0.Shelly_Pro.Shelly_Pro_4PM.Ausgang_4",

    "ack": "false",

    "autoCreate": "false",

    "stateName": "",

    "role": "",

    "payloadType": "",

    "readonly": "",

    "stateUnit": "",

    "stateMin": "",

    "stateMax": "",

    "x": 1340,

    "y": 620,

    "wires": []

    },

    {

    "id": "a6986fd.d88a41",

    "type": "ioBroker out",

    "z": "a16b5792.d1842",

    "name": "",

    "topic": "0_userdata.0.Shelly_Pro.Shelly_Pro_4PM.Leistung_Ausgang_4",

    "ack": "false",

    "autoCreate": "false",

    "stateName": "",

    "role": "",

    "payloadType": "",

    "readonly": "",

    "stateUnit": "",

    "stateMin": "",

    "stateMax": "",

    "x": 1370,

    "y": 680,

    "wires": []

    },

    {

    "id": "dbbeffd8.0e4ac",

    "type": "change",

    "z": "a16b5792.d1842",

    "name": "",

    "rules": [

    {

    "t": "set",

    "p": "payload",

    "pt": "msg",

    "to": "payload.params[\"switch:3\"].apower",

    "tot": "msg"

    }

    ],

    "action": "",

    "property": "",

    "from": "",

    "to": "",

    "reg": false,

    "x": 930,

    "y": 680,

    "wires": [

    [

    "a6986fd.d88a41"

    ]

    ]

    },

    {

    "id": "bf3eb196.cbadf8",

    "type": "json",

    "z": "a16b5792.d1842",

    "name": "",

    "property": "payload",

    "action": "",

    "pretty": false,

    "x": 690,

    "y": 320,

    "wires": [

    [

    "35bf20cf.e6c2",

    "15b87436.67632c"

    ]

    ]

    },

    {

    "id": "c42c1944.072d68",

    "type": "json",

    "z": "a16b5792.d1842",

    "name": "",

    "property": "payload",

    "action": "",

    "pretty": false,

    "x": 690,

    "y": 480,

    "wires": [

    [

    "2dc89dc4.f16ba2",

    "caddec51.eb77a"

    ]

    ]

    },

    {

    "id": "b16ffc4f.76f59",

    "type": "json",

    "z": "a16b5792.d1842",

    "name": "",

    "property": "payload",

    "action": "",

    "pretty": false,

    "x": 690,

    "y": 640,

    "wires": [

    [

    "1091e8b2.ffeeff",

    "dbbeffd8.0e4ac"

    ]

    ]

    },

    {

    "id": "74adae.9552e254",

    "type": "comment",

    "z": "a16b5792.d1842",

    "name": "Kanal 1 -->",

    "info": "",

    "x": 500,

    "y": 140,

    "wires": []

    },

    {

    "id": "47845359.a5a9c4",

    "type": "comment",

    "z": "a16b5792.d1842",

    "name": "Kanal 2 -->",

    "info": "",

    "x": 500,

    "y": 320,

    "wires": []

    },

    {

    "id": "a6a897cd.b55ec8",

    "type": "comment",

    "z": "a16b5792.d1842",

    "name": "Kanal 3 -->",

    "info": "",

    "x": 500,

    "y": 480,

    "wires": []

    },

    {

    "id": "c26eab0d.acd54",

    "type": "comment",

    "z": "a16b5792.d1842",

    "name": "Kanal 4 -->",

    "info": "",

    "x": 500,

    "y": 640,

    "wires": []

    },

    {

    "id": "f56dd7d5.a4df",

    "type": "mqtt-broker",

    "name": "MQTT-Broker ioB",

    "broker": "localhost",

    "port": "1883",

    "clientid": "",

    "usetls": false,

    "protocolVersion": "4",

    "keepalive": "60",

    "cleansession": true,

    "birthTopic": "",

    "birthQos": "0",

    "birthPayload": "*",

    "birthMsg": {},

    "closeTopic": "",

    "closeQos": "0",

    "closePayload": "",

    "closeMsg": {},

    "willTopic": "",

    "willQos": "0",

    "willPayload": "",

    "willMsg": {},

    "sessionExpiry": ""

    }

    ]


    Viel Spass damit. :) :thumbup:

  • 66er 3. Oktober 2021 um 14:24

    Hat das Thema freigeschaltet.