Alle Shelly Plus 1PM Daten per node-RED verarbeiten

  • Moin,

    ich habe zwei Shelly Plus 1PM, die jeweils eine Pumpe schalten und messen.

    Nun würde ich gerne deren Daten (Schaltzustand, Strom, Spannung, Leistung, Temperatur, RSSI, Energie, uptime, und was es da noch so alles gibt, nach der Sinnhaftigkeit wollen wir noch nicht fragen, weglassen kann man das später immer noch) an meinen Volkszähler (https://www.volkszaehler.org/) senden.

    Hat jemand eine Idee, wie man das umsetzt?

    Die Shelly Plus Version kann "Webhooks", "Scripting", MQTT

    Ich hätte auch Mosquitto und node-RED laufen, wenn es denn was hilft.

    Der Schaltzustand sollte schon direkt an den volkszähler gesendet werden, damit man genau weiß, wann die Pumpen ein- und ausgeschaltet wurden.

    Bei Leistung, Spannung etc. reicht es sicherlich wenn 1x pro Minute die Werte an den volkszähler gesendet werden.

    Aber wie stellt man sowas nun an?

    Vermutlich mit node-RED.

    Das habe ich probiert, aber bekomme da bisher nur Müll oder gar nichts bei raus.

    Ich habs so probiert:

    Spoiler anzeigen


    [{"id":"6e04dba2.b6d594","type":"shelly-gen2","z":"d08244c9.4d2228","hostname":"192.168.178.22","description":"Pumpe1","pollinginterval":5000,"pollstatus":true,"getstatusoncommand":true,"devicetype":"Relay","outputs":1,"x":170,"y":500,"wires":[["72a512e8.f23a4c"]]},{"id":"72a512e8.f23a4c","type":"debug","z":"d08244c9.4d2228","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":330,"y":500,"wires":[]}]

    Ich habs so probiert:

    Spoiler anzeigen


    [{"id":"b2b52078.e4692","type":"mqtt in","z":"d08244c9.4d2228","name":"","topic":"shellies/#","qos":"0","datatype":"auto","broker":"655e7140.aec26","x":200,"y":60,"wires":[["fa190d30.62985"]]},{"id":"fa190d30.62985","type":"debug","z":"d08244c9.4d2228","name":"","active":false,"tosidebar":true,"console":true,"tostatus":true,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":380,"y":60,"wires":[]},{"id":"655e7140.aec26","type":"mqtt-broker","z":"","name":"","broker":"192.168.178.10","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

    Da kommt nix sinnvolles bei raus.

    Schau ich mir das ganze mit dem MQTT Explorer oder der Android App MQTT Tester, dann sehe ich alle nach ner Weile immer mal wieder Nachrichten, die die Werte enthalten, die ich haben will.

    Demnach ist mein Fehler irgendwo in node-RED.

    Hat jemand eine Idee, wie man an die einzelnen Daten von den Shellys in node-RED kommt?

    Vielen Dnk und beste Grüße,

    Chris

  • So wie ich das lese, michrwsr du per Node Red Parsen? Das geht mit dem MQTT IN JSON oder den Function Node.

    66er
    24. September 2021 um 17:31

    Siehe letzten Beitrag #15 von mir, auch die vorhergehenden sind interessant.

    Ansonsten poste die json-Ausgabe benenne einen Beispielwert, den du separiert haben möchtest. Ich habe leider keinen Plus, um es zu probieren.

  • Ahhhhh, ich glaube das könnte was werden :)

    Habe mir erstmal eine debug Ausgabe gebaut:

    Spoiler anzeigen


    [{"id":"ff4e649a.487e68","type":"mqtt-json","z":"dbabca3b.921758","name":"","topic":"Pumpe1/status/switch:0","property":"temperature.tC","qos":"0","broker":"655e7140.aec26","x":160,"y":100,"wires":[["afda365.63b7ac8"]]},{"id":"afda365.63b7ac8","type":"debug","z":"dbabca3b.921758","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":390,"y":100,"wires":[]},{"id":"655e7140.aec26","type":"mqtt-broker","z":"","name":"","broker":"192.168.178.10","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

    An dem mqtt json node ist schonmal eine grüne Ampel "verbunden".

    Ist das soweit richtig?

    Wie kriege ich eine json Ausgabe extrahiert?

    Sind das die jsons, die du meinst?

    Spoiler anzeigen

    Pumpe1/events/rpc

    {"src":"shellyplus1pm-xxxxxxxxxxxx","dst":"Pumpe1/events","method":"NotifyStatus","params":{"ts":1652812140.96,"switch:0":{"id":0,"aenergy":{"by_minute":[0.000,0.000,0.000],"minute_ts":1652812138,"total":7.483}}}}

    Pumpe1/status/switch:0

    {"id":0, "source":"WS_in", "output":false, "apower":0.0, "voltage":229.0, "current":0.000, "aenergy":{"total":7.483,"by_minute":[0.000,0.000,0.000],"minute_ts":1652812078},"temperature":{"tC":53.5, "tF":128.2}}

  • Das komische ist, dass in node-RED nix kommt.

    So sehen meine drei Testnodes aus:

    Spoiler anzeigen


    [{"id":"ff4e649a.487e68","type":"mqtt-json","z":"dbabca3b.921758","name":"","topic":"shellies/Pumpe1/status/switch:0","property":"tC","qos":"0","broker":"655e7140.aec26","x":190,"y":100,"wires":[["afda365.63b7ac8"]]},{"id":"afda365.63b7ac8","type":"debug","z":"dbabca3b.921758","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":390,"y":100,"wires":[]},{"id":"701ce9de.ed3658","type":"mqtt-json","z":"dbabca3b.921758","name":"","topic":"shellies/#","property":"","qos":"0","broker":"655e7140.aec26","x":120,"y":180,"wires":[["45ddfa58.cb25a4"]]},{"id":"45ddfa58.cb25a4","type":"debug","z":"dbabca3b.921758","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":390,"y":180,"wires":[]},{"id":"7b7aac5e.c48364","type":"mqtt-json","z":"dbabca3b.921758","name":"","topic":"Pumpe1/events/rpc","property":"voltage","qos":"0","broker":"655e7140.aec26","x":150,"y":260,"wires":[["bc83eab7.2221a8"]]},{"id":"bc83eab7.2221a8","type":"debug","z":"dbabca3b.921758","name":"","active":true,"tosidebar":true,"console":true,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":390,"y":260,"wires":[]},{"id":"655e7140.aec26","type":"mqtt-broker","z":"","name":"","broker":"192.168.178.10","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

    und so siehts im MQTT Explorer aus.MQTT_Explorer.PNG


    Warum kommt da in node-RED nix an?!

  • Dieses Thema enthält 6 weitere Beiträge, die nur für registrierte Benutzer sichtbar sind, bitte registrieren Sie sich oder melden Sie sich an um diese lesen zu können.