[Node Red] - ShellyMotion2 - Werte in eigene Datenpunkte schreiben

  • Hallo zusammen,

    solange neue Geräte nicht im Shelly-Adapter des ioBroker enthalten sind, bleibt nur der Weg über den "allgemeinen" MQTT-Adapter.

    Mit dem kleinen NodeRed-Flow lassen sich die Betriebswerte des ShellyMoton2 aus dem String in Einzelwerte extrahieren und zuvor angelegte "Eigene Datenpunkte" schreiben. Dadurch werden die Werte unmittelbar als Datenpunkt verfügbar und für weitere Programme / Hausautomationssysteme nutzbar bzw. darstellbar.

    Die anzulegenden Datenpunkte sehen in meinem Fall so aus im MQTT-Adapter:

    Motion2 EO.PNG


    Damit diese nun auch mit Daten befüllt werden, genügt dieser kleine Flow:

    flow.PNG


    Im Topic des "MQTT in" - Nodes (lila) muß die Adresse Eures ShellyMotion2 angepasst werden.

    In den Topics der 5 "ioBroker OUT" - Nodes (blau) muß die Adresse Eurer angelegten Datenpunkte angepasst werden.


    Hier der Flow zum Importieren:

    Spoiler anzeigen

    [

    {

    "id": "6a72c4dae7494075",

    "type": "tab",

    "label": "Shelly Motion 2",

    "disabled": false,

    "info": "",

    "env": []

    },

    {

    "id": "29089dc5c441e0cf",

    "type": "debug",

    "z": "6a72c4dae7494075",

    "name": "",

    "active": false,

    "tosidebar": true,

    "console": false,

    "tostatus": false,

    "complete": "false",

    "statusVal": "",

    "statusType": "auto",

    "x": 370,

    "y": 360,

    "wires": []

    },

    {

    "id": "229eeb71a5bb603d",

    "type": "change",

    "z": "6a72c4dae7494075",

    "name": "",

    "rules": [

    {

    "t": "set",

    "p": "payload",

    "pt": "msg",

    "to": "payload.sensor.motion",

    "tot": "msg"

    }

    ],

    "action": "",

    "property": "",

    "from": "",

    "to": "",

    "reg": false,

    "x": 630,

    "y": 80,

    "wires": [

    [

    "b71a4cb3d543af48",

    "37e9903ef1a3026d"

    ]

    ]

    },

    {

    "id": "b71a4cb3d543af48",

    "type": "debug",

    "z": "6a72c4dae7494075",

    "name": "",

    "active": true,

    "tosidebar": true,

    "console": false,

    "tostatus": false,

    "complete": "false",

    "statusVal": "",

    "statusType": "auto",

    "x": 850,

    "y": 60,

    "wires": []

    },

    {

    "id": "fdd1341b347d4cef",

    "type": "mqtt in",

    "z": "6a72c4dae7494075",

    "name": "ShellyMotion2_Info",

    "topic": "shellies/shellymotion2-000000000000/info",

    "qos": "2",

    "datatype": "auto",

    "broker": "f56dd7d5.a4df",

    "nl": false,

    "rap": true,

    "rh": 0,

    "inputs": 0,

    "x": 130,

    "y": 320,

    "wires": [

    [

    "29089dc5c441e0cf",

    "7cf38606c449738c"

    ]

    ]

    },

    {

    "id": "7cf38606c449738c",

    "type": "json",

    "z": "6a72c4dae7494075",

    "name": "",

    "property": "payload",

    "action": "",

    "pretty": false,

    "x": 390,

    "y": 300,

    "wires": [

    [

    "229eeb71a5bb603d",

    "88a55d9b45300dd2",

    "0b5894c4f460f914",

    "d0c9fd4a5ce59fe9",

    "30136d428b757c8c"

    ]

    ]

    },

    {

    "id": "37e9903ef1a3026d",

    "type": "ioBroker out",

    "z": "6a72c4dae7494075",

    "name": "Bewegung",

    "topic": "mqtt.0.eigene_Objekte.ShellyMotion_Test.Bewegung",

    "ack": "false",

    "autoCreate": "false",

    "stateName": "",

    "role": "",

    "payloadType": "",

    "readonly": "",

    "stateUnit": "",

    "stateMin": "",

    "stateMax": "",

    "x": 850,

    "y": 100,

    "wires": []

    },

    {

    "id": "f7a6cdc324acd501",

    "type": "comment",

    "z": "6a72c4dae7494075",

    "name": "Shelly Motion2",

    "info": "",

    "x": 120,

    "y": 140,

    "wires": []

    },

    {

    "id": "88a55d9b45300dd2",

    "type": "change",

    "z": "6a72c4dae7494075",

    "name": "",

    "rules": [

    {

    "t": "set",

    "p": "payload",

    "pt": "msg",

    "to": "payload.tmp.value",

    "tot": "msg"

    }

    ],

    "action": "",

    "property": "",

    "from": "",

    "to": "",

    "reg": false,

    "x": 630,

    "y": 180,

    "wires": [

    [

    "a405405dd7cf98c9",

    "c0ea46a41d78a002"

    ]

    ]

    },

    {

    "id": "a405405dd7cf98c9",

    "type": "debug",

    "z": "6a72c4dae7494075",

    "name": "",

    "active": true,

    "tosidebar": true,

    "console": false,

    "tostatus": false,

    "complete": "false",

    "statusVal": "",

    "statusType": "auto",

    "x": 850,

    "y": 160,

    "wires": []

    },

    {

    "id": "c0ea46a41d78a002",

    "type": "ioBroker out",

    "z": "6a72c4dae7494075",

    "name": "Temperatur",

    "topic": "mqtt.0.eigene_Objekte.ShellyMotion_Test.Temperatur",

    "ack": "false",

    "autoCreate": "false",

    "stateName": "",

    "role": "",

    "payloadType": "",

    "readonly": "",

    "stateUnit": "",

    "stateMin": "",

    "stateMax": "",

    "x": 850,

    "y": 200,

    "wires": []

    },

    {

    "id": "0b5894c4f460f914",

    "type": "change",

    "z": "6a72c4dae7494075",

    "name": "",

    "rules": [

    {

    "t": "set",

    "p": "payload",

    "pt": "msg",

    "to": "payload.bat.value",

    "tot": "msg"

    }

    ],

    "action": "",

    "property": "",

    "from": "",

    "to": "",

    "reg": false,

    "x": 630,

    "y": 300,

    "wires": [

    [

    "b9ae9c9e3c3aea7b",

    "333f355003a20397"

    ]

    ]

    },

    {

    "id": "b9ae9c9e3c3aea7b",

    "type": "debug",

    "z": "6a72c4dae7494075",

    "name": "",

    "active": true,

    "tosidebar": true,

    "console": false,

    "tostatus": false,

    "complete": "false",

    "statusVal": "",

    "statusType": "auto",

    "x": 850,

    "y": 280,

    "wires": []

    },

    {

    "id": "333f355003a20397",

    "type": "ioBroker out",

    "z": "6a72c4dae7494075",

    "name": "Batterie",

    "topic": "mqtt.0.eigene_Objekte.ShellyMotion_Test.Batterie",

    "ack": "false",

    "autoCreate": "false",

    "stateName": "",

    "role": "",

    "payloadType": "",

    "readonly": "",

    "stateUnit": "",

    "stateMin": "",

    "stateMax": "",

    "x": 840,

    "y": 320,

    "wires": []

    },

    {

    "id": "d0c9fd4a5ce59fe9",

    "type": "change",

    "z": "6a72c4dae7494075",

    "name": "",

    "rules": [

    {

    "t": "set",

    "p": "payload",

    "pt": "msg",

    "to": "payload.lux.value",

    "tot": "msg"

    }

    ],

    "action": "",

    "property": "",

    "from": "",

    "to": "",

    "reg": false,

    "x": 630,

    "y": 420,

    "wires": [

    [

    "f26cf56d201e8fd2",

    "0a82a2e39d72b913"

    ]

    ]

    },

    {

    "id": "f26cf56d201e8fd2",

    "type": "debug",

    "z": "6a72c4dae7494075",

    "name": "",

    "active": true,

    "tosidebar": true,

    "console": false,

    "tostatus": false,

    "complete": "false",

    "statusVal": "",

    "statusType": "auto",

    "x": 850,

    "y": 400,

    "wires": []

    },

    {

    "id": "0a82a2e39d72b913",

    "type": "ioBroker out",

    "z": "6a72c4dae7494075",

    "name": "Helligkeit",

    "topic": "mqtt.0.eigene_Objekte.ShellyMotion_Test.Helligkeit",

    "ack": "false",

    "autoCreate": "false",

    "stateName": "",

    "role": "",

    "payloadType": "",

    "readonly": "",

    "stateUnit": "",

    "stateMin": "",

    "stateMax": "",

    "x": 840,

    "y": 440,

    "wires": []

    },

    {

    "id": "30136d428b757c8c",

    "type": "change",

    "z": "6a72c4dae7494075",

    "name": "",

    "rules": [

    {

    "t": "set",

    "p": "payload",

    "pt": "msg",

    "to": "payload.sensor.active",

    "tot": "msg"

    }

    ],

    "action": "",

    "property": "",

    "from": "",

    "to": "",

    "reg": false,

    "x": 630,

    "y": 520,

    "wires": [

    [

    "6ffd9725cb70b594",

    "0f8401357cde3b4a"

    ]

    ]

    },

    {

    "id": "6ffd9725cb70b594",

    "type": "debug",

    "z": "6a72c4dae7494075",

    "name": "",

    "active": true,

    "tosidebar": true,

    "console": false,

    "tostatus": false,

    "complete": "false",

    "statusVal": "",

    "statusType": "auto",

    "x": 850,

    "y": 500,

    "wires": []

    },

    {

    "id": "0f8401357cde3b4a",

    "type": "ioBroker out",

    "z": "6a72c4dae7494075",

    "name": "Aktiv",

    "topic": "mqtt.0.eigene_Objekte.ShellyMotion_Test.Melder_aktiv",

    "ack": "false",

    "autoCreate": "false",

    "stateName": "",

    "role": "",

    "payloadType": "",

    "readonly": "",

    "stateUnit": "",

    "stateMin": "",

    "stateMax": "",

    "x": 830,

    "y": 540,

    "wires": []

    },

    {

    "id": "f56dd7d5.a4df",

    "type": "mqtt-broker",

    "name": "MQTT-Broker ioB",

    "broker": "localhost",

    "port": "1883",

    "clientid": "",

    "autoConnect": true,

    "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. :)

  • Hallo Stefan,

    ich möchte Dir an dieser Stelle einmal ein ganz dickes DANKESCHÖN! aussprechen :)

    Das hätte ich ohne Deinen Tipp und nun durch Deine "fertige" Lösung nie hinbekommen.

    Mein Frust mit den Motion 1 und der nicht funktionierenden FW im Shelly Adapter hat mich schon viel Zeit und Nerven gekostet.

    Danke für Deine Zeit und Mühe!

    Ich glaube ich muss noch viel lernen!

    Herzliche Grüße

    Bernd

  • Hallo Bernd. :)

    Immer wieder gerne.

    Und Danke für Dein Lob, höre ich natürlich gerne. :thumbup: