[Node Red] - ShellyPlusHT 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 ShellyPlusHT 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:

    Der Inhalt kann nicht angezeigt werden, da Sie keine Berechtigung haben, diesen Inhalt zu sehen.

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

    Der Inhalt kann nicht angezeigt werden, da Sie keine Berechtigung haben, diesen Inhalt zu sehen.

    In den Topics der 3 "MQTT in" - Nodes (lila) muß die Adresse Eures ShellyPlusHT angepasst werden.

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

    Hier der Flow zum Importieren:

    Spoiler anzeigen

    [

    {

    "id": "8fbb2ec2.087d2",

    "type": "tab",

    "label": "ShellyPlus HT",

    "disabled": false,

    "info": ""

    },

    {

    "id": "ade88c3ec407beaf",

    "type": "mqtt in",

    "z": "8fbb2ec2.087d2",

    "name": "",

    "topic": "shellyplusht-000000000000/status/temperature:0",

    "qos": "0",

    "datatype": "auto",

    "broker": "f56dd7d5.a4df",

    "nl": false,

    "rap": true,

    "rh": 0,

    "inputs": 0,

    "x": 220,

    "y": 240,

    "wires": [

    [

    "02b844f09f14f60e"

    ]

    ]

    },

    {

    "id": "a78a30e5ccfa78c4",

    "type": "change",

    "z": "8fbb2ec2.087d2",

    "name": "",

    "rules": [

    {

    "t": "set",

    "p": "payload",

    "pt": "msg",

    "to": "payload.tC",

    "tot": "msg"

    }

    ],

    "action": "",

    "property": "",

    "from": "",

    "to": "",

    "reg": false,

    "x": 670,

    "y": 240,

    "wires": [

    [

    "7ba05d8283472566",

    "f6c89ef0345ce53c"

    ]

    ]

    },

    {

    "id": "7ba05d8283472566",

    "type": "debug",

    "z": "8fbb2ec2.087d2",

    "name": "",

    "active": false,

    "tosidebar": true,

    "console": false,

    "tostatus": false,

    "complete": "false",

    "statusVal": "",

    "statusType": "auto",

    "x": 890,

    "y": 200,

    "wires": []

    },

    {

    "id": "02b844f09f14f60e",

    "type": "json",

    "z": "8fbb2ec2.087d2",

    "name": "",

    "property": "payload",

    "action": "",

    "pretty": false,

    "x": 490,

    "y": 240,

    "wires": [

    [

    "a78a30e5ccfa78c4"

    ]

    ]

    },

    {

    "id": "350214d1a6ac91ae",

    "type": "comment",

    "z": "8fbb2ec2.087d2",

    "name": "Temperatur",

    "info": "",

    "x": 110,

    "y": 180,

    "wires": []

    },

    {

    "id": "99bae5450f7c1e9b",

    "type": "change",

    "z": "8fbb2ec2.087d2",

    "name": "",

    "rules": [

    {

    "t": "set",

    "p": "payload",

    "pt": "msg",

    "to": "payload.rh",

    "tot": "msg"

    }

    ],

    "action": "",

    "property": "",

    "from": "",

    "to": "",

    "reg": false,

    "x": 670,

    "y": 440,

    "wires": [

    [

    "be9dd2c760fedd3d",

    "0e07021ad98e3df8"

    ]

    ]

    },

    {

    "id": "3f9d23e8582e411e",

    "type": "json",

    "z": "8fbb2ec2.087d2",

    "name": "",

    "property": "payload",

    "action": "",

    "pretty": false,

    "x": 490,

    "y": 440,

    "wires": [

    [

    "99bae5450f7c1e9b"

    ]

    ]

    },

    {

    "id": "be9dd2c760fedd3d",

    "type": "debug",

    "z": "8fbb2ec2.087d2",

    "name": "",

    "active": false,

    "tosidebar": true,

    "console": false,

    "tostatus": false,

    "complete": "false",

    "statusVal": "",

    "statusType": "auto",

    "x": 890,

    "y": 400,

    "wires": []

    },

    {

    "id": "d101c7c432a237fd",

    "type": "mqtt in",

    "z": "8fbb2ec2.087d2",

    "name": "",

    "topic": "shellyplusht-000000000000/status/humidity:0",

    "qos": "0",

    "datatype": "auto",

    "broker": "f56dd7d5.a4df",

    "nl": false,

    "rap": true,

    "rh": 0,

    "inputs": 0,

    "x": 210,

    "y": 440,

    "wires": [

    [

    "3f9d23e8582e411e"

    ]

    ]

    },

    {

    "id": "bd3293d14484d8ac",

    "type": "comment",

    "z": "8fbb2ec2.087d2",

    "name": "Luftfeuchte",

    "info": "",

    "x": 100,

    "y": 380,

    "wires": []

    },

    {

    "id": "0e07021ad98e3df8",

    "type": "ioBroker out",

    "z": "8fbb2ec2.087d2",

    "name": "Luftfeuchte",

    "topic": "mqtt.0.eigene_Objekte.ShellyPlusHT.Luftfeuchte",

    "ack": "false",

    "autoCreate": "false",

    "stateName": "",

    "role": "",

    "payloadType": "",

    "readonly": "",

    "stateUnit": "",

    "stateMin": "",

    "stateMax": "",

    "x": 890,

    "y": 460,

    "wires": []

    },

    {

    "id": "f6c89ef0345ce53c",

    "type": "ioBroker out",

    "z": "8fbb2ec2.087d2",

    "name": "Temperatur",

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

    "ack": "false",

    "autoCreate": "false",

    "stateName": "",

    "role": "",

    "payloadType": "",

    "readonly": "",

    "stateUnit": "",

    "stateMin": "",

    "stateMax": "",

    "x": 890,

    "y": 280,

    "wires": []

    },

    {

    "id": "848037b58c87d922",

    "type": "comment",

    "z": "8fbb2ec2.087d2",

    "name": "Batterie (%)",

    "info": "",

    "x": 110,

    "y": 540,

    "wires": []

    },

    {

    "id": "5f47bc370536ad12",

    "type": "mqtt in",

    "z": "8fbb2ec2.087d2",

    "name": "",

    "topic": "shellyplusht-000000000000/status/devicepower:0",

    "qos": "0",

    "datatype": "auto",

    "broker": "f56dd7d5.a4df",

    "nl": false,

    "rap": true,

    "rh": 0,

    "inputs": 0,

    "x": 220,

    "y": 600,

    "wires": [

    [

    "e235f718edb2296c"

    ]

    ]

    },

    {

    "id": "e235f718edb2296c",

    "type": "json",

    "z": "8fbb2ec2.087d2",

    "name": "",

    "property": "payload",

    "action": "",

    "pretty": false,

    "x": 490,

    "y": 600,

    "wires": [

    [

    "f40e2055084716fe"

    ]

    ]

    },

    {

    "id": "f40e2055084716fe",

    "type": "change",

    "z": "8fbb2ec2.087d2",

    "name": "",

    "rules": [

    {

    "t": "set",

    "p": "payload",

    "pt": "msg",

    "to": "payload.battery.percent",

    "tot": "msg"

    }

    ],

    "action": "",

    "property": "",

    "from": "",

    "to": "",

    "reg": false,

    "x": 670,

    "y": 600,

    "wires": [

    [

    "4a7c08856370a994",

    "0a0738b9b40d6633"

    ]

    ]

    },

    {

    "id": "4a7c08856370a994",

    "type": "debug",

    "z": "8fbb2ec2.087d2",

    "name": "",

    "active": false,

    "tosidebar": true,

    "console": false,

    "tostatus": false,

    "complete": "false",

    "statusVal": "",

    "statusType": "auto",

    "x": 890,

    "y": 560,

    "wires": []

    },

    {

    "id": "0a0738b9b40d6633",

    "type": "ioBroker out",

    "z": "8fbb2ec2.087d2",

    "name": "Batterie (%)",

    "topic": "mqtt.0.eigene_Objekte.ShellyPlusHT.Batterieladung",

    "ack": "false",

    "autoCreate": "false",

    "stateName": "",

    "role": "",

    "payloadType": "",

    "readonly": "",

    "stateUnit": "",

    "stateMin": "",

    "stateMax": "",

    "x": 890,

    "y": 640,

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

    Edit:

    Namenskorrektur in Bild und Flow, Danke an Whity . :thumbup:

  • Da ich hinsichtlich NodeRed den Status Anfänger habe, nein, denn ich kenne noch nicht alle Nodes.

    Es steht Dir natürlich frei, andere und eventuell bessere Lösungen in einem eigenen Thread zu publizieren.

    Danke dafür vorab.

    (Ich bin mit meiner selbst erarbeiteten Lösung zufrieden, da sie funktioniert und ich hinsichtlich dem Batteriestatus nebenbei nochmals dazulernen durfte, ;) )

  • Danke Whity . :thumbup:

    Ändere ich gleich wenn ich wieder zu Hause bin.


    Edit: done

  • Dieses Thema enthält 2 weitere Beiträge, die nur für registrierte Benutzer sichtbar sind.