Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Tutorial - Shelly via MQTT und NodeRed anbinden
#2
Hier jetzt nochmal eine Variante, um den Stromleistung mittels 2.5 Shelly im Gekko anzeigen zu lassen.
 
Im Beispiel habe ich 3 Shelly 2.5 mit je zwei Relais verwende. Diese verwenden, wie im vorherigen Post erwähnt MQTT und senden ihren aktuellen Zustand somit von "sich" aus.
 
Funktion der einzelnen  2.5 Relais: 
 
1.   Schaltet Licht Wohnzimmer und Licht Esszimmer
2.   Je eine Steckdose hinter der Couch
3.   Schalte zwei unabhängige Lampen im Bad Obergeschoss


   
 
 
Zusätzlich summiere ich in einer Funktion verschiedene Verbraucher mittels NodeRed. Das erspart mir Logiken, da diese mit "den wenigen" Feldern schnell voll wären. Die Summen stelle ich dann einfach dem Gekko als Ergebnis zur Verfügung. 
 
Als Beispiel angelegte Summen 
 
·       Gesamt_WZ:                       Alle Verbraucher im Wohnzimmer
·       Gesamt_EZ:                        Alle Verbraucher im Esszimmer
·       Gesamt_BZ:                        Alle Verbraucher im Badezimmer
·       Gesamt_Licht:                     Alle Verbraucher des Typs Licht
·       Gesamt_Steckdosen:            Alle Verbraucher des Typs Steckdose
·       Gesamt_EG:                        Alle Verbraucher im Erdgeschoss
·       Gesamt_OG:                       Alle Verbraucher im Obergeschoss
·       Gesamt_gesamt:                 Alle Verbraucher des Hauses
 

 
Die Verbraucher einzeln, wie auch die Summen, werden mittels HTTP dem Gekko zur Verfügung gestellt. 
Pro Wert den ihr Abgreifen möchtest benötigt ihr je ein INPUT im Gekko. Ein Output entfällt hier, da wir hier nicht schalten wollen.
 
 
Typ:                                  Get-INPUT 
Read Int:                            0
Request On:                       [IP eures RedNode]:1880/Shelly/Strom
Request Off / Parameter:     JSON@Gesamt_WZ
 

   



Das ganze kann dann weiter verwendet werden, um z.B. Analysen zu betreiben oder was auch immer  Smile


   




Code:
[{"id":"20291643.ca9eea","type":"tab","label":"Strom Beispiel","disabled":false,"info":""},{"id":"33094b6b.8b4254","type":"mqtt in","z":"20291643.ca9eea","name":"33b-Bad-Abstell-POWER","topic":"shellies/33-shelly/relay/1/power","qos":"0","datatype":"auto","broker":"7438383a.9fc788","x":890,"y":360,"wires":[["35a83449.9100ec"]]},{"id":"dbc6f7d8.fb44c8","type":"mqtt in","z":"20291643.ca9eea","name":"33a-Bad-Haupt-POWER","topic":"shellies/33-shelly/relay/0/power","qos":"0","datatype":"auto","broker":"7438383a.9fc788","x":890,"y":320,"wires":[["34049e01.0b3212"]]},{"id":"937ccef7.d28f5","type":"mqtt in","z":"20291643.ca9eea","name":"32b-Esszimmer-POWER","topic":"shellies/32-shelly/relay/1/power","qos":"0","datatype":"auto","broker":"7438383a.9fc788","x":270,"y":360,"wires":[["1b32b18.4d0a04f"]]},{"id":"3aded2e5.8ec08e","type":"mqtt in","z":"20291643.ca9eea","name":"32a-Wohnzimmer-POWER","topic":"shellies/32-shelly/relay/0/power","qos":"0","datatype":"auto","broker":"7438383a.9fc788","x":270,"y":320,"wires":[["1078432b.a0ba7d"]]},{"id":"d29b7f49.33162","type":"mqtt in","z":"20291643.ca9eea","name":"41b-WZ-Sonos-links-POWER","topic":"shellies/41-shelly/relay/1/power","qos":"0","datatype":"auto","broker":"7438383a.9fc788","x":280,"y":460,"wires":[["ac202b4c.3f6178"]]},{"id":"67eab0ed.2afd","type":"mqtt in","z":"20291643.ca9eea","name":"41a-WZ-hinter-Sofa-links-POWER","topic":"shellies/41-shelly/relay/0/power","qos":"0","datatype":"auto","broker":"7438383a.9fc788","x":300,"y":420,"wires":[["9c110868.0244c8"]]},{"id":"32a01465.cc534c","type":"function","z":"20291643.ca9eea","name":"","func":"flow.set('32a-POWER',Number(msg.payload))\nreturn msg;","outputs":0,"noerr":0,"x":535,"y":320,"wires":[],"l":false},{"id":"28c4dbe7.3c3344","type":"function","z":"20291643.ca9eea","name":"","func":"flow.set('32b-POWER',Number(msg.payload))\nreturn msg;","outputs":0,"noerr":0,"x":535,"y":360,"wires":[],"l":false},{"id":"7213f2d1.7c4cdc","type":"function","z":"20291643.ca9eea","name":"","func":"flow.set('33a-POWER',Number(msg.payload))\nreturn msg;","outputs":0,"noerr":0,"x":1155,"y":320,"wires":[],"l":false},{"id":"5b062604.473e58","type":"function","z":"20291643.ca9eea","name":"","func":"flow.set('33b-POWER',Number(msg.payload))\nreturn msg;","outputs":0,"noerr":0,"x":1155,"y":360,"wires":[],"l":false},{"id":"2b2e0b98.ad21b4","type":"function","z":"20291643.ca9eea","name":"","func":"flow.set('41a-POWER',msg.payload)\nreturn msg;","outputs":0,"noerr":0,"x":535,"y":420,"wires":[],"l":false},{"id":"c6764a2.4048eb8","type":"function","z":"20291643.ca9eea","name":"","func":"flow.set('41b-POWER',msg.payload)\nreturn msg;","outputs":0,"noerr":0,"x":535,"y":460,"wires":[],"l":false},{"id":"1078432b.a0ba7d","type":"rbe","z":"20291643.ca9eea","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":475,"y":320,"wires":[["32a01465.cc534c"]],"l":false},{"id":"1b32b18.4d0a04f","type":"rbe","z":"20291643.ca9eea","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":475,"y":360,"wires":[["28c4dbe7.3c3344"]],"l":false},{"id":"35a83449.9100ec","type":"rbe","z":"20291643.ca9eea","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1095,"y":360,"wires":[["5b062604.473e58"]],"l":false},{"id":"34049e01.0b3212","type":"rbe","z":"20291643.ca9eea","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":1095,"y":320,"wires":[["7213f2d1.7c4cdc"]],"l":false},{"id":"9c110868.0244c8","type":"rbe","z":"20291643.ca9eea","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":475,"y":420,"wires":[["2b2e0b98.ad21b4"]],"l":false},{"id":"ac202b4c.3f6178","type":"rbe","z":"20291643.ca9eea","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":475,"y":460,"wires":[["c6764a2.4048eb8"]],"l":false},{"id":"d98c8b4c.0a2eb8","type":"http in","z":"20291643.ca9eea","name":"/Shelly/Strom","url":"/Shelly/Strom","method":"get","upload":false,"swaggerDoc":"","x":90,"y":100,"wires":[["c1009714.19c9b8"]]},{"id":"c1009714.19c9b8","type":"function","z":"20291643.ca9eea","name":"","func":"// Deklaration der Variablen der einzelnen Räume\n\n \n//Wohnzimmer\nvar wz_LI               = Number(flow.get('32a-POWER'));\nvar wz_SD_sofa_re       = Number(flow.get('41a-POWER'));\nvar wz_SD_sofa_li       = Number(flow.get('41b-POWER'));\n\n//Esszimmer\nvar ez_LI               = Number(flow.get('32a-POWER'));\n\n\n//Bad\nvar ba_LI_haupt         = Number(flow.get('33a-POWER'));\nvar ba_LI_abstell       = Number(flow.get('33b-POWER'));\n\n\n\n//Zusammenfassungen / Summenbildung\n\n//Funktion Math.round() rundet auf Ganzzahl // *100 und /100 sorgt für zwei Nachkommastellen\n\n//Räume\nvar gesamt_WZ           = Math.round((wz_LI + wz_SD_sofa_re + wz_SD_sofa_li)*100)/100;\nvar gesamt_EZ           = Math.round((ez_LI)*100)/100;\nvar gesamt_BZ           = Math.round((ba_LI_haupt + ba_LI_abstell)*100)/100;\n\n//Licht /Steckdosen /EG /OG /Gesamt\nvar gesamt_Licht        = wz_LI + ez_LI + ba_LI_haupt + ba_LI_abstell;\nvar gesamt_Steckdosen   = wz_SD_sofa_re + wz_SD_sofa_li;\nvar gesamt_EG           = gesamt_WZ + gesamt_EZ;\nvar gesamt_OG           = gesamt_BZ;\nvar gesamt_gesamt       = gesamt_EG + gesamt_OG;\n\n\nvar o=\n        {\n        Gesamt_gesamt:gesamt_gesamt,\n        \n        Gesamt_EG:gesamt_EG,\n        \n        Gesamt_WZ:gesamt_WZ,\n        Gesamt_EZ:gesamt_EZ,\n        Gesamt_FL:gesamt_FL,\n        \n        Gesamt_OG:gesamt_OG,\n\n        Gesamt_BZ:gesamt_BZ,\n        \n        Gesamt_Licht:gesamt_Licht,\n        Gesamt_Steckdosen:gesamt_Steckdosen,\n        };\nmsg.payload  = JSON.stringify(o);\nreturn msg;","outputs":1,"noerr":0,"x":195,"y":100,"wires":[["f52d71db.4d967"]],"l":false},{"id":"f52d71db.4d967","type":"http response","z":"20291643.ca9eea","name":"HTTP-Response","statusCode":"200","headers":{"content-type":"text/html"},"x":330,"y":100,"wires":[]},{"id":"51a9aecb.b6faa","type":"comment","z":"20291643.ca9eea","name":"EG","info":"","x":220,"y":240,"wires":[]},{"id":"fe99549b.a69428","type":"comment","z":"20291643.ca9eea","name":"OG","info":"","x":830,"y":240,"wires":[]},{"id":"9fe80d75.f1b76","type":"comment","z":"20291643.ca9eea","name":"Licht","info":"","x":50,"y":340,"wires":[]},{"id":"75ef05ea.96daec","type":"comment","z":"20291643.ca9eea","name":"Steckdosen","info":"","x":70,"y":440,"wires":[]},{"id":"2cc5dd28.7035f2","type":"comment","z":"20291643.ca9eea","name":"Licht","info":"","x":710,"y":340,"wires":[]},{"id":"7438383a.9fc788","type":"mqtt-broker","z":"","name":"MQTT Broker","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]


Nachrichten in diesem Thema
RE: Shelly via MQTT und NodeRed anbinden - von Strabbit - 18.03.2020, 13:41

Möglicherweise verwandte Themen...
Thema Verfasser Antworten Ansichten Letzter Beitrag
Information Tutorial - Konfiguration Shelly am Gekko Licht / Steckdose Strabbit 33 7.662 14.11.2020, 01:34
Letzter Beitrag: Strabbit
Information Tutorial- Integration Regenradar Strabbit 6 1.725 09.07.2020, 07:39
Letzter Beitrag: Strabbit
  AVM DECT 200 / 210 an das Gekko anbinden nowtilus 8 5.263 29.05.2019, 17:55
Letzter Beitrag: santos

Gehe zu:


Benutzer, die gerade dieses Thema anschauen:
1 Gast/Gäste