Cookies op Tweakers

Tweakers maakt gebruik van cookies, onder andere om de website te analyseren, het gebruiksgemak te vergroten en advertenties te tonen. Door gebruik te maken van deze website, of door op 'Ga verder' te klikken, geef je toestemming voor het gebruik van cookies. Wil je meer informatie over cookies en hoe ze worden gebruikt, bekijk dan ons cookiebeleid.

Meer informatie
Ik heb je flow geïmporteerd, maar wat wil je bewijzen?

  • Dylantje2
  • Registratie: april 2007
  • Laatst online: 12:46

Dylantje2

sorry Bricklayere here :-)

lolgast schreef op woensdag 29 januari 2020 @ 09:38:
Ik heb je flow geïmporteerd, maar wat wil je bewijzen?
ik wil niet veel bewijzen..

De bovenste 2 zijn pirren die werken [ wel zonder batterij ]
Maar de onderste is een schakelaar, en die werkt niet...

Dan zie ik bij de flow dat er ook ene mogelijkheid voor batterij die zou erg mooi zijn als die erbij kwam...

zonneboiler, pelletkachel, 27 panels, Atlantic Wpb, pana 5 Kw H met LANbox, Domoticz, Grafana, Solarmeters, WPboiler: http://wqd.nl/dP9y, WP: http://wqd.nl/9GVg, Pana H versie thread: https://bit.ly/2Or4Unp


  • BlackShadow
  • Registratie: februari 2002
  • Laatst online: 10:23
Ik ben sinds kort gestart met node-red, ik ben stilaan HA automations aan het overzetten.

Ik zou graag een melding krijgen als de temperatuur in een ruimte x minuten boven een bepaalde waarde komt.
Ik dacht hiervoor aan de stoptimer, maar deze reset telkens als er een nieuw bericht binnen komt.
Een oplossing waar ik aan dacht was om een functie te schrijven die een 1 stuurt als de temperatuur hoger is, gecombineerd een rbe node (die enkel door laat als het bericht wijzigt) met nadien een switch die de timer start bij 1 of de timer stopt bij 0.
Maar iets zegt me dat het veel simpeler kan :+
BlackShadow schreef op donderdag 30 januari 2020 @ 13:12:
Ik ben sinds kort gestart met node-red, ik ben stilaan HA automations aan het overzetten.

Ik zou graag een melding krijgen als de temperatuur in een ruimte x minuten boven een bepaalde waarde komt.
Ik dacht hiervoor aan de stoptimer, maar deze reset telkens als er een nieuw bericht binnen komt.
Een oplossing waar ik aan dacht was om een functie te schrijven die een 1 stuurt als de temperatuur hoger is, gecombineerd een rbe node (die enkel door laat als het bericht wijzigt) met nadien een switch die de timer start bij 1 of de timer stopt bij 0.
Maar iets zegt me dat het veel simpeler kan :+
Even snel in elkaar geflanst:
https://tweakers.net/ext/f/BjMWk55sd8S4D6iNSblqPess/thumb.png

Temperatuur komt binnen, de change node checkt of het >20 graden is. Als dat zo is, neemt hij de volgende 15m geen nieuwe temperatuurmetingen in behandeling, en gaat hij 15 minuten wachten of de temperatuur weer zakt onder de 25 graden. Zo nee, dan stuurt hij via de timeout-uitgang van de node een bericht.

code:
1
[{"id":"64dd4344.a597dc","type":"server-state-changed","z":"91bbb88f.f536a","name":"Temperatuur boven","server":"5cd493e.d5b77ec","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.temperatuur_boven","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":190,"y":440,"wires":[["164d984b.06e85"]]},{"id":"164d984b.06e85","type":"switch","z":"91bbb88f.f536a","name":">20 graden?","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"20","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":440,"wires":[["7742d198.e40cb8"]]},{"id":"504b2f36.c88b78","type":"ha-wait-until","z":"91bbb88f.f536a","name":"15m wachten op afkoelen","server":"5cd493e.d5b77ec","outputs":2,"entityId":"sensor.temperatuur_boven","property":"state","comparator":"lt","value":"20","valueType":"num","timeout":"15","timeoutUnits":"minutes","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":750,"y":440,"wires":[[],["9843dd0d.49c2d8"]]},{"id":"9843dd0d.49c2d8","type":"telegrambot-notify","z":"91bbb88f.f536a","name":"Telegram","bot":"277f3910.4cb4f6","chatId":"","message":"Het is al een kwartier >25 graden boven","parseMode":"","x":950,"y":460,"wires":[]},{"id":"7742d198.e40cb8","type":"delay","z":"91bbb88f.f536a","name":"Max 1x per 15m","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":540,"y":440,"wires":[["504b2f36.c88b78"]]},{"id":"5cd493e.d5b77ec","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"277f3910.4cb4f6","type":"telegrambot-config","z":"","botname":"Home Assistant","usernames":"","chatIds":"123456","pollInterval":"300"}]

[Voor 94% gewijzigd door DeadMetal op 30-01-2020 15:46]


  • BlackShadow
  • Registratie: februari 2002
  • Laatst online: 10:23
DeadMetal schreef op donderdag 30 januari 2020 @ 15:33:
[...]


Even snel in elkaar geflanst:
[Afbeelding]

Temperatuur komt binnen, de change node checkt of het >20 graden is. Als dat zo is, neemt hij de volgende 15m geen nieuwe temperatuurmetingen in behandeling, en gaat hij 15 minuten wachten of de temperatuur weer zakt onder de 25 graden. Zo nee, dan stuurt hij via de timeout-uitgang van de node een bericht.

code:
1
[{"id":"64dd4344.a597dc","type":"server-state-changed","z":"91bbb88f.f536a","name":"Temperatuur boven","server":"5cd493e.d5b77ec","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.temperatuur_boven","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":190,"y":440,"wires":[["164d984b.06e85"]]},{"id":"164d984b.06e85","type":"switch","z":"91bbb88f.f536a","name":">20 graden?","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"20","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":440,"wires":[["7742d198.e40cb8"]]},{"id":"504b2f36.c88b78","type":"ha-wait-until","z":"91bbb88f.f536a","name":"15m wachten op afkoelen","server":"5cd493e.d5b77ec","outputs":2,"entityId":"sensor.temperatuur_boven","property":"state","comparator":"lt","value":"20","valueType":"num","timeout":"15","timeoutUnits":"minutes","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":750,"y":440,"wires":[[],["9843dd0d.49c2d8"]]},{"id":"9843dd0d.49c2d8","type":"telegrambot-notify","z":"91bbb88f.f536a","name":"Telegram","bot":"277f3910.4cb4f6","chatId":"","message":"Het is al een kwartier >25 graden boven","parseMode":"","x":950,"y":460,"wires":[]},{"id":"7742d198.e40cb8","type":"delay","z":"91bbb88f.f536a","name":"Max 1x per 15m","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":540,"y":440,"wires":[["504b2f36.c88b78"]]},{"id":"5cd493e.d5b77ec","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true},{"id":"277f3910.4cb4f6","type":"telegrambot-config","z":"","botname":"Home Assistant","usernames":"","chatIds":"123456","pollInterval":"300"}]
Is het dan niet zo dat als de temperatuur onder de drempel zakt binnen die 15 minuten, dat ik sowieso een melding krijg?

ipv te pauzeren zou een teller die niet reset bij elk nieuw bericht veel potentieel bieden.
In Home Assistant is her poepsimpel:
YAML:
1
2
3
4
5
6
  trigger:
    platform: numeric_state
    entity_id: sensor.temp
    above: 25
    for:
      minutes: 15

[Voor 5% gewijzigd door BlackShadow op 30-01-2020 18:22]

BlackShadow schreef op donderdag 30 januari 2020 @ 16:33:
[...]
Is het dan niet zo dat als de temperatuur onder de drempel zakt binnen die 15 minuten, dat ik sowieso een melding krijg?
Nee, die 'wait until' node wacht binnen de gestelde tijd todat de waarde onder de drempel zakt. Als dat gebeurt, gaat het bericht verder via de bovenste uitgang. Maar daar heb ik in mijn voorbeeld niks aan gekoppeld.
Als het na 15 minuten nog steeds warm is, dus als de ingestelde timeout-waarde bereikt is, gaat hij via de onderste uitgang verder, en stuurt hij een bericht.

Ook wordt er niks gereset, alle nieuwe temperatuur-waarden binnen de eerste 15 minuten nadat een 'te hoge temperatuur' wordt gemeten worden weggegooid (door die node gelabeld 'max 1x per 15m'). Zodat gedurende die 15m enkel die 'wait-until'-node aan het werk is.

En voel je natuurlijk niet verplicht om alles in NR te stoppen, je kan prima per situatie bekijken wat het meest geschikt is, NR of HA. Ik heb 2 dingen in HA, verder alles in NR.

[Voor 6% gewijzigd door DeadMetal op 30-01-2020 18:57]


  • imdos
  • Registratie: maart 2000
  • Laatst online: 06-04 12:08

imdos

I use FreeNAS and Ubuntu

never mind. Het werkt nu.

[Voor 93% gewijzigd door imdos op 31-01-2020 15:30. Reden: gefixed!]

pvoutput. Waarom makkelijk doen, als het ook moeilijk kan! Every solution has a new problem


  • césaar
  • Registratie: september 2006
  • Laatst online: 06-04 04:37
Vroeger deed ik het via homebridge en wat zelf geschreven shell scripts, nu met node red en homekit-bridged:
Garagepoort bediening via siri. Hardware is een raspberry pi met relay board en een afstandsbediening.
code:
1
[{"id":"f475dcf5.99aa9","type":"rpi-gpio out","z":"8ac667fa.c2cec8","name":"","pin":"3","set":true,"level":"1","freq":"","out":"out","x":587,"y":516,"wires":[]},{"id":"8b7229f4.e99c98","type":"switch","z":"8ac667fa.c2cec8","name":"Set","property":"payload.On","propertyType":"msg","rules":[{"t":"cont","v":"true","vt":"str"},{"t":"cont","v":"false","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":256,"y":521,"wires":[["1b2e4073.ee80f"],["f5045bc.582c2a8"]]},{"id":"1b2e4073.ee80f","type":"trigger","z":"8ac667fa.c2cec8","op1":"0","op2":"1","op1type":"str","op2type":"str","duration":"750","extend":false,"units":"ms","reset":"","bytopic":"all","name":"PushTime","x":417,"y":515,"wires":[["f475dcf5.99aa9","54fc9876.7a6578"]]},{"id":"c9cdd2b3.5a186","type":"rpi-gpio out","z":"8ac667fa.c2cec8","name":"","pin":"7","set":true,"level":"1","freq":"","out":"out","x":607,"y":746,"wires":[]},{"id":"f5045bc.582c2a8","type":"trigger","z":"8ac667fa.c2cec8","op1":"0","op2":"1","op1type":"str","op2type":"str","duration":"750","extend":false,"units":"ms","reset":"","bytopic":"all","name":"PushTime","x":437,"y":746,"wires":[["c9cdd2b3.5a186"]]},{"id":"80e8208d.6ac17","type":"change","z":"8ac667fa.c2cec8","name":"AutoTurnOffSwitch","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"On\":false}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":144,"y":665,"wires":[["eef33ec2.a744d"]]},{"id":"eef33ec2.a744d","type":"homekit-service","z":"8ac667fa.c2cec8","isParent":true,"bridge":"4c36a4e3.de153c","parentService":"","name":"Poort","serviceName":"Switch","topic":"","filter":false,"manufacturer":"JeroVanl","model":"PushButton","serialNo":"07/04/2019","characteristicProperties":"{}","x":121,"y":521,"wires":[["8b7229f4.e99c98"],[]]},{"id":"54fc9876.7a6578","type":"delay","z":"8ac667fa.c2cec8","name":"","pauseType":"delay","timeout":"120","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":594,"y":593,"wires":[["80e8208d.6ac17"]]},{"id":"4c36a4e3.de153c","type":"homekit-bridge","z":"","bridgeName":"BridgeOnNodeRed","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"JeroVanl","model":"MQTT_Talk","serialNo":"24/03/2019","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true}]


https://i.ibb.co/syCVxB5/flow1.jpg


Notificaties als de poort opengaat of ongewenst openstaat, krijg ik via een aqara contact sensor.
https://i.ibb.co/5vxycSL/image.jpg
Het zigbee bericht van deze module wordt opgevist door een zigbee sniffer. Het bericht wordt omgezet naar mqtt via zigbee2mqtt.

code:
1
[{"id":"9f8e1b4a.9c7638","type":"mqtt in","z":"8ac667fa.c2cec8","name":"GarageStatus","topic":"zigbee2mqtt/GaragePoortContact","qos":"2","datatype":"auto","broker":"1e53b5d8.56e33a","x":95,"y":842,"wires":[["7bb24e00.a9ce7"]]},{"id":"7bb24e00.a9ce7","type":"json","z":"8ac667fa.c2cec8","name":"","property":"payload","action":"","pretty":false,"x":247,"y":844,"wires":[["4ef2b7df.043c38","e1b6851a.bc3058"]]},{"id":"da693e7c.cfc92","type":"debug","z":"8ac667fa.c2cec8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":644,"y":904,"wires":[]},{"id":"4ef2b7df.043c38","type":"function","z":"8ac667fa.c2cec8","name":"GetContact","func":"msg.payload.contact;\nif ( msg.payload.contact ) {\n msg.payload = {\n ContactSensorState: 0\n }\n} else {\n msg.payload = {\n ContactSensorState: 1\n }\n}\n\nreturn [msg];","outputs":1,"noerr":0,"x":423,"y":843,"wires":[["da693e7c.cfc92","a4682462.436708"]]},{"id":"a4682462.436708","type":"homekit-service","z":"8ac667fa.c2cec8","isParent":true,"bridge":"4c36a4e3.de153c","parentService":"","name":"GarageStatus","serviceName":"ContactSensor","topic":"","filter":false,"manufacturer":"JeroVanl","model":"Aqara-Xiaomi","serialNo":"24/03/2019","characteristicProperties":"{}","x":642.9195365905762,"y":836.2797031402588,"wires":[[],[]]},{"id":"c8906444.4c74c8","type":"homekit-service","z":"8ac667fa.c2cec8","isParent":false,"bridge":"","parentService":"a4682462.436708","name":"Garage Battery","serviceName":"BatteryService","topic":"","filter":false,"manufacturer":"JeroVanl","model":"xiaomi/aqara","serialNo":"07/04/2019","characteristicProperties":"{}","x":677,"y":980,"wires":[[],[]]},{"id":"e1b6851a.bc3058","type":"function","z":"8ac667fa.c2cec8","name":"GetBattery","func":"msg.payload = {\n    BatteryLevel: parseFloat(msg.payload.battery)\n}\nreturn msg;","outputs":1,"noerr":0,"x":425,"y":900,"wires":[["c8906444.4c74c8"]]},{"id":"c6eba9df.d3cca8","type":"inject","z":"8ac667fa.c2cec8","name":"IfNewBatNotUpd","topic":"","payload":"{\"BatteryLevel\":100}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":114,"y":979,"wires":[["c8906444.4c74c8"]]},{"id":"1e53b5d8.56e33a","type":"mqtt-broker","z":"","name":"MQTTonRasp","broker":"192.168.2.61","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"4c36a4e3.de153c","type":"homekit-bridge","z":"","bridgeName":"BridgeOnNodeRed","pinCode":"111-11-111","port":"","allowInsecureRequest":false,"manufacturer":"JeroVanl","model":"MQTT_Talk","serialNo":"24/03/2019","customMdnsConfig":false,"mdnsMulticast":true,"mdnsInterface":"","mdnsPort":"","mdnsIp":"","mdnsTtl":"","mdnsLoopback":true,"mdnsReuseAddr":true}]


https://i.ibb.co/Jx4pygG/flow2.jpg

  • Pimmetje651
  • Registratie: oktober 2001
  • Laatst online: 10:48
JDunnio schreef op zondag 26 januari 2020 @ 20:18:
@Pimmetje651

Dit is de simpele versie zonder de subflow:
code:
1
[{"id":"a492e35a.380628","type":"api-current-state","z":"283de3b.cc2271c","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.zw_fbd2_wk_plafond_level_s1","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":580,"y":400,"wires":[["8ff1b0db.2f5fe8","73b1fa12.1f145c"]]},{"id":"139ad439.5d3574","type":"function","z":"283de3b.cc2271c","name":"Reset State","func":"var flow_data = flow.get(\"livingroom_ceiling\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.zw_fbd2_wk_plafond_level_s1\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":590,"y":520,"wires":[["829f4889.78b7b","73b1fa12.1f145c"]]},{"id":"2afe9012.9e4c5","type":"switch","z":"283de3b.cc2271c","name":"On/Off","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"store","vt":"str"},{"t":"eq","v":"reset","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":420,"y":433,"wires":[["a492e35a.380628"],["139ad439.5d3574"]]},{"id":"321a7139.803c56","type":"inject","z":"283de3b.cc2271c","name":"","topic":"","payload":"store","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":260,"y":393,"wires":[["2afe9012.9e4c5"]]},{"id":"2201108a.6b8fa8","type":"inject","z":"283de3b.cc2271c","name":"","topic":"","payload":"reset","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":260,"y":453,"wires":[["2afe9012.9e4c5"]]},{"id":"8ff1b0db.2f5fe8","type":"function","z":"283de3b.cc2271c","name":"Store state","func":"flow.set(\"livingroom_ceiling\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":728,"y":399,"wires":[[]]},{"id":"a5d69c23.8dcc6","type":"comment","z":"283de3b.cc2271c","name":"Voorbeeld","info":"","x":246,"y":353,"wires":[]},{"id":"829f4889.78b7b","type":"api-call-service","z":"283de3b.cc2271c","name":"Call Service","server":"23176b84.edef7c","version":1,"service_domain":"light","service":"turn_on","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":790,"y":520,"wires":[[]]},{"id":"73b1fa12.1f145c","type":"debug","z":"283de3b.cc2271c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":750,"y":460,"wires":[]},{"id":"23176b84.edef7c","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false}]


Plaatje op: [Afbeelding]

1 - met je injectnode stuur je store of reset naar de switch node
2 - de switchnode bepaalt of het een store of een reset is, hier heb ik in de uitgebreide versie dus een subflow omheen gemaakt en naast de store en reset ook store_kitchen, reset_kitchen etc. omheen gemaakt. Uitbreiding van deze flow dus.
3 - de get state node haalt de status van een lamp op
4 - de function node zet de complete msg.data (van voorgaande node de complete status van de lamp) in de variabele "livingroom_ceiling" op flow level (flow.set)

De reset sequence:
1- de injectnode zelfde als hierboven
2 - de switchnode zelfde als hierboven
3 - de functionnode "reset state" haalt de variabele "livingroom_ceiling" op die hierboven aangemaakt is.
Vervolgens maakt deze functie een msg payload. Let op dat hier ook het lamp id staat die je moet wijzigen. In dit geval "light.zw_fbd2_wk_plafond_level_s1"
Let op dat dit op flow level is en dus alleen in dezelfde flow kan.
4 - de in de voorgaande node gaat naar een servicenode met domain light. Alle andere velden zijn niet belangrijk omdat deze al in de msg.payload staan

NB: in het subflow voorbeeld heb ik de variabelen op global level (global.set) opgeslagen omdat de informatie niet tussen subflows en de hoofdflow uitgewisseld kan worden.

Als iemand weet hoe dit eenvoudiger kan houd ik me ook aanbevolen :9
ben zelf eens gaan proberen (eindelijk beetje tijd gevonde), en daar de ID's aangepast naar mijn Hue lampen, maar ik krijg
code:
1
Error: Invalid property expression: unexpected ' ' at position 9


gevonden, nu eens testen hoe het werkt en hoe ik dit kan gebruiken voor meerdere lampen en icm de PIR detectie

[Voor 1% gewijzigd door Pimmetje651 op 03-02-2020 15:14. Reden: opgelost]

Its'nice 2be important, but it's more important 2be nice


  • Pimmetje651
  • Registratie: oktober 2001
  • Laatst online: 10:48
Pimmetje651 schreef op maandag 3 februari 2020 @ 15:00:
[...]

ben zelf eens gaan proberen (eindelijk beetje tijd gevonde), en daar de ID's aangepast naar mijn Hue lampen, maar ik krijg
code:
1
Error: Invalid property expression: unexpected ' ' at position 9


gevonden, nu eens testen hoe het werkt en hoe ik dit kan gebruiken voor meerdere lampen en icm de PIR detectie
@JDunnio hoe heb je er meerdere lampen aan gekoppeld ? Of is het met een groep ook mogelijk?

Its'nice 2be important, but it's more important 2be nice


  • JDunnio
  • Registratie: augustus 2018
  • Laatst online: 07-04 22:01
Pimmetje651 schreef op woensdag 5 februari 2020 @ 15:37:
[...]

@JDunnio hoe heb je er meerdere lampen aan gekoppeld ? Of is het met een groep ook mogelijk?
Ja ik heb per kamer en voor de lampen gekoppeld aan mijn alarm een aparte store. Dan kun je ervoor kiezen om vervolgens de hele kamer te restoren, maar je kunt natuurlijk ook één lamp uit de variabelen terug halen.

Ik gebruik het zelf alleen per kamer. Ik heb nog geen use case voor een store van een hele kamer zonder dat ik hem ook restore. De automations die ik heb zijn meestal voor knipperende lampen of voor als het alarm getriggered wordt.

Maar dit gebeurd dus in de subflows.

  • Robje1244
  • Registratie: augustus 2009
  • Laatst online: 07-04 21:53
Ik loop weer eens vast met node-red maar volgens mij is het helemaal niet zo moeilijk. Ik probeer mijn wtw ventilatie aan te sturen met twee co2 sensors. Een voor de slaapkamer en, een in de woonkamer. Hoe kan ik deze 2 sensoren combineren? Dus dat hij altijd de hoogste waarde pakt. Kan dit met een specifieke node? Of hoe doen jullie dit?

  • Kaspers
  • Registratie: juni 2004
  • Laatst online: 03-04 17:51
Robje1244 schreef op maandag 10 februari 2020 @ 20:39:
Ik loop weer eens vast met node-red maar volgens mij is het helemaal niet zo moeilijk. Ik probeer mijn wtw ventilatie aan te sturen met twee co2 sensors. Een voor de slaapkamer en, een in de woonkamer. Hoe kan ik deze 2 sensoren combineren? Dus dat hij altijd de hoogste waarde pakt. Kan dit met een specifieke node? Of hoe doen jullie dit?
Ik zou 't als volgt doen:

https://i.imgur.com/1a4wv8h.png

https://i.imgur.com/iszIIPR.png


code:
1
[{"id":"7f55f0bb.78bd7","type":"change","z":"9336d0ba.713528","name":"get max","rules":[{"t":"set","p":"max","pt":"msg","to":"$max([msg.value1,msg.value2])","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":460,"y":720,"wires":[["c527281b.583ed8"]]},{"id":"7834631e.be983c","type":"change","z":"9336d0ba.713528","name":"","rules":[{"t":"set","p":"value1","pt":"msg","to":"10","tot":"num"},{"t":"set","p":"value2","pt":"msg","to":"20","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":290,"y":720,"wires":[["7f55f0bb.78bd7"]]},{"id":"4791c356.ed34ac","type":"inject","z":"9336d0ba.713528","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":100,"y":720,"wires":[["7834631e.be983c"]]},{"id":"c527281b.583ed8","type":"debug","z":"9336d0ba.713528","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":630,"y":720,"wires":[]}]

]

  • Gizz
  • Registratie: maart 2001
  • Nu online

Gizz

Dunder-Mifflin, Inc.

Ja, zo doe ik het ook. Hier mijn CO2 ventilatieflow:

https://tweakers.net/ext/f/Eagu7cuFhlEjqGQcEzTOcqXu/medium.png

code:
1
[{"id":"97938041.a9be18","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"58ee5be5.53cbb4","type":"mqtt in","z":"97938041.a9be18","name":"CO2 huiskamer","topic":"CO2_huiskamer/CO2/PPM","qos":"2","datatype":"auto","broker":"c9b2091b.ca27b8","x":160,"y":60,"wires":[["fcd328f1.f2e89"]]},{"id":"ee444f7b.3ae52","type":"mqtt in","z":"97938041.a9be18","name":"CO2 kantoor","topic":"CO2_kantoor/MHz19/PPM","qos":"2","datatype":"auto","broker":"c9b2091b.ca27b8","x":150,"y":120,"wires":[["b1f23128.9dcfd"]]},{"id":"c4c65cf0.65f2e","type":"mqtt in","z":"97938041.a9be18","name":"CO2 slaapkamer","topic":"CO2_slaapkamer/Mhz19/PPM","qos":"2","datatype":"auto","broker":"c9b2091b.ca27b8","x":160,"y":180,"wires":[["3d5309f6.2bb02e"]]},{"id":"9168281b.90ef68","type":"change","z":"97938041.a9be18","name":"store","rules":[{"t":"set","p":"co21","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":60,"wires":[["d5208753.46d46"]]},{"id":"53807fd0.1ddec8","type":"change","z":"97938041.a9be18","name":"store","rules":[{"t":"set","p":"co22","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":120,"wires":[["d5208753.46d46"]]},{"id":"d5208753.46d46","type":"change","z":"97938041.a9be18","name":"Hoogste kiezen","rules":[{"t":"set","p":"co2","pt":"msg","to":"$max([$flowContext(\"co21\"), $flowContext(\"co22\"), $flowContext(\"co23\")])\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":140,"wires":[["7dd963.6d127e9c"]]},{"id":"2891b63c.3fd2c2","type":"change","z":"97938041.a9be18","name":"store","rules":[{"t":"set","p":"co23","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":180,"wires":[["d5208753.46d46"]]},{"id":"fcd328f1.f2e89","type":"json","z":"97938041.a9be18","name":"","property":"payload","action":"","pretty":false,"x":310,"y":60,"wires":[["9168281b.90ef68"]]},{"id":"b1f23128.9dcfd","type":"json","z":"97938041.a9be18","name":"","property":"payload","action":"","pretty":false,"x":310,"y":120,"wires":[["53807fd0.1ddec8"]]},{"id":"3d5309f6.2bb02e","type":"json","z":"97938041.a9be18","name":"","property":"payload","action":"","pretty":false,"x":310,"y":180,"wires":[["2891b63c.3fd2c2"]]},{"id":"7dd963.6d127e9c","type":"range","z":"97938041.a9be18","minin":"450","maxin":"1100","minout":"1","maxout":"100","action":"clamp","round":true,"property":"co2","name":"Omzetting percentage ventilatie","x":350,"y":280,"wires":[["7511b80f.bbdfc8"]]},{"id":"c6f3596c.672f1","type":"mqtt out","z":"97938041.a9be18","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"c9b2091b.ca27b8","x":870,"y":280,"wires":[]},{"id":"7511b80f.bbdfc8","type":"template","z":"97938041.a9be18","name":"DMZ command","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"command\": \"switchlight\", \"idx\": 549, \"switchcmd\": \"Set Level\", \"level\": {{co2}} }","output":"str","x":580,"y":280,"wires":[["e69d2580.919c78"]]},{"id":"e69d2580.919c78","type":"json","z":"97938041.a9be18","name":"","property":"payload","action":"","pretty":false,"x":730,"y":280,"wires":[["c6f3596c.672f1"]]},{"id":"c9b2091b.ca27b8","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.2","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

Kan vast korter / efficiënter, ik ben ook maar een beginner :)

Canon EOS 5Dm3 + 5D + 7D + 300D + 1000FN + EF 17-40 4L + EF 35 1.4L + EF 50 1.8 + EF 80-200 2.8L + 550EX


  • Robje1244
  • Registratie: augustus 2009
  • Laatst online: 07-04 21:53
Bedankt @Kaspers en @Gizz.

Ik ga morgen even proberen of het hier mee lukt.

  • Pimmetje651
  • Registratie: oktober 2001
  • Laatst online: 10:48
JDunnio schreef op vrijdag 7 februari 2020 @ 17:14:
[...]


Ja ik heb per kamer en voor de lampen gekoppeld aan mijn alarm een aparte store. Dan kun je ervoor kiezen om vervolgens de hele kamer te restoren, maar je kunt natuurlijk ook één lamp uit de variabelen terug halen.

Ik gebruik het zelf alleen per kamer. Ik heb nog geen use case voor een store van een hele kamer zonder dat ik hem ook restore. De automations die ik heb zijn meestal voor knipperende lampen of voor als het alarm getriggered wordt.

Maar dit gebeurd dus in de subflows.
Interessant ...
Ik heb inmiddels even ter test een z-wave raam sensor gepakt om te triggeren, , heb er nu zoiets van gemaakt :
code:
1
 [{"id":"ff508ccb.3da6e","type":"server-state-changed","z":"1f95a255.6d2b6e","name":"Test sensor","server":"19d0a4fd.485e8b","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.kaipule_technology_co_ltd_im20_door_window_sensor_sensor_on","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"x":90,"y":400,"wires":[["4ff5dc94.e8aaa4"],[]]},{"id":"19d0a4fd.485e8b","type":"server","z":"","name":"Home Assistant"}]


https://abload.de/img/test6nklk.jpg

nu is voor mij de vraag, hoe krijg ik dus een 4 tal lampen gekoppeld die tegelijk ge-stored worden, en hoe zal ik de reset inbouwen .
dan ook nog, als deze flow zal worden getrigged zal er ook nog een flow moeten gaan lopen die de juiste scene zal starten. Is het handig/verstandig om dit in een losse flow te zetten of is het verstandig dit aan dezelfde flow te koppelen (wat ik denk dat de voorkeur heeft).

[Voor 0% gewijzigd door Pimmetje651 op 10-02-2020 23:01. Reden: resize plaatjes]

Its'nice 2be important, but it's more important 2be nice


  • JDunnio
  • Registratie: augustus 2018
  • Laatst online: 07-04 22:01
Pimmetje651 schreef op maandag 10 februari 2020 @ 22:57:
[...]


nu is voor mij de vraag, hoe krijg ik dus een 4 tal lampen gekoppeld die tegelijk ge-stored worden, en hoe zal ik de reset inbouwen .
dan ook nog, als deze flow zal worden getrigged zal er ook nog een flow moeten gaan lopen die de juiste scene zal starten. Is het handig/verstandig om dit in een losse flow te zetten of is het verstandig dit aan dezelfde flow te koppelen (wat ik denk dat de voorkeur heeft).
Euhm ja dat is het simpele voorbeeld Meerdere lampen sla ik op en restore ik met een subflow.

code:
1
[{"id":"a72011f7.394d8","type":"subflow","name":"Light State","info":"","category":"","in":[{"x":25,"y":306,"wires":[{"id":"9b2caad8.d47ef"}]}],"out":[{"x":1300,"y":680,"wires":[{"id":"3b4f395a.337d66","port":0},{"id":"4df70287.e16584","port":0},{"id":"449fde02.b8ea","port":0},{"id":"fa4b6838.2fab8","port":0},{"id":"b579ddd9.8c50a","port":0},{"id":"bb07361c.e173e","port":0},{"id":"2d0fb41c.606174","port":0},{"id":"ec257fa8.371628","port":0},{"id":"967d3778.ef1fb8","port":0},{"id":"1906f620.326aea","port":0},{"id":"18880708.1a88c9","port":0},{"id":"b66b8423.a53fb","port":0},{"id":"499a5f0c.4c4888","port":0},{"id":"b2b3d092.737de","port":0},{"id":"b194e0fe.1351a8","port":0},{"id":"cc1e58c9.69bb58","port":0}]}],"env":[],"status":{"x":1120,"y":40,"wires":[]}},{"id":"4deb7da4.a7f1ac","type":"api-current-state","z":"a72011f7.394d8","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.zw_fbd2_wk_plafond_level_s1","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":774,"y":186,"wires":[["ec257fa8.371628"]]},{"id":"3b4f395a.337d66","type":"function","z":"a72011f7.394d8","name":"Reset State - light_zw_fbd2_wk_plafond_level_s1","func":"var flow_data = global.get(\"zw_fbd2_wk_plafond_level_s1\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.zw_fbd2_wk_plafond_level_s1\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":904,"y":858,"wires":[["cc014ec3.4c0e9"]]},{"id":"9b2caad8.d47ef","type":"switch","z":"a72011f7.394d8","name":"store/reset/or per room","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"store","vt":"str"},{"t":"eq","v":"reset","vt":"str"},{"t":"eq","v":"store_alarmlights","vt":"str"},{"t":"eq","v":"reset_alarmlights","vt":"str"},{"t":"eq","v":"store_livingroom","vt":"str"},{"t":"eq","v":"reset_livingroom","vt":"str"},{"t":"eq","v":"store_kitchen","vt":"str"},{"t":"eq","v":"reset_kitchen","vt":"str"},{"t":"eq","v":"store_hallway","vt":"str"},{"t":"eq","v":"reset_hallway","vt":"str"}],"checkall":"true","repair":false,"outputs":10,"x":175,"y":306,"wires":[["7f179aff.6a62fc"],["9d3eb7ad.bb442"],[],[],["7749c5c9.0726dc"],["94524c7b.5c8358"],["3fe1fb19.b6f294"],["adcd3b4c.97db98"],["9ee5522d.f17b8"],["6030e6e6.4b098"]]},{"id":"ec257fa8.371628","type":"function","z":"a72011f7.394d8","name":"Store state - zw_fbd2_wk_plafond_level_s1","func":"global.set(\"zw_fbd2_wk_plafond_level_s1\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":1084,"y":186,"wires":[[]]},{"id":"bee763ff.fbc848","type":"api-current-state","z":"a72011f7.394d8","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.hue_wk_hanglamp_links","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":774,"y":246,"wires":[["967d3778.ef1fb8"]]},{"id":"967d3778.ef1fb8","type":"function","z":"a72011f7.394d8","name":"Store state - hue_wk_hanglamp_links","func":"global.set(\"hue_wk_hanglamp_links\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":1064,"y":246,"wires":[[]]},{"id":"4df70287.e16584","type":"function","z":"a72011f7.394d8","name":"Reset State - hue_wk_hanglamp_links","func":"var flow_data = global.get(\"hue_wk_hanglamp_links\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.hue_wk_hanglamp_links\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":864,"y":918,"wires":[["cc014ec3.4c0e9"]]},{"id":"9aaa3481.7ff148","type":"api-current-state","z":"a72011f7.394d8","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.hue_wk_hanglamp_rechts","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":774,"y":306,"wires":[["1906f620.326aea"]]},{"id":"1906f620.326aea","type":"function","z":"a72011f7.394d8","name":"Store state - hue_wk_hanglamp_rechts","func":"global.set(\"hue_wk_hanglamp_rechts\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":1074,"y":306,"wires":[[]]},{"id":"408cc7e0.bb2a78","type":"api-current-state","z":"a72011f7.394d8","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.hue_wk_rechtsvoor","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":774,"y":366,"wires":[["18880708.1a88c9"]]},{"id":"18880708.1a88c9","type":"function","z":"a72011f7.394d8","name":"Store state - hue_wk_rechtsvoor","func":"global.set(\"hue_wk_rechtsvoor\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":1054,"y":366,"wires":[[]]},{"id":"4baf4b9a.1cef34","type":"api-current-state","z":"a72011f7.394d8","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.hue_wk_rechtsachter","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":774,"y":426,"wires":[["b66b8423.a53fb"]]},{"id":"b66b8423.a53fb","type":"function","z":"a72011f7.394d8","name":"Store state - hue_wk_rechtsachter","func":"global.set(\"hue_wk_rechtsachter\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":1054,"y":426,"wires":[[]]},{"id":"97b46f85.81d238","type":"api-current-state","z":"a72011f7.394d8","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.hue_keukentafel","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":774,"y":526,"wires":[["499a5f0c.4c4888"]]},{"id":"499a5f0c.4c4888","type":"function","z":"a72011f7.394d8","name":"Store state - hue_keukentafel","func":"global.set(\"hue_keukentafel\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":1044,"y":526,"wires":[[]]},{"id":"746c59c5.3a5e6","type":"api-current-state","z":"a72011f7.394d8","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.zw_fbd2_kk_eiland_level_s1","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":774,"y":586,"wires":[["b2b3d092.737de"]]},{"id":"b2b3d092.737de","type":"function","z":"a72011f7.394d8","name":"Store state - zw_fbd2_kk_eiland_level_s1","func":"global.set(\"zw_fbd2_kk_eiland_level_s1\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":1074,"y":586,"wires":[[]]},{"id":"449fde02.b8ea","type":"function","z":"a72011f7.394d8","name":"Reset State - hue_wk_hanglamp_rechts","func":"var flow_data = global.get(\"hue_wk_hanglamp_rechts\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.hue_wk_hanglamp_rechts\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":873,"y":978,"wires":[["cc014ec3.4c0e9"]]},{"id":"fa4b6838.2fab8","type":"function","z":"a72011f7.394d8","name":"Reset State - hue_wk_rechtsvoor","func":"var flow_data = global.get(\"hue_wk_rechtsvoor\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.hue_wk_rechtsvoor\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":853,"y":1038,"wires":[["cc014ec3.4c0e9"]]},{"id":"b579ddd9.8c50a","type":"function","z":"a72011f7.394d8","name":"Reset State - hue_wk_rechtsachter","func":"var flow_data = global.get(\"hue_wk_rechtsachter\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.hue_wk_rechtsachter\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":853,"y":1098,"wires":[["cc014ec3.4c0e9"]]},{"id":"bb07361c.e173e","type":"function","z":"a72011f7.394d8","name":"Reset State - hue_keukentafel","func":"var flow_data = global.get(\"hue_keukentafel\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.hue_keukentafel\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":843,"y":1218,"wires":[["cc014ec3.4c0e9"]]},{"id":"2d0fb41c.606174","type":"function","z":"a72011f7.394d8","name":"Reset State - zw_fbd2_kk_eiland_level_s1","func":"var flow_data = global.get(\"zw_fbd2_kk_eiland_level_s1\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.zw_fbd2_kk_eiland_level_s1\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":883,"y":1278,"wires":[["cc014ec3.4c0e9"]]},{"id":"7749c5c9.0726dc","type":"link out","z":"a72011f7.394d8","name":"save_state_light_livingroom","links":["739ab232.e478a4"],"x":435,"y":186,"wires":[]},{"id":"739ab232.e478a4","type":"link in","z":"a72011f7.394d8","name":"save_state_light_livingroom","links":["7749c5c9.0726dc","9d506121.c88fa8","7f179aff.6a62fc"],"x":515,"y":186,"wires":[["4deb7da4.a7f1ac","bee763ff.fbc848","9aaa3481.7ff148","408cc7e0.bb2a78","4baf4b9a.1cef34"]]},{"id":"94524c7b.5c8358","type":"link out","z":"a72011f7.394d8","name":"reset_state_light_livingroom","links":["78d26cee.ba6704"],"x":435,"y":858,"wires":[]},{"id":"78d26cee.ba6704","type":"link in","z":"a72011f7.394d8","name":"reset_state_light_livingroom","links":["94524c7b.5c8358","9d3eb7ad.bb442"],"x":515,"y":858,"wires":[["3b4f395a.337d66","4df70287.e16584","449fde02.b8ea","fa4b6838.2fab8","b579ddd9.8c50a"]]},{"id":"9d3eb7ad.bb442","type":"link out","z":"a72011f7.394d8","name":"reset_state_all","links":["41968709.8a0878","78d26cee.ba6704","dcdcc687.d62ae"],"x":435,"y":798,"wires":[]},{"id":"7f179aff.6a62fc","type":"link out","z":"a72011f7.394d8","name":"save_state_all","links":["739ab232.e478a4","8baf7f8f.5da6","afc12a19.ec5e2"],"x":435,"y":126,"wires":[]},{"id":"73bae27c.247b14","type":"comment","z":"a72011f7.394d8","name":"=== LIVING ===","info":"","x":620,"y":146,"wires":[]},{"id":"3fe1fb19.b6f294","type":"link out","z":"a72011f7.394d8","name":"save_state_light_kitchen","links":["afc12a19.ec5e2"],"x":435,"y":526,"wires":[]},{"id":"afc12a19.ec5e2","type":"link in","z":"a72011f7.394d8","name":"save_state_light_kitchen","links":["3fe1fb19.b6f294","7f179aff.6a62fc"],"x":515,"y":526,"wires":[["97b46f85.81d238","746c59c5.3a5e6"]]},{"id":"adcd3b4c.97db98","type":"link out","z":"a72011f7.394d8","name":"reset_state_light_kitchen","links":["41968709.8a0878"],"x":435,"y":1218,"wires":[]},{"id":"41968709.8a0878","type":"link in","z":"a72011f7.394d8","name":"reset_state_light_kitchen","links":["9d3eb7ad.bb442","adcd3b4c.97db98"],"x":515,"y":1218,"wires":[["bb07361c.e173e","2d0fb41c.606174"]]},{"id":"e75df446.9f1ac","type":"comment","z":"a72011f7.394d8","name":"=== KITCHEN ===","info":"","x":630,"y":486,"wires":[]},{"id":"cc014ec3.4c0e9","type":"api-call-service","z":"a72011f7.394d8","name":"Call Service","server":"23176b84.edef7c","version":1,"service_domain":"light","service":"turn_on","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1284,"y":858,"wires":[[]]},{"id":"adb2114d.de0ed","type":"comment","z":"a72011f7.394d8","name":"ALL","info":"","x":470,"y":100,"wires":[]},{"id":"3737ed16.ab00ba","type":"comment","z":"a72011f7.394d8","name":"ALL","info":"","x":470,"y":760,"wires":[]},{"id":"d4e42cc3.9414d","type":"comment","z":"a72011f7.394d8","name":"=== LIVING ===","info":"","x":620,"y":818,"wires":[]},{"id":"17d0ff35.3a9461","type":"comment","z":"a72011f7.394d8","name":"=== KITCHEN ===","info":"","x":630,"y":1178,"wires":[]},{"id":"b194e0fe.1351a8","type":"function","z":"a72011f7.394d8","name":"Reset State - hue_hal","func":"var flow_data = global.get(\"hue_hal\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.hue_hal\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":820,"y":1400,"wires":[["cc014ec3.4c0e9"]]},{"id":"6030e6e6.4b098","type":"link out","z":"a72011f7.394d8","name":"reset_state_light_hallway","links":["dcdcc687.d62ae"],"x":442,"y":1400,"wires":[]},{"id":"dcdcc687.d62ae","type":"link in","z":"a72011f7.394d8","name":"reset_state_light_hallway","links":["6030e6e6.4b098","9d3eb7ad.bb442"],"x":522,"y":1400,"wires":[["b194e0fe.1351a8"]]},{"id":"eebcca79.870f98","type":"comment","z":"a72011f7.394d8","name":"=== HALLWAY ===","info":"","x":637,"y":1360,"wires":[]},{"id":"c8a98622.03a06","type":"api-current-state","z":"a72011f7.394d8","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.hue_hal","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":780,"y":680,"wires":[["cc1e58c9.69bb58"]]},{"id":"cc1e58c9.69bb58","type":"function","z":"a72011f7.394d8","name":"Store state - hue_hal","func":"global.set(\"hue_hal\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":1020,"y":680,"wires":[[]]},{"id":"9ee5522d.f17b8","type":"link out","z":"a72011f7.394d8","name":"save_state_light_hallway","links":["8baf7f8f.5da6"],"x":441,"y":680,"wires":[]},{"id":"8baf7f8f.5da6","type":"link in","z":"a72011f7.394d8","name":"save_state_light_halway","links":["7f179aff.6a62fc","9ee5522d.f17b8"],"x":521,"y":680,"wires":[["c8a98622.03a06"]]},{"id":"50be605.d6e7a2","type":"comment","z":"a72011f7.394d8","name":"=== HALLWAY ===","info":"","x":636,"y":640,"wires":[]},{"id":"23176b84.edef7c","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false},{"id":"e631d815.a579","type":"subflow:a72011f7.394d8","z":"283de3b.cc2271c","name":"","env":[],"x":500,"y":100,"wires":[["b69f1f0c.eb05d8"]]},{"id":"46df6820.803de","type":"subflow:a72011f7.394d8","z":"283de3b.cc2271c","name":"","env":[],"x":500,"y":180,"wires":[["b69f1f0c.eb05d8"]]},{"id":"b69f1f0c.eb05d8","type":"debug","z":"283de3b.cc2271c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":710,"y":180,"wires":[]},{"id":"4ef9e54f.6d62f4","type":"template","z":"283de3b.cc2271c","name":"store state kitchen","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"store_kitchen","output":"str","x":310,"y":40,"wires":[["e631d815.a579"]]},{"id":"f2d085cf.12b26","type":"inject","z":"283de3b.cc2271c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":40,"wires":[["4ef9e54f.6d62f4"]]},{"id":"ff96f4a6.28d63","type":"template","z":"283de3b.cc2271c","name":"reset state kitchen","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"reset_kitchen","output":"str","x":290,"y":120,"wires":[["46df6820.803de"]]},{"id":"8cc98c5c.8c519","type":"inject","z":"283de3b.cc2271c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":120,"wires":[["ff96f4a6.28d63"]]}]


De function-node bevat het commando om ui te voeren. De subflow kun je bekijken door hem te bewerken en dan edit subflow template te klikken.

Ik heb dus per kamer die ik wil schakelen een store en reset aangemaakt (met de switch-node), waarbij ik dan per kamer alle lampen waar het over gaat in een variabele opsla.

De restore kan is de andersom methode. Het is dus meer van hetzelfde dus.

Volgens mij moet dit ook kunnen met de state machine, maar dit werkt en is voor mij makkelijk te debuggen.

  • Gizz
  • Registratie: maart 2001
  • Nu online

Gizz

Dunder-Mifflin, Inc.

https://tweakers.net/ext/f/NHbw3eaUsUXjzEh9I5k83QMq/medium.png
code:
1
[{"id":"acca67a0.439418","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"d903da3a.1b1d8","type":"mqtt in","z":"acca67a0.439418","name":"","topic":"Fancontroller/Radiator/Temperature","qos":"2","datatype":"auto","broker":"c9b2091b.ca27b8","x":180,"y":160,"wires":[["bcaa3684.992538"]]},{"id":"bcaa3684.992538","type":"range","z":"acca67a0.439418","minin":"20","maxin":"35","minout":"0","maxout":"1023","action":"clamp","round":true,"property":"payload","name":"","x":510,"y":160,"wires":[["2abb0025.48aff8"]]},{"id":"cece5b45.3e9ac8","type":"mqtt out","z":"acca67a0.439418","name":"","topic":"Fancontroller/cmd","qos":"","retain":"","broker":"c9b2091b.ca27b8","x":910,"y":80,"wires":[]},{"id":"2abb0025.48aff8","type":"template","z":"acca67a0.439418","name":"PWM command","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"PWM,21,{{payload}},0,25000","output":"str","x":700,"y":80,"wires":[["cece5b45.3e9ac8"]]},{"id":"1d4fd89d.421287","type":"mqtt in","z":"acca67a0.439418","name":"","topic":"domoticz/out","qos":"2","datatype":"auto","broker":"c9b2091b.ca27b8","x":110,"y":220,"wires":[["d0b59955.9763f8"]]},{"id":"d0b59955.9763f8","type":"json","z":"acca67a0.439418","name":"","property":"payload","action":"","pretty":false,"x":250,"y":220,"wires":[["60c1716.5d9ed9"]]},{"id":"60c1716.5d9ed9","type":"switch","z":"acca67a0.439418","name":"IDX 9","property":"payload.idx","propertyType":"msg","rules":[{"t":"eq","v":"9","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":220,"wires":[["a3427bbf.131f7"]]},{"id":"a3427bbf.131f7","type":"switch","z":"acca67a0.439418","name":"Naar beneden?","property":"payload.nvalue","propertyType":"msg","rules":[{"t":"eq","v":"3","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":520,"y":220,"wires":[["13808929.70882f"]]},{"id":"13808929.70882f","type":"change","z":"acca67a0.439418","name":"Fan uit","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":670,"y":220,"wires":[["2abb0025.48aff8"]]},{"id":"c9b2091b.ca27b8","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.2","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]


Onder mijn radiator heb ik ventilatoren gehangen om de radiator te laten afkoelen en dus mijn kamer op te warmen (voor de geïnteresseerden is er een topic vol met dit soort dingen: LTV: Deel hier je Jaga DBE zelfbouw ervaringen).

Hoe hard de fans draaien hangt af van hoe warm leiding is. Dit is de bovenste route in mijn flow.

Nu is het echter zo dat als mijn rolgordijn naar beneden gaat en de fans hard draaien, door de luchtdruk het gordijn diagonaal geblazen wordt waardoor het gordijn niet netjes tussen de radiator en het raam valt, maar juist over de radiator heen. Alle warme lucht wordt dan tussen het gordijn en het raam geblazen, niet handig :z

Om dat op te lossen is het nu zo dat de fans uitgaan zodra het rolgordijn zakt. De onderste route in mijn flow.

Probleem: als mijn rolgordijn naar beneden gaat en vlak daarna geeft de sensor bij de verwarming een nieuwe waarde door, dan gaan natuurlijk de fans weer meteen hard draaien. Het succes van mijn flow is nu dus afhankelijk van of het rolgordijn naar beneden gaat vlak voor een temperatuur-update of juist niet.

Hoe maak ik het nu zo dat als het rolgordijn naar beneden gaat de fans voor 20 seconden uitgezet worden, ongeacht of de bovenste flow een nieuwe snelheid probeert te pushen? :)

Canon EOS 5Dm3 + 5D + 7D + 300D + 1000FN + EF 17-40 4L + EF 35 1.4L + EF 50 1.8 + EF 80-200 2.8L + 550EX


  • Tsurany
  • Registratie: juni 2006
  • Niet online
Een flow variabele gebruiken om de stand van het rolgordijn bij te houden, dan kan je daarmee controleren of de ventilator wel of niet aan moet.

  • Gizz
  • Registratie: maart 2001
  • Nu online

Gizz

Dunder-Mifflin, Inc.

@Tsurany De fan moet altijd aan, alleen tijdens het zakken van het rolgordijn voor 20 seconden niet.

Het rolgordijn zelf geeft geen terugkoppeling van z'n status. Dus als ik het rolgordijn vertel te sluiten (handmatig danwel @ zonsondergang) is de status direct 'Closed".

Dus volgens mij gaat jouw suggestie niet werken, of ik begrijp het niet goed :)

Canon EOS 5Dm3 + 5D + 7D + 300D + 1000FN + EF 17-40 4L + EF 35 1.4L + EF 50 1.8 + EF 80-200 2.8L + 550EX


  • Tsurany
  • Registratie: juni 2006
  • Niet online
Die variabele kan je natuurlijk een timestamp geven. Vervolgens check je of de huidige tijd binnen 30 seconden van die timestamp zit.

Je kan trouwens ook de variabele zetten en daarna via een sleep na 30 seconden weer wijzigen.

[Voor 26% gewijzigd door Tsurany op 11-02-2020 21:17]


  • Pimmetje651
  • Registratie: oktober 2001
  • Laatst online: 10:48
JDunnio schreef op dinsdag 11 februari 2020 @ 12:42:
[...]


Euhm ja dat is het simpele voorbeeld Meerdere lampen sla ik op en restore ik met een subflow.

code:
1
[{"id":"a72011f7.394d8","type":"subflow","name":"Light State","info":"","category":"","in":[{"x":25,"y":306,"wires":[{"id":"9b2caad8.d47ef"}]}],"out":[{"x":1300,"y":680,"wires":[{"id":"3b4f395a.337d66","port":0},{"id":"4df70287.e16584","port":0},{"id":"449fde02.b8ea","port":0},{"id":"fa4b6838.2fab8","port":0},{"id":"b579ddd9.8c50a","port":0},{"id":"bb07361c.e173e","port":0},{"id":"2d0fb41c.606174","port":0},{"id":"ec257fa8.371628","port":0},{"id":"967d3778.ef1fb8","port":0},{"id":"1906f620.326aea","port":0},{"id":"18880708.1a88c9","port":0},{"id":"b66b8423.a53fb","port":0},{"id":"499a5f0c.4c4888","port":0},{"id":"b2b3d092.737de","port":0},{"id":"b194e0fe.1351a8","port":0},{"id":"cc1e58c9.69bb58","port":0}]}],"env":[],"status":{"x":1120,"y":40,"wires":[]}},{"id":"4deb7da4.a7f1ac","type":"api-current-state","z":"a72011f7.394d8","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.zw_fbd2_wk_plafond_level_s1","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":774,"y":186,"wires":[["ec257fa8.371628"]]},{"id":"3b4f395a.337d66","type":"function","z":"a72011f7.394d8","name":"Reset State - light_zw_fbd2_wk_plafond_level_s1","func":"var flow_data = global.get(\"zw_fbd2_wk_plafond_level_s1\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.zw_fbd2_wk_plafond_level_s1\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":904,"y":858,"wires":[["cc014ec3.4c0e9"]]},{"id":"9b2caad8.d47ef","type":"switch","z":"a72011f7.394d8","name":"store/reset/or per room","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"store","vt":"str"},{"t":"eq","v":"reset","vt":"str"},{"t":"eq","v":"store_alarmlights","vt":"str"},{"t":"eq","v":"reset_alarmlights","vt":"str"},{"t":"eq","v":"store_livingroom","vt":"str"},{"t":"eq","v":"reset_livingroom","vt":"str"},{"t":"eq","v":"store_kitchen","vt":"str"},{"t":"eq","v":"reset_kitchen","vt":"str"},{"t":"eq","v":"store_hallway","vt":"str"},{"t":"eq","v":"reset_hallway","vt":"str"}],"checkall":"true","repair":false,"outputs":10,"x":175,"y":306,"wires":[["7f179aff.6a62fc"],["9d3eb7ad.bb442"],[],[],["7749c5c9.0726dc"],["94524c7b.5c8358"],["3fe1fb19.b6f294"],["adcd3b4c.97db98"],["9ee5522d.f17b8"],["6030e6e6.4b098"]]},{"id":"ec257fa8.371628","type":"function","z":"a72011f7.394d8","name":"Store state - zw_fbd2_wk_plafond_level_s1","func":"global.set(\"zw_fbd2_wk_plafond_level_s1\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":1084,"y":186,"wires":[[]]},{"id":"bee763ff.fbc848","type":"api-current-state","z":"a72011f7.394d8","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.hue_wk_hanglamp_links","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":774,"y":246,"wires":[["967d3778.ef1fb8"]]},{"id":"967d3778.ef1fb8","type":"function","z":"a72011f7.394d8","name":"Store state - hue_wk_hanglamp_links","func":"global.set(\"hue_wk_hanglamp_links\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":1064,"y":246,"wires":[[]]},{"id":"4df70287.e16584","type":"function","z":"a72011f7.394d8","name":"Reset State - hue_wk_hanglamp_links","func":"var flow_data = global.get(\"hue_wk_hanglamp_links\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.hue_wk_hanglamp_links\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":864,"y":918,"wires":[["cc014ec3.4c0e9"]]},{"id":"9aaa3481.7ff148","type":"api-current-state","z":"a72011f7.394d8","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.hue_wk_hanglamp_rechts","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":774,"y":306,"wires":[["1906f620.326aea"]]},{"id":"1906f620.326aea","type":"function","z":"a72011f7.394d8","name":"Store state - hue_wk_hanglamp_rechts","func":"global.set(\"hue_wk_hanglamp_rechts\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":1074,"y":306,"wires":[[]]},{"id":"408cc7e0.bb2a78","type":"api-current-state","z":"a72011f7.394d8","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.hue_wk_rechtsvoor","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":774,"y":366,"wires":[["18880708.1a88c9"]]},{"id":"18880708.1a88c9","type":"function","z":"a72011f7.394d8","name":"Store state - hue_wk_rechtsvoor","func":"global.set(\"hue_wk_rechtsvoor\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":1054,"y":366,"wires":[[]]},{"id":"4baf4b9a.1cef34","type":"api-current-state","z":"a72011f7.394d8","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.hue_wk_rechtsachter","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":774,"y":426,"wires":[["b66b8423.a53fb"]]},{"id":"b66b8423.a53fb","type":"function","z":"a72011f7.394d8","name":"Store state - hue_wk_rechtsachter","func":"global.set(\"hue_wk_rechtsachter\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":1054,"y":426,"wires":[[]]},{"id":"97b46f85.81d238","type":"api-current-state","z":"a72011f7.394d8","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.hue_keukentafel","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":774,"y":526,"wires":[["499a5f0c.4c4888"]]},{"id":"499a5f0c.4c4888","type":"function","z":"a72011f7.394d8","name":"Store state - hue_keukentafel","func":"global.set(\"hue_keukentafel\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":1044,"y":526,"wires":[[]]},{"id":"746c59c5.3a5e6","type":"api-current-state","z":"a72011f7.394d8","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.zw_fbd2_kk_eiland_level_s1","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":774,"y":586,"wires":[["b2b3d092.737de"]]},{"id":"b2b3d092.737de","type":"function","z":"a72011f7.394d8","name":"Store state - zw_fbd2_kk_eiland_level_s1","func":"global.set(\"zw_fbd2_kk_eiland_level_s1\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":1074,"y":586,"wires":[[]]},{"id":"449fde02.b8ea","type":"function","z":"a72011f7.394d8","name":"Reset State - hue_wk_hanglamp_rechts","func":"var flow_data = global.get(\"hue_wk_hanglamp_rechts\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.hue_wk_hanglamp_rechts\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":873,"y":978,"wires":[["cc014ec3.4c0e9"]]},{"id":"fa4b6838.2fab8","type":"function","z":"a72011f7.394d8","name":"Reset State - hue_wk_rechtsvoor","func":"var flow_data = global.get(\"hue_wk_rechtsvoor\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.hue_wk_rechtsvoor\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":853,"y":1038,"wires":[["cc014ec3.4c0e9"]]},{"id":"b579ddd9.8c50a","type":"function","z":"a72011f7.394d8","name":"Reset State - hue_wk_rechtsachter","func":"var flow_data = global.get(\"hue_wk_rechtsachter\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.hue_wk_rechtsachter\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":853,"y":1098,"wires":[["cc014ec3.4c0e9"]]},{"id":"bb07361c.e173e","type":"function","z":"a72011f7.394d8","name":"Reset State - hue_keukentafel","func":"var flow_data = global.get(\"hue_keukentafel\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.hue_keukentafel\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":843,"y":1218,"wires":[["cc014ec3.4c0e9"]]},{"id":"2d0fb41c.606174","type":"function","z":"a72011f7.394d8","name":"Reset State - zw_fbd2_kk_eiland_level_s1","func":"var flow_data = global.get(\"zw_fbd2_kk_eiland_level_s1\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.zw_fbd2_kk_eiland_level_s1\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":883,"y":1278,"wires":[["cc014ec3.4c0e9"]]},{"id":"7749c5c9.0726dc","type":"link out","z":"a72011f7.394d8","name":"save_state_light_livingroom","links":["739ab232.e478a4"],"x":435,"y":186,"wires":[]},{"id":"739ab232.e478a4","type":"link in","z":"a72011f7.394d8","name":"save_state_light_livingroom","links":["7749c5c9.0726dc","9d506121.c88fa8","7f179aff.6a62fc"],"x":515,"y":186,"wires":[["4deb7da4.a7f1ac","bee763ff.fbc848","9aaa3481.7ff148","408cc7e0.bb2a78","4baf4b9a.1cef34"]]},{"id":"94524c7b.5c8358","type":"link out","z":"a72011f7.394d8","name":"reset_state_light_livingroom","links":["78d26cee.ba6704"],"x":435,"y":858,"wires":[]},{"id":"78d26cee.ba6704","type":"link in","z":"a72011f7.394d8","name":"reset_state_light_livingroom","links":["94524c7b.5c8358","9d3eb7ad.bb442"],"x":515,"y":858,"wires":[["3b4f395a.337d66","4df70287.e16584","449fde02.b8ea","fa4b6838.2fab8","b579ddd9.8c50a"]]},{"id":"9d3eb7ad.bb442","type":"link out","z":"a72011f7.394d8","name":"reset_state_all","links":["41968709.8a0878","78d26cee.ba6704","dcdcc687.d62ae"],"x":435,"y":798,"wires":[]},{"id":"7f179aff.6a62fc","type":"link out","z":"a72011f7.394d8","name":"save_state_all","links":["739ab232.e478a4","8baf7f8f.5da6","afc12a19.ec5e2"],"x":435,"y":126,"wires":[]},{"id":"73bae27c.247b14","type":"comment","z":"a72011f7.394d8","name":"=== LIVING ===","info":"","x":620,"y":146,"wires":[]},{"id":"3fe1fb19.b6f294","type":"link out","z":"a72011f7.394d8","name":"save_state_light_kitchen","links":["afc12a19.ec5e2"],"x":435,"y":526,"wires":[]},{"id":"afc12a19.ec5e2","type":"link in","z":"a72011f7.394d8","name":"save_state_light_kitchen","links":["3fe1fb19.b6f294","7f179aff.6a62fc"],"x":515,"y":526,"wires":[["97b46f85.81d238","746c59c5.3a5e6"]]},{"id":"adcd3b4c.97db98","type":"link out","z":"a72011f7.394d8","name":"reset_state_light_kitchen","links":["41968709.8a0878"],"x":435,"y":1218,"wires":[]},{"id":"41968709.8a0878","type":"link in","z":"a72011f7.394d8","name":"reset_state_light_kitchen","links":["9d3eb7ad.bb442","adcd3b4c.97db98"],"x":515,"y":1218,"wires":[["bb07361c.e173e","2d0fb41c.606174"]]},{"id":"e75df446.9f1ac","type":"comment","z":"a72011f7.394d8","name":"=== KITCHEN ===","info":"","x":630,"y":486,"wires":[]},{"id":"cc014ec3.4c0e9","type":"api-call-service","z":"a72011f7.394d8","name":"Call Service","server":"23176b84.edef7c","version":1,"service_domain":"light","service":"turn_on","entityId":"","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1284,"y":858,"wires":[[]]},{"id":"adb2114d.de0ed","type":"comment","z":"a72011f7.394d8","name":"ALL","info":"","x":470,"y":100,"wires":[]},{"id":"3737ed16.ab00ba","type":"comment","z":"a72011f7.394d8","name":"ALL","info":"","x":470,"y":760,"wires":[]},{"id":"d4e42cc3.9414d","type":"comment","z":"a72011f7.394d8","name":"=== LIVING ===","info":"","x":620,"y":818,"wires":[]},{"id":"17d0ff35.3a9461","type":"comment","z":"a72011f7.394d8","name":"=== KITCHEN ===","info":"","x":630,"y":1178,"wires":[]},{"id":"b194e0fe.1351a8","type":"function","z":"a72011f7.394d8","name":"Reset State - hue_hal","func":"var flow_data = global.get(\"hue_hal\");\n\nmsg.payload = {\n    \"domain\":\"light\",\n    \"service\":\"turn_\" + flow_data[\"state\"],\n    \"data\": {\n        \"entity_id\":\"light.hue_hal\",\n        \"brightness\":flow_data.attributes[\"brightness\"],\n        \"rgb_color\":flow_data.attributes[\"rgb_color\"],\n        \"color_temp\":flow_data.attributes[\"color_temp\"],\n    }\n}\nreturn msg;","outputs":1,"noerr":0,"x":820,"y":1400,"wires":[["cc014ec3.4c0e9"]]},{"id":"6030e6e6.4b098","type":"link out","z":"a72011f7.394d8","name":"reset_state_light_hallway","links":["dcdcc687.d62ae"],"x":442,"y":1400,"wires":[]},{"id":"dcdcc687.d62ae","type":"link in","z":"a72011f7.394d8","name":"reset_state_light_hallway","links":["6030e6e6.4b098","9d3eb7ad.bb442"],"x":522,"y":1400,"wires":[["b194e0fe.1351a8"]]},{"id":"eebcca79.870f98","type":"comment","z":"a72011f7.394d8","name":"=== HALLWAY ===","info":"","x":637,"y":1360,"wires":[]},{"id":"c8a98622.03a06","type":"api-current-state","z":"a72011f7.394d8","name":"Get state","server":"23176b84.edef7c","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.hue_hal","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":780,"y":680,"wires":[["cc1e58c9.69bb58"]]},{"id":"cc1e58c9.69bb58","type":"function","z":"a72011f7.394d8","name":"Store state - hue_hal","func":"global.set(\"hue_hal\",msg.data);\nreturn msg;","outputs":1,"noerr":0,"x":1020,"y":680,"wires":[[]]},{"id":"9ee5522d.f17b8","type":"link out","z":"a72011f7.394d8","name":"save_state_light_hallway","links":["8baf7f8f.5da6"],"x":441,"y":680,"wires":[]},{"id":"8baf7f8f.5da6","type":"link in","z":"a72011f7.394d8","name":"save_state_light_halway","links":["7f179aff.6a62fc","9ee5522d.f17b8"],"x":521,"y":680,"wires":[["c8a98622.03a06"]]},{"id":"50be605.d6e7a2","type":"comment","z":"a72011f7.394d8","name":"=== HALLWAY ===","info":"","x":636,"y":640,"wires":[]},{"id":"23176b84.edef7c","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false},{"id":"e631d815.a579","type":"subflow:a72011f7.394d8","z":"283de3b.cc2271c","name":"","env":[],"x":500,"y":100,"wires":[["b69f1f0c.eb05d8"]]},{"id":"46df6820.803de","type":"subflow:a72011f7.394d8","z":"283de3b.cc2271c","name":"","env":[],"x":500,"y":180,"wires":[["b69f1f0c.eb05d8"]]},{"id":"b69f1f0c.eb05d8","type":"debug","z":"283de3b.cc2271c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":710,"y":180,"wires":[]},{"id":"4ef9e54f.6d62f4","type":"template","z":"283de3b.cc2271c","name":"store state kitchen","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"store_kitchen","output":"str","x":310,"y":40,"wires":[["e631d815.a579"]]},{"id":"f2d085cf.12b26","type":"inject","z":"283de3b.cc2271c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":40,"wires":[["4ef9e54f.6d62f4"]]},{"id":"ff96f4a6.28d63","type":"template","z":"283de3b.cc2271c","name":"reset state kitchen","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"reset_kitchen","output":"str","x":290,"y":120,"wires":[["46df6820.803de"]]},{"id":"8cc98c5c.8c519","type":"inject","z":"283de3b.cc2271c","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":120,"y":120,"wires":[["ff96f4a6.28d63"]]}]


De function-node bevat het commando om ui te voeren. De subflow kun je bekijken door hem te bewerken en dan edit subflow template te klikken.

Ik heb dus per kamer die ik wil schakelen een store en reset aangemaakt (met de switch-node), waarbij ik dan per kamer alle lampen waar het over gaat in een variabele opsla.

De restore kan is de andersom methode. Het is dus meer van hetzelfde dus.

Volgens mij moet dit ook kunnen met de state machine, maar dit werkt en is voor mij makkelijk te debuggen.
Is er een manier om hierover met je te sparren ? ( via pm / 06 / etc.)

Its'nice 2be important, but it's more important 2be nice


  • Robje1244
  • Registratie: augustus 2009
  • Laatst online: 07-04 21:53
Gizz schreef op maandag 10 februari 2020 @ 21:43:
Ja, zo doe ik het ook. Hier mijn CO2 ventilatieflow:

[Afbeelding]

code:
1
[{"id":"97938041.a9be18","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"58ee5be5.53cbb4","type":"mqtt in","z":"97938041.a9be18","name":"CO2 huiskamer","topic":"CO2_huiskamer/CO2/PPM","qos":"2","datatype":"auto","broker":"c9b2091b.ca27b8","x":160,"y":60,"wires":[["fcd328f1.f2e89"]]},{"id":"ee444f7b.3ae52","type":"mqtt in","z":"97938041.a9be18","name":"CO2 kantoor","topic":"CO2_kantoor/MHz19/PPM","qos":"2","datatype":"auto","broker":"c9b2091b.ca27b8","x":150,"y":120,"wires":[["b1f23128.9dcfd"]]},{"id":"c4c65cf0.65f2e","type":"mqtt in","z":"97938041.a9be18","name":"CO2 slaapkamer","topic":"CO2_slaapkamer/Mhz19/PPM","qos":"2","datatype":"auto","broker":"c9b2091b.ca27b8","x":160,"y":180,"wires":[["3d5309f6.2bb02e"]]},{"id":"9168281b.90ef68","type":"change","z":"97938041.a9be18","name":"store","rules":[{"t":"set","p":"co21","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":60,"wires":[["d5208753.46d46"]]},{"id":"53807fd0.1ddec8","type":"change","z":"97938041.a9be18","name":"store","rules":[{"t":"set","p":"co22","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":120,"wires":[["d5208753.46d46"]]},{"id":"d5208753.46d46","type":"change","z":"97938041.a9be18","name":"Hoogste kiezen","rules":[{"t":"set","p":"co2","pt":"msg","to":"$max([$flowContext(\"co21\"), $flowContext(\"co22\"), $flowContext(\"co23\")])\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":140,"wires":[["7dd963.6d127e9c"]]},{"id":"2891b63c.3fd2c2","type":"change","z":"97938041.a9be18","name":"store","rules":[{"t":"set","p":"co23","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":180,"wires":[["d5208753.46d46"]]},{"id":"fcd328f1.f2e89","type":"json","z":"97938041.a9be18","name":"","property":"payload","action":"","pretty":false,"x":310,"y":60,"wires":[["9168281b.90ef68"]]},{"id":"b1f23128.9dcfd","type":"json","z":"97938041.a9be18","name":"","property":"payload","action":"","pretty":false,"x":310,"y":120,"wires":[["53807fd0.1ddec8"]]},{"id":"3d5309f6.2bb02e","type":"json","z":"97938041.a9be18","name":"","property":"payload","action":"","pretty":false,"x":310,"y":180,"wires":[["2891b63c.3fd2c2"]]},{"id":"7dd963.6d127e9c","type":"range","z":"97938041.a9be18","minin":"450","maxin":"1100","minout":"1","maxout":"100","action":"clamp","round":true,"property":"co2","name":"Omzetting percentage ventilatie","x":350,"y":280,"wires":[["7511b80f.bbdfc8"]]},{"id":"c6f3596c.672f1","type":"mqtt out","z":"97938041.a9be18","name":"","topic":"domoticz/in","qos":"","retain":"","broker":"c9b2091b.ca27b8","x":870,"y":280,"wires":[]},{"id":"7511b80f.bbdfc8","type":"template","z":"97938041.a9be18","name":"DMZ command","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"command\": \"switchlight\", \"idx\": 549, \"switchcmd\": \"Set Level\", \"level\": {{co2}} }","output":"str","x":580,"y":280,"wires":[["e69d2580.919c78"]]},{"id":"e69d2580.919c78","type":"json","z":"97938041.a9be18","name":"","property":"payload","action":"","pretty":false,"x":730,"y":280,"wires":[["c6f3596c.672f1"]]},{"id":"c9b2091b.ca27b8","type":"mqtt-broker","z":"","name":"","broker":"192.168.1.2","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"15","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

Kan vast korter / efficiënter, ik ben ook maar een beginner :)
Ik heb deze precies gekopieerd, alleen nu komt af en toe de hoogste co2 waarde door en af en toe de laagste. 8)7

Beide mqtt nodes komen op een ander tijdstip binnen. Vervolgens wordt deze ook direct door gestuurd. Kan dit er iets mee te maken hebben?



Laat maar. Geloof dat hij het doet. :)

  • Waterkoker
  • Registratie: september 2001
  • Niet online
Onlangs heb ik mijn VPS herstart (ubuntu 18.04) waar Node-RED op draait. Nu krijg ik met geen mogelijkheid node-red aan de gang. Weet iemand of de flows toevallig in een folder/file worden opgeslagen? Anders is er veel werk verdwenen :X

[Voor 13% gewijzigd door Waterkoker op 18-02-2020 23:32]

Ik draai NR tegenwoordig in Docker, maar ik geloof dat met een losse installatie alles in de .node-red map in je home-folder staat opgeslagen.

Wat ik overig doe is zelf altijd een lijstje bijhouden van geïnstalleerde modules, en na elke reeks aanpassingen exporteer (download) ik al mijn flows naar een bestand (NR -> hamburgermenu -> export)

  • Dacuuu
  • Registratie: maart 2009
  • Laatst online: 13:01
Waterkoker schreef op dinsdag 18 februari 2020 @ 23:29:
Onlangs heb ik mijn VPS herstart (ubuntu 18.04) waar Node-RED op draait. Nu krijg ik met geen mogelijkheid node-red aan de gang. Weet iemand of de flows toevallig in een folder/file worden opgeslagen? Anders is er veel werk verdwenen :X
Ik draai NR in docker, en daar staat het bestand flows.json in docker/nodered/data, maarja, aan die map heb jij niks aan.

Zoek op google even op 'nodered flows.json location'

[Voor 5% gewijzigd door Dacuuu op 19-02-2020 10:28]

Mijn Youtube reviews: https://www.youtube.com/user/BartjuhB/videos

@Waterkoker Alle belangrijke data staat standaard in ~/.node-red
https://github.com/node-r...and-related-configuration

  • Waterkoker
  • Registratie: september 2001
  • Niet online
Mijn data van Node-Red inmiddels veilig kunnen stellen :) heel fijn.

Er rest mij nog een vraag. Graag wil ik Node-Red de data opsommen van mijn slimme meter.
Nu krijg ik onderstaande outpot. twee messages met elk een array. Hoe kan ik dit bij elkaar optellen?

In Google heb ik enkele voorbeelden geprobeerd maar dan loop ik of tegen een error aan of de waardes kloppen niet.

Komt het omdat het geen 'number' is?
2/23/2020, 1:28:20 AMnode: 5e1bacd6.7440a4
msg.payload : array[1]
array[1]
0: "835.847"
2/23/2020, 1:28:20 AMnode: 5e1bacd6.7440a4
msg.payload : array[1]
array[1]
0: "1254.624"

  • Dacuuu
  • Registratie: maart 2009
  • Laatst online: 13:01
Waterkoker schreef op zondag 23 februari 2020 @ 01:30:
Mijn data van Node-Red inmiddels veilig kunnen stellen :) heel fijn.

Er rest mij nog een vraag. Graag wil ik Node-Red de data opsommen van mijn slimme meter.
Nu krijg ik onderstaande outpot. twee messages met elk een array. Hoe kan ik dit bij elkaar optellen?

In Google heb ik enkele voorbeelden geprobeerd maar dan loop ik of tegen een error aan of de waardes kloppen niet.

Komt het omdat het geen 'number' is?


[...]
Ik ben zeker geen NR expert, verre van :+ maar je geeft net te weinig info.
Eerst zorgen dat beide outputs numbers zijn, daarna bij elkaar op tellen.

Bij de Home-assistant nodes kan je vaak kiezen tussen state types:
https://i.imgur.com/InVX6t3.png

En anders een Change node gebruiken?
https://i.imgur.com/gGkFM3h.png

[Voor 4% gewijzigd door Dacuuu op 23-02-2020 08:29]

Mijn Youtube reviews: https://www.youtube.com/user/BartjuhB/videos


  • Pimmetje651
  • Registratie: oktober 2001
  • Laatst online: 10:48
Pimmetje651 schreef op woensdag 12 februari 2020 @ 10:33:
[...]

Is er een manier om hierover met je te sparren ? ( via pm / 06 / etc.)
@JDunnio ?🧐

Its'nice 2be important, but it's more important 2be nice


  • -Casper
  • Registratie: juni 2012
  • Laatst online: 13:27
Ik ben nieuw met node red. Ik draai het als addon in home assistant.
Bezig met wat eerste testjes en wil een condition maken dat ik thuis ben.
https://tweakers.net/i/BdlcNxBOHTB9uhu-iowkBAiJODU=/800x/f/image/fNxRT4ke0xQE8wmXpoGwtkrA.png?f=fotoalbum_large

Als ik het goed begrijp heeft hij 13:01 wel begrepen dat er een true boolean wordt ontvangen, maar er wordt verder niets uitgevoerd (lichten zijn niet vervolgens aangezet). Gevoelsmatig maak ik een domme fout, maar zie het helaas nog niet...
@-Casper Je hebt de state check op Boolean gezet. Je bent thuis, dus hij output "true". Je filtert echter op de state 'home'. true != home, dus hij gaat niet door. Je moet de state type op String zetten en met een Change node daarna zul je de payload op een boolean moeten zetten

  • -Casper
  • Registratie: juni 2012
  • Laatst online: 13:27
lolgast schreef op woensdag 4 maart 2020 @ 13:15:
@-Casper Je hebt de state check op Boolean gezet. Je bent thuis, dus hij output "true". Je filtert echter op de state 'home'. true != home, dus hij gaat niet door. Je moet de state type op String zetten en met een Change node daarna zul je de payload op een boolean moeten zetten
Ah thanks. Ik dacht dat de uitkomst van de node true was 8)7

  • Waterkoker
  • Registratie: september 2001
  • Niet online
In Node-Red gebruik ik een change node om bepaalde resultaten weg te filteren. Nu wil ik ook graag een getallenreeks als 854.8295.205 filteren. Is er een optie of regex dat wanneer er in een getallenreeks twee punten aanwezig zijn, dat dit afgevangen wordt?
@Waterkoker Dit is de makkelijke manier: Onderstaande vervangt de . voor niks. Dus wordt hij verwijderd
JSON:
1
[{"id":"2ca47f69.f179d","type":"debug","z":"ba68260d.f9c468","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":710,"y":1460,"wires":[]},{"id":"1b3498b5.de89d7","type":"change","z":"ba68260d.f9c468","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$.payload.$replace(\".\",\"\")","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":1510,"wires":[["2ca47f69.f179d"]]},{"id":"a16edf21.343ac","type":"inject","z":"ba68260d.f9c468","name":"","topic":"","payload":"854.8295.205","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":1500,"wires":[["1b3498b5.de89d7","2ca47f69.f179d"]]}]

  • roynolf
  • Registratie: december 2009
  • Laatst online: 05-04 08:12
Node Red is nieuw voor mij en ik ben gestart met een tutorial gericht op nieuwe Node Red gebruikers.

Maar bij de allereerste flow loopt niet zoals verwacht/gewild.
Ik wil graag een LED op m'n breadboard schakelen door middel van een inject node:

https://tweakers.net/i/uR6IfbXgBXp4uBzHref4poA3kBc=/f/image/aoNZmTZ0ie3mJhb6fnyScMXo.png

Dit zijn de instellingen van de inject node:

https://tweakers.net/i/vtBEMKvxE_cWKJbuW5H7x1MDNo8=/f/image/CTFNRFqq5qTmkh50dtm9Cyoh.png

De instellingen van de GPIO out node:

https://tweakers.net/i/62uWsUDETx94Gm1d0Kx4YrqiVng=/f/image/PSSiNxP0tTOA8Hujy9IuHTaC.png

Dit is de output van de debug node die gekoppeld is:

https://tweakers.net/i/imv-IXiVajOT5BRGPONd0sTUkXk=/f/image/miIDPXNLt0FS2sIwQv9hAhHM.png

Ik weet echt niet wat ik verkeer doe. Ook niet nadat ik tal van filmpjes op Youtube heb bekeken.

Ter info, de LED is weldegelijk goed geschakeld want als ik de LED als switch toevoeg in Home Assistant dan kan die wil worden geschakeld (dmv slider) zonder enig probleem. Het lijkt dus ergens mis te lopen met Node Red.

  • Gizz
  • Registratie: maart 2001
  • Nu online

Gizz

Dunder-Mifflin, Inc.

Ik ken die Pi nodes niet, maar het eerste waar ik aan moet denken is of de koppeling met de Pi wel goed is ingesteld. Kun je dat ergens configureren? Of gaat die node er gewoon vanuit dat NR lokaal op de betreffende Pi draait?

Je flow delen is vaak handiger dan alleen screenshots :)

Canon EOS 5Dm3 + 5D + 7D + 300D + 1000FN + EF 17-40 4L + EF 35 1.4L + EF 50 1.8 + EF 80-200 2.8L + 550EX


  • roynolf
  • Registratie: december 2009
  • Laatst online: 05-04 08:12
Gizz schreef op donderdag 12 maart 2020 @ 15:15:
Ik ken die Pi nodes niet, maar het eerste waar ik aan moet denken is of de koppeling met de Pi wel goed is ingesteld. Kun je dat ergens configureren? Of gaat die node er gewoon vanuit dat NR lokaal op de betreffende Pi draait?

Je flow delen is vaak handiger dan alleen screenshots :)
Dag Gizz,

De eerste afbeelding is de flow, toch? Misschien hebben we een verschillende invulling van de term flow?

Als je de topic openklapt dan zie je de details.

Misschien nog belangrijk om mee te delen. HA open ik via duckdns dus misschien zit dit er voor iets tussen?
Dit zijn de instellingen van Node Red in HA:

credential_secret: mycredentialsecret
dark_mode: false
http_node:
username: **username**
password: **password**
http_static:
username: **username**
password: **password**
ssl: true
certfile: fullchain.pem
keyfile: privkey.pem
require_ssl: true
system_packages: []
npm_packages: []
init_commands: []

  • Gizz
  • Registratie: maart 2001
  • Nu online

Gizz

Dunder-Mifflin, Inc.

Dat is een screenshot van je flow. Je kunt de flow zelf exporteren onder het hamburgermenuutje -> export -> clipboard. Als je die tekst hier plaatst is het makkelijker voor anderen om met je mee te kijken.

Je beschrijft nu de inhoud van de HA-node, maar.. de Raspberry Pi node die je gebruikt, die doet daar toch helemaal niets mee? Volgens mij kijkt die node gewoon naar de GPIO-pinnen op de Pi zelf waar ook node-RED op draait. Maar dat werkt dus alleen als NR op die Pi draait.

Dit is een voorbeeld waarom het handiger is als je de flow zelf deelt. Ik heb nu op basis van het icoontje gegokt welke Pi-node je gebruikt (ik denk deze), maar dat weet ik niet zeker.

Canon EOS 5Dm3 + 5D + 7D + 300D + 1000FN + EF 17-40 4L + EF 35 1.4L + EF 50 1.8 + EF 80-200 2.8L + 550EX


  • roynolf
  • Registratie: december 2009
  • Laatst online: 05-04 08:12
Gizz schreef op donderdag 12 maart 2020 @ 15:38:
Dat is een screenshot van je flow. Je kunt de flow zelf exporteren onder het hamburgermenuutje -> export -> clipboard. Als je die tekst hier plaatst is het makkelijker voor anderen om met je mee te kijken.

Je beschrijft nu de inhoud van de HA-node, maar.. de Raspberry Pi node die je gebruikt, die doet daar toch helemaal niets mee? Volgens mij kijkt die node gewoon naar de GPIO-pinnen op de Pi zelf waar ook node-RED op draait. Maar dat werkt dus alleen als NR op die Pi draait.

Dit is een voorbeeld waarom het handiger is als je de flow zelf deelt. Ik heb nu op basis van het icoontje gegokt welke Pi-node je gebruikt (ik denk deze), maar dat weet ik niet zeker.
Gizz, bedankt om dit duidelijk te maken.

Hieronder een export van mijn flow:

code:
1
[{"id":"83b569c4.232368","type":"tab","label":"GPIO","disabled":false,"info":""},{"id":"a1183974.d04248","type":"rpi-gpio out","z":"83b569c4.232368","name":"","pin":"12","set":true,"level":"0","freq":"","out":"out","x":400,"y":100,"wires":[]},{"id":"1e442f2f.5a0121","type":"inject","z":"83b569c4.232368","name":"On","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":100,"wires":[["a1183974.d04248","36a4bf14.bb49"]]},{"id":"36a4bf14.bb49","type":"debug","z":"83b569c4.232368","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":420,"y":160,"wires":[]},{"id":"d3f4d7f6.54b288","type":"inject","z":"83b569c4.232368","name":"Off","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":160,"y":160,"wires":[["a1183974.d04248","36a4bf14.bb49"]]}]

  • Gizz
  • Registratie: maart 2001
  • Nu online

Gizz

Dunder-Mifflin, Inc.

@roynolf Dan nog de vraag: draai jij je Node-RED op de Raspberry Pi waar je die pin van aan wilt sturen?

Canon EOS 5Dm3 + 5D + 7D + 300D + 1000FN + EF 17-40 4L + EF 35 1.4L + EF 50 1.8 + EF 80-200 2.8L + 550EX


  • roynolf
  • Registratie: december 2009
  • Laatst online: 05-04 08:12
Gizz schreef op donderdag 12 maart 2020 @ 15:58:
@roynolf Dan nog de vraag: draai jij je Node-RED op de Raspberry Pi waar je die pin van aan wilt sturen?
Ik draai NR als add-on op het Home Assistant framework. Home assistant is geïnstalleerd op de SD-kaart die in de RPI steekt.

  • Frakke0
  • Registratie: februari 2012
  • Laatst online: 12:34
Hi All,

Zijn er al mensen in het volgende geslaagd?:
- Deurbel gaat - of eender wat
- Alles van de huidige state van sonos opslaan
- Announcement maken "Deurbel gaat"
- Alles terug hervatten

Ik probeer dit onder andere met PollyTTS, maar verder lijk ik nergens een voorbeeld te vinden.

  • sOid
  • Registratie: maart 2004
  • Niet online
Frakke0 schreef op maandag 16 maart 2020 @ 12:30:
Hi All,

Zijn er al mensen in het volgende geslaagd?:
- Deurbel gaat - of eender wat
- Alles van de huidige state van sonos opslaan
- Announcement maken "Deurbel gaat"
- Alles terug hervatten

Ik probeer dit onder andere met PollyTTS, maar verder lijk ik nergens een voorbeeld te vinden.
Heb je alles gekoppeld aan een systeem zoals HomeAssistant? Want dan moet het wel kunnen. (Ben ook nog een beginner met Node-RED hoor, maar ik begrijp inmiddels de mogelijkheden wel.)

  • roynolf
  • Registratie: december 2009
  • Laatst online: 05-04 08:12
Met onderstaande flow wil ik de datum van de eerstvolgende huisvuilafhaling aftoetsen aan het huidige tijdstip. Komen beide overeen dan wil ik dit zien als output "on" in de compare node van de flow. Komen deze data niet overeen dan wordt "off" uitgestuurd. Ik zit al aardig dicht bij het gewenste resultaat maar het enige wat me voorlopig dwars zit is dat ik telkens 2 keer een outputbericht krijg - zie debug in afbeelding hieronder.

https://tweakers.net/i/RXRJ39n6_N7f9sCAMZqYXWh7ygQ=/800x/filters:strip_exif()/f/image/9ETqXneGwh5Z1P4rYqbXFqsS.png?f=fotoalbum_large

Kan iemand me misschien wat verder op pad helpen? Alvast bedankt...

code:
1
[{"id":"afb4ac57.563b1","type":"function","z":"ec86c47c.0f9d08","name":"Compare 2 timestamps","func":"context.data = context.data || {};\nswitch (msg.topic){\n    case \"googleCalendarTimestamp\":\n        context.data.googleCalendarTimestamp = msg.payload;\n        msg = null;\n        break;\n    case \"nowTimestamp\":\n        context.data.nowTimestamp = msg.payload;\n        msg = null;\n        break;\n    default:\n        msg = null;\n        break;\n}\n\nif(context.data.googleCalendarTimestamp !== null && context.data.nowTimestamp !== null){\n    if(context.data.nowTimestamp == context.data.googleCalendarTimestamp){\n        context.data = null;\n        return {payload:\"on\"};\n    }\n    else{\n        context.data = null;\n        return {payload:\"off\"};\n    }\n}\nelse return msg;","outputs":1,"noerr":0,"x":1180,"y":180,"wires":[["8d8aad83.09cf6"]]}]

  • Frakke0
  • Registratie: februari 2012
  • Laatst online: 12:34
sOid schreef op donderdag 19 maart 2020 @ 16:47:
[...]

Heb je alles gekoppeld aan een systeem zoals HomeAssistant? Want dan moet het wel kunnen. (Ben ook nog een beginner met Node-RED hoor, maar ik begrijp inmiddels de mogelijkheden wel.)
Ik heb al een andere Domotica omgeving :)
Zou dus liever enkel bij de uitbreiding van node-red blijven, zonder naar home assistant te moeten kijken.

  • Tsurany
  • Registratie: juni 2006
  • Niet online
@roynolf wat er gebeurt is dat je de flow splitst. Hierdoor komen er twee aparte berichten bij je function node waardoor hij twee keer uitgevoerd wordt. Wil je dit oplossen dan kan je twee dingen doen:
1. De flow sequentieel maken. Dus niet na de initiate splitsen maar alle acties achter elkaar uitvoeren.
2. Een join node gebruiken voor de function waarbij je de data weer samenvoegt.

  • sOid
  • Registratie: maart 2004
  • Niet online
@Frakke0 Okay! Als je Node-RED gebruikt icm HASS zou het (volgens mij) zoiets zijn:

State van deurbel = rinkelen (of whatever ;)) > pause Sonos > TTS via Sonos "De deurbel gaat!" > unpause Sonos.

HASS heeft mooie eigen componenten in Node-RED waardoor het gemakkelijk is om de sensor state (deurbel in dit geval) te achterhalen. Wellicht heeft je eigen domotica-omgeving een soortgelijke NR-extensie.

  • TWKterry
  • Registratie: januari 2001
  • Laatst online: 13:42

TWKterry

Let's make better things

@roynolf zou je de code voor deze flow kunnen posten.
Ik probeer een check voor vandaag/morgen in te bouwen maar het doorgeven van de twee timestamps naar de compare wil niet goed lukken, een is een timestamp de andere een string met datum.

Alvast bedankt.

  • roynolf
  • Registratie: december 2009
  • Laatst online: 05-04 08:12
Tsurany schreef op vrijdag 20 maart 2020 @ 09:04:
@roynolf wat er gebeurt is dat je de flow splitst. Hierdoor komen er twee aparte berichten bij je function node waardoor hij twee keer uitgevoerd wordt. Wil je dit oplossen dan kan je twee dingen doen:
1. De flow sequentieel maken. Dus niet na de initiate splitsen maar alle acties achter elkaar uitvoeren.
2. Een join node gebruiken voor de function waarbij je de data weer samenvoegt.
@Tsurany, bedankt voor jouw input. Ik heb de flow werkende ondertussen...

  • roynolf
  • Registratie: december 2009
  • Laatst online: 05-04 08:12
TWKterry schreef op zaterdag 21 maart 2020 @ 15:07:
@roynolf zou je de code voor deze flow kunnen posten.
Ik probeer een check voor vandaag/morgen in te bouwen maar het doorgeven van de twee timestamps naar de compare wil niet goed lukken, een is een timestamp de andere een string met datum.

Alvast bedankt.
@TWKterry have fun...
code:
1
[{"id":"ec86c47c.0f9d08","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"3daf1d20.4f7ad2","type":"comment","z":"ec86c47c.0f9d08","name":"Notificatie voor ophaling huisvuil, PMD en karton en groen afval","info":"","x":290,"y":60,"wires":[]},{"id":"1d7f920.12b936e","type":"inject","z":"ec86c47c.0f9d08","name":"Every day @ 17:00","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"00 17 * * *","once":false,"onceDelay":0.1,"x":180,"y":140,"wires":[["134bd65f.530cea","85e591db.e7ad3"]]},{"id":"134bd65f.530cea","type":"api-current-state","z":"ec86c47c.0f9d08","name":"Huisvuilkalender","server":"470eea20.99f4f4","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"calendar.huisvuil","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":420,"y":140,"wires":[["7b18bad3.8e20f4"]]},{"id":"7b18bad3.8e20f4","type":"moment","z":"ec86c47c.0f9d08","name":"googleCalendarTimestamp","topic":"googleCalendarTimestamp","input":"data.attributes.start_time","inputType":"msg","inTz":"Europe/Brussels","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYY-MM-DD HH:mm","locale":"C","output":"","outputType":"msg","outTz":"Europe/Brussels","x":640,"y":140,"wires":[["adaa546a.8595a8"]]},{"id":"85e591db.e7ad3","type":"moment","z":"ec86c47c.0f9d08","name":"nowTimestamp","topic":"nowTimestamp","input":"","inputType":"msg","inTz":"Europe/Brussels","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYY-MM-DD HH:mm","locale":"C","output":"","outputType":"msg","outTz":"Europe/Brussels","x":600,"y":220,"wires":[["adaa546a.8595a8"]]},{"id":"adaa546a.8595a8","type":"join","z":"ec86c47c.0f9d08","name":"Join timestamps","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":880,"y":180,"wires":[["e356d0a5.fb27","dbf6052a.395738"]]},{"id":"e356d0a5.fb27","type":"debug","z":"ec86c47c.0f9d08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1130,"y":120,"wires":[]},{"id":"dbf6052a.395738","type":"function","z":"ec86c47c.0f9d08","name":"Compare timestamps","func":"var now = msg.payload.nowTimestamp;\nvar google = msg.payload.googleCalendarTimestamp;\n\nif(google == now){\n    msg.payload = \"On\";\n} \nelse {\n    msg.payload = \"Off\";\n}\nreturn msg;\n\n","outputs":1,"noerr":0,"x":1160,"y":180,"wires":[["92b52b54.991048","c5c8fd2.e297b"]]},{"id":"92b52b54.991048","type":"debug","z":"ec86c47c.0f9d08","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1370,"y":260,"wires":[]},{"id":"ec5fd54a.4d5f88","type":"api-call-service","z":"ec86c47c.0f9d08","name":"Notification to Angelique","server":"470eea20.99f4f4","version":1,"debugenabled":false,"service_domain":"notify","service":"mobile_app_samsung_s8_angelique","entityId":"","data":"{\"title\":\"Huisvuil buiten!\",\"message\":\"Morgenochtend is er een huisvuilophaling voorzien.\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1690,"y":180,"wires":[[]]},{"id":"8f452ed.34331d","type":"api-call-service","z":"ec86c47c.0f9d08","name":"Notification to Roy","server":"470eea20.99f4f4","version":1,"debugenabled":false,"service_domain":"notify","service":"mobile_app_oneplus_a6003","entityId":"","data":"{\"title\":\"Huisvuil buiten!\",\"message\":\"Morgenochtend is er een huisvuilophaling voorzien.\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1670,"y":120,"wires":[[]]},{"id":"c5c8fd2.e297b","type":"switch","z":"ec86c47c.0f9d08","name":"switchOn","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"On","vt":"str"},{"t":"eq","v":"Off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1440,"y":180,"wires":[["8f452ed.34331d","ec5fd54a.4d5f88"],[]]},{"id":"d7b1fda6.5a939","type":"comment","z":"ec86c47c.0f9d08","name":"Huisvuil","info":"","x":110,"y":100,"wires":[]},{"id":"470eea20.99f4f4","type":"server","z":"","name":"Home Assistant","addon":true}]

  • TWKterry
  • Registratie: januari 2001
  • Laatst online: 13:42

TWKterry

Let's make better things

@roynolf Dank voor je voorbeeld. Heb er dit van gemaakt waarbij ik test op vandaag, morgen of uit.

code:
1
[{"id":"8f6a9d7.037fb6","type":"tab","label":"Garbage","disabled":false,"info":""},{"id":"66b08080.791e","type":"inject","z":"8f6a9d7.037fb6","name":"every 4m","topic":"","payload":"","payloadType":"date","repeat":"240","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":200,"wires":[["96cefa6e.fdecc8","58b75ce1.660744"]]},{"id":"96cefa6e.fdecc8","type":"api-current-state","z":"8f6a9d7.037fb6","name":"","server":"65c60660.36b788","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"sensor.avri_gft","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":320,"y":120,"wires":[["5ab430d0.98a"]]},{"id":"62336bb6.f9b324","type":"moment","z":"8f6a9d7.037fb6","name":"sensorTime","topic":"sensorTime","input":"","inputType":"msg","inTz":"Europe/Amsterdam","adjAmount":0,"adjType":"days","adjDir":"add","format":"X","locale":"C","output":"","outputType":"msg","outTz":"Europe/Amsterdam","x":770,"y":120,"wires":[["489953c6.1e8c7c","c3936a3.d3c1198"]]},{"id":"6e1e8ca.b7dad74","type":"debug","z":"8f6a9d7.037fb6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1470,"y":180,"wires":[]},{"id":"154e154e.1c2a7b","type":"debug","z":"8f6a9d7.037fb6","name":"now","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":970,"y":260,"wires":[]},{"id":"489953c6.1e8c7c","type":"debug","z":"8f6a9d7.037fb6","name":"sensor","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":970,"y":100,"wires":[]},{"id":"81aaf8ed.2cf838","type":"debug","z":"8f6a9d7.037fb6","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1210,"y":240,"wires":[]},{"id":"8d0daea3.31c5a","type":"comment","z":"8f6a9d7.037fb6","name":"tweakers","info":"TWEAKERS NODERED FORUM\n\nMet onderstaande flow wil ik de datum van de eerstvolgende huisvuilafhaling aftoetsen aan het huidige tijdstip. Komen beide overeen dan wil ik dit zien als output \"on\" in de compare node van de flow. Komen deze data niet overeen dan wordt \"off\" uitgestuurd. Ik zit al aardig dicht bij het gewenste resultaat maar het enige wat me voorlopig dwars zit is dat ik telkens 2 keer een outputbericht krijg - zie debug in afbeelding hieronder.\n\nhttps://tweakers.net/i/RXRJ39n6_N7f9sCAMZqYXWh7ygQ=/800x/filters:strip_exif()/f/image/9ETqXneGwh5Z1P4rYqbXFqsS.png?f=fotoalbum_large\n\nKan iemand me misschien wat verder op pad helpen? Alvast bedankt\n\n\n\n\nvrijdag 20 maart 2020 09:04\n\nBekijkBookmarkRapporteerQuote0Henk 'm!\nTsurany\n\n\n@roynolf wat er gebeurt is dat je de flow splitst. Hierdoor komen er twee aparte berichten bij je function node waardoor hij twee keer uitgevoerd wordt. Wil je dit oplossen dan kan je twee dingen doen:\n1. De flow sequentieel maken. Dus niet na de initiate splitsen maar alle acties achter elkaar uitvoeren.\n2. Een join node gebruiken voor de function waarbij je de data weer samenvoegt.\n3. \n\n2020-03-21 1729\n@TWKterry have fun...\ncode:\n","x":120,"y":320,"wires":[]},{"id":"c8c08e3b.bae12","type":"moment","z":"8f6a9d7.037fb6","name":"nowTime","topic":"nowTime","input":"","inputType":"msg","inTz":"Europe/Amsterdam","adjAmount":0,"adjType":"days","adjDir":"add","format":"X","locale":"C","output":"","outputType":"msg","outTz":"Europe/Amsterdam","x":760,"y":240,"wires":[["154e154e.1c2a7b","c3936a3.d3c1198"]]},{"id":"c3936a3.d3c1198","type":"join","z":"8f6a9d7.037fb6","name":"Join timestamps","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1000,"y":180,"wires":[["81aaf8ed.2cf838","ccb55f2a.64031"]]},{"id":"ccb55f2a.64031","type":"function","z":"8f6a9d7.037fb6","name":"Compare 2 timestamps","func":"// compare unix timestamp of YYYY-MM-DD\n// no hr/min/sec;  day = 86400 (24x60x60)\nvar now = msg.payload.nowTime;\nvar sensor = msg.payload.sensorTime;\n\nswitch (sensor-now)\n{\n    case 0: msg.payload = \"Today\"; break;\n    case 86400: msg.payload = \"Tomorrow\"; break;\n    default: msg.payload = \"Off\"; break;\n}\nreturn msg;\n","outputs":1,"noerr":0,"x":1250,"y":180,"wires":[["6e1e8ca.b7dad74"]]},{"id":"f55099aa.5fbcf8","type":"comment","z":"8f6a9d7.037fb6","name":"Unix Timestamp for midnight","info":"avoid prbolems when year ends, use Unix Timestamp X\nfirst convert to midnight YYYY-MM-DD\nomit hours, minutes and seconds\n","x":660,"y":180,"wires":[]},{"id":"5ab430d0.98a","type":"moment","z":"8f6a9d7.037fb6","name":"","topic":"","input":"","inputType":"msg","inTz":"Europe/Amsterdam","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYY-MM-DD","locale":"C","output":"","outputType":"msg","outTz":"Europe/Amsterdam","x":580,"y":120,"wires":[["62336bb6.f9b324"]]},{"id":"58b75ce1.660744","type":"moment","z":"8f6a9d7.037fb6","name":"","topic":"","input":"","inputType":"msg","inTz":"Europe/Amsterdam","adjAmount":0,"adjType":"days","adjDir":"add","format":"YYYY-MM-DD","locale":"C","output":"","outputType":"msg","outTz":"Europe/Amsterdam","x":580,"y":240,"wires":[["c8c08e3b.bae12"]]},{"id":"65c60660.36b788","type":"server","z":"","name":"Home Assistant","addon":true}]


https://tweakers.net/i/MAY8ZHwRu-knyA8dmFvIaMEPpqk=/800x/filters:strip_exif()/f/image/nltBoWwfhfSMmh3xFvCJrCgG.png?f=fotoalbum_large

  • bramv82
  • Registratie: oktober 2010
  • Laatst online: 11:09
Totale beginner wat betreft Nodered hier. Ik ben bezig de overstap te maken van Domoticz naar Home Assistant en probeer een automatisering te maken voor de ventilatie.
Ik heb een CO2 sensor en afhankelijk van de waarde wordt er een 0-10V dimmer (KaKu) aangestuurd. Deze staat als een "light" in Home assistant en wordt geregeld dmv de brightness.

https://tweakers.net/i/QGHCgQO_F94bEfVQS0TlmQkI4Qw=/800x/filters:strip_exif()/f/image/kBJfBUL54UTKrLfvjK6vPz5q.png?f=fotoalbum_large

Het programma werkt. Alleen wordt er nu elke minuut een signaal gestuurd naar de kaku dimmer. Dit wil ik beperken om niet teveel "vervuiling" de lucht in te sturen. Hoe kan ik dit bereiken in Nodered? Dus alleen een waarde aansturen als deze ook acht verandert?

Tweede vraag: Hoe kan ik data wegschrijven in een variabele en deze daarna oproepen? Bijvoorbeeld: bij ventilatie op 10%, set variabele ventilatiestand=10

[Voor 3% gewijzigd door bramv82 op 23-03-2020 09:47]


Acties:
  • +2Henk 'm!

  • Kaspers
  • Registratie: juni 2004
  • Laatst online: 03-04 17:51
Ha @bramv82, je zou dit een stuk simpeler kunnen oplossen met de 'range' node.

In mijn geval wordt een CO2 waarde van 600 tot 800 gemapped op de snelheid van de ventilator (0 tot 100%):
https://i.imgur.com/sLZ2EC0.png

  • Gizz
  • Registratie: maart 2001
  • Nu online

Gizz

Dunder-Mifflin, Inc.

@Kaspers Helemaal eens, zo heb ik het ook gedaan: Gizz in "Node-RED - grafisch 'programmeren' (bijv. voor domotica)"

En @bramv82, in je huidige opzet krijgt je 0-10v elke keer een update als je sensor een update stuurt. Je kunt een throttle-node toevoegen waarmee je bijvoorbeeld zegt dat er maar 1 berichtje per 5 minuten door de flow mag gaan.

Canon EOS 5Dm3 + 5D + 7D + 300D + 1000FN + EF 17-40 4L + EF 35 1.4L + EF 50 1.8 + EF 80-200 2.8L + 550EX


  • sOid
  • Registratie: maart 2004
  • Niet online
Ik ben in NR bezig om een wake-up light te maken. Het lichtgedeelte heb ik werkend, maar ik wil ook m'n radio koppelen (Bose SoundTouch). NR werkt samen met HomeAssistant.

Probleem is echter dat het me niet lukt om het volume van de radio in X-tijd van 0 naar 25% te verhogen. Het is niet echt lekker om wakker te worden met een radio die ineens aanspringt op 25% ;) Het volume springt met onerstaande opzet meteen naar die 25%.

Enig idee hoe ik dit kan fiksen? Dit is overigens niet mijn stukje code, de basis heb ik hier vandaan.

code:
1
[{"id":"fe4e0ac5.3a30d","type":"comment","z":"2769e554.9b801a","name":"LOOP LOGIC ","info":"","x":130,"y":740,"wires":[]},{"id":"ac1edf7e.75c3c8","type":"comment","z":"2769e554.9b801a","name":"Finish Alarm Sequence","info":"","x":1020,"y":900,"wires":[]},{"id":"f0c5ad3a.c392e","type":"change","z":"2769e554.9b801a","name":"Stop","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":920,"wires":[["c78eeff3.4dc17"]]},{"id":"b62b5489.ba61c","type":"change","z":"2769e554.9b801a","name":"Start","rules":[{"t":"set","p":"payload","pt":"msg","to":"start","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":740,"wires":[["c78eeff3.4dc17"]]},{"id":"7f932276.b21204","type":"switch","z":"2769e554.9b801a","name":"Is Loop Done?","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"done","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":1340,"y":900,"wires":[["8316fe11.57c7a"]]},{"id":"8316fe11.57c7a","type":"link out","z":"2769e554.9b801a","name":"FINISH ALARM SEQUENCE!","links":["f3e196fd.3c24a8"],"x":1175,"y":900,"wires":[]},{"id":"c78eeff3.4dc17","type":"traffic","z":"2769e554.9b801a","name":"Turn Up Volume","property_allow":"payload","filter_allow":"start","ignore_case_allow":true,"negate_allow":false,"send_allow":false,"property_stop":"payload","filter_stop":"stop","ignore_case_stop":false,"negate_stop":false,"send_stop":false,"default_start":false,"differ":false,"x":640,"y":840,"wires":[["30db9f40.302f98"]]},{"id":"4ff94221.046324","type":"inject","z":"2769e554.9b801a","name":"Volume ---->","topic":"","payload":"volume","payloadType":"flow","repeat":"5","crontab":"","once":false,"onceDelay":0.1,"x":140,"y":840,"wires":[["c78eeff3.4dc17"]]},{"id":"30db9f40.302f98","type":"function","z":"2769e554.9b801a","name":"Set Volume","func":"newmsg = {};\nvar volume = flow.get(\"volume\");\n\nnewmsg.payload = { data: { \"volume_level\":volume} }\n\nreturn newmsg;","outputs":1,"noerr":0,"x":830,"y":840,"wires":[["f07d6100.697d08"]]},{"id":"f07d6100.697d08","type":"api-call-service","z":"2769e554.9b801a","name":"Bedroom Speaker","server":"a4b021fc.a9221","version":1,"debugenabled":false,"service_domain":"media_player","service":"volume_set","entityId":"media_player.zanger_rinus","data":"","dataType":"json","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":1090,"y":840,"wires":[["e0c09c6a.3807e"]]},{"id":"e0c09c6a.3807e","type":"function","z":"2769e554.9b801a","name":"Increment Volume","func":"var volume = flow.get('volume')||0.0;\n\nif (volume < 0.25) {\n    volume = volume + 0.01;\n    flow.set(\"volume\", volume);\n    \n    newmsg = {\"payload\":\"looping\"}\n    return newmsg;\n}\nelse {\n    newmsg = {\"payload\":\"done\"};\n    return newmsg;\n}","outputs":1,"noerr":0,"x":1350,"y":840,"wires":[["7f932276.b21204"]]},{"id":"714dcfe6.2f7e","type":"comment","z":"2769e554.9b801a","name":"VOLUME","info":"","x":600,"y":800,"wires":[]},{"id":"8dc3ac5f.627e2","type":"inject","z":"2769e554.9b801a","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":220,"y":640,"wires":[["b62b5489.ba61c"]]},{"id":"f3e196fd.3c24a8","type":"link in","z":"2769e554.9b801a","name":"","links":["8316fe11.57c7a"],"x":275,"y":920,"wires":[["f0c5ad3a.c392e"]]},{"id":"a4b021fc.a9221","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]
sOid schreef op dinsdag 24 maart 2020 @ 13:07:
Ik ben in NR bezig om een wake-up light te maken. Het lichtgedeelte heb ik werkend, maar ik wil ook m'n radio koppelen (Bose SoundTouch). NR werkt samen met HomeAssistant.

Probleem is echter dat het me niet lukt om het volume van de radio in X-tijd van 0 naar 25% te verhogen. Het is niet echt lekker om wakker te worden met een radio die ineens aanspringt op 25% ;) Het volume springt met onerstaande opzet meteen naar die 25%.
Ik doe het als volgt (met mijn Denon HEOS speaker)
code:
1
[{"id":"61d71f76.530158","type":"link in","z":"9a51dd22.996408","name":"HEOS Wekker","links":["502f8407.2a78e4","94042966.0efaa8"],"x":515,"y":780,"wires":[["41dfb69a.21891"]]},{"id":"eaabad28.677f3","type":"api-call-service","z":"9a51dd22.996408","name":"Afspeellijst starten","server":"2df28887.b05ab8","version":1,"service_domain":"media_player","service":"play_media","entityId":"media_player.heos_zolder","data":"{\"media_content_type\":\"playlist\",\"media_content_id\":\"wekker\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1160,"y":780,"wires":[["37b438f2.02d5e8"]]},{"id":"c7dba0d4.20493","type":"delay","z":"9a51dd22.996408","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":990,"y":780,"wires":[["eaabad28.677f3"]]},{"id":"37b438f2.02d5e8","type":"delay","z":"9a51dd22.996408","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1340,"y":780,"wires":[["60458d30.9c631c"]]},{"id":"3994b04b.297b28","type":"api-call-service","z":"9a51dd22.996408","name":"Volume 1%","server":"2df28887.b05ab8","version":1,"service_domain":"media_player","service":"volume_set","entityId":"media_player.heos_zolder","data":"{\"volume_level\":0.01}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":820,"y":780,"wires":[["c7dba0d4.20493"]]},{"id":"41dfb69a.21891","type":"delay","z":"9a51dd22.996408","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":670,"y":780,"wires":[["3994b04b.297b28"]]},{"id":"60458d30.9c631c","type":"api-call-service","z":"9a51dd22.996408","name":"HEOS unmute","server":"2df28887.b05ab8","version":1,"service_domain":"media_player","service":"volume_mute","entityId":"media_player.heos_zolder","data":"{\"is_volume_muted\":false}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1510,"y":780,"wires":[["adb9342d.bb8508"]]},{"id":"477b3b72.b1ff94","type":"function","z":"9a51dd22.996408","name":"Volume 1 hoger","func":"newmsg = {};\nvolume = msg.payload;\n\nif (volume < 15)\n{\n  volume = volume + 1;\n  newmsg.payload = volume;\n  return newmsg;\n}","outputs":1,"noerr":0,"x":1900,"y":780,"wires":[["44f1af6d.155918","388077b8.209e28"]]},{"id":"44f1af6d.155918","type":"delay","z":"9a51dd22.996408","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1980,"y":710,"wires":[["477b3b72.b1ff94"]]},{"id":"388077b8.209e28","type":"function","z":"9a51dd22.996408","name":"Delen door 100","func":"newmsg = {};\nvolume = msg.payload;\nvolume = volume / 100;\nnewmsg.payload = volume;\nreturn newmsg;","outputs":1,"noerr":0,"x":2120,"y":780,"wires":[["4ec65c0c.c14364"]]},{"id":"adb9342d.bb8508","type":"change","z":"9a51dd22.996408","name":"1","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1680,"y":780,"wires":[["477b3b72.b1ff94"]]},{"id":"4ec65c0c.c14364","type":"api-call-service","z":"9a51dd22.996408","name":"Volume","server":"2df28887.b05ab8","version":1,"service_domain":"media_player","service":"volume_set","entityId":"media_player.heos_zolder","data":"{\"volume_level\":{{payload}}}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":2290,"y":780,"wires":[[]]},{"id":"2df28887.b05ab8","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]


M.a.w. ik zet het volume expliciet op 0.01 door HA, daarna start ik het afspelen van een playlist (en doe ik nog een unmute voor de zekerheid). Daarna wordt de payload op 1 gezet, en is er een loopje die elke paar seconden de payload ophoogt totdat deze 15 is (dat is in mijn geval het maximale volume wat ik wil bereiken). Voordat HA aangeroepen wordt, deelt hij het door 100, omdat HA een waarde tussen 0 en 1 wil krijgen.
(uiteraard kan dat rekenwerk ook simpeler)

  • sOid
  • Registratie: maart 2004
  • Niet online
@DeadMetal Thanks, ga ik vanavond naar kijken!

  • MiZtraL
  • Registratie: april 2001
  • Laatst online: 28-03 21:25
(deleted)

[Voor 101% gewijzigd door MiZtraL op 28-03-2020 16:18]


  • Gizz
  • Registratie: maart 2001
  • Nu online

Gizz

Dunder-Mifflin, Inc.

@MiZtraL Er zij meerdere wegen die naar Rome leiden, maar ik zou het zelf als volgt doen:

Je pakt een switch node die twee kanten op gaat:
Als msg.payload.0.direction == "backward" , doorsturen naar uitgang 1
Als msg.payload.0.direction == "forward" , doorsturen naar uitgang 2

In beide voorbeelden die je geeft staat de info die je nodig hebt sowieso in msg.payload.0.direction, dus ik zou msg.payload.1 negeren.

Na uitgang 1 komt een javascript node met iets als:
code:
1
2
3
4
5
6
7
var nieuweteller = flow.get('teller')
nieuweteller--;
// store the value back
flow.set('teller',nieuweteller);
// make it part of the outgoing msg object
msg.teller = nieuweteller;
return msg;


En bij uitgang 2:
code:
1
2
3
4
5
6
7
var nieuweteller = flow.get('teller')
nieuweteller++
// store the value back
flow.set('teller',nieuweteller);
// make it part of the outgoing msg object
msg.teller = nieuweteller;
return msg;


Grafiekjes maken in Node-RED heb ik nog nooit gedaan, dus daar moet ik het antwoord op schuldig blijven ;)

edit: waarom haal je nou je hele post weg? Nu zien anderen niet waarop ik reageer en kunnen ze hier minder makkelijk van leren. Jammer :)

[Voor 6% gewijzigd door Gizz op 28-03-2020 16:52]

Canon EOS 5Dm3 + 5D + 7D + 300D + 1000FN + EF 17-40 4L + EF 35 1.4L + EF 50 1.8 + EF 80-200 2.8L + 550EX


  • peligro2k
  • Registratie: december 2001
  • Laatst online: 12:25
Ik heb een Zigbee knop die het volgende MQTT bericht verzend.

Ik druk knop 1 in

code:
1
zigbee2mqtt:info  2020-03-28 19:17:22: MQTT publish: topic 'zigbee2mqtt/0x00124b001f8347bc', payload '{"btn_17":true,"linkquality":111,"battery":38,"voltage":2438,"btn_1":false,"btn_5":true,"btn_13":true,"btn_9":true,"btn_18":true,"btn_10":true,"btn_6":true,"btn_7":true,"btn_14":true,"btn_19":true,"btn_15":true,"btn_2":true,"btn_16":true,"btn_8":true,"btn_3":true,"btn_11":true,"btn_12":true,"btn_20":false,"btn_4":true}'


Ik druk nogmaals knop 1 in (zie true/false)

code:
1
zigbee2mqtt:info  2020-03-28 19:17:30: MQTT publish: topic 'zigbee2mqtt/0x00124b001f8347bc', payload '{"btn_17":true,"linkquality":111,"battery":38,"voltage":2438,"btn_1":true,"btn_5":true,"btn_13":true,"btn_9":true,"btn_18":true,"btn_10":true,"btn_6":true,"btn_7":true,"btn_14":true,"btn_19":true,"btn_15":true,"btn_2":true,"btn_16":true,"btn_8":true,"btn_3":true,"btn_11":true,"btn_12":true,"btn_20":false,"btn_4":true}'


Iemand enig idee wat de beste manier is om dit in NodeRed te programmeren? He gaat in totaal in 20 knoppen, die dus allemaal een true/false status aangeven.
Begrijp ik goed dat als je een knop indrukt, deze toggelt tussen true en false. En dat je in hetzelfde bericht ook de status van alle andere knoppen meegestuurd krijgt? M.a.w. je moet zelf nog uitvogelen welke knop werd ingedrukt?
Is het dus eigenlijk een soort afstandsbediening met 20 knoppen? Ben benieuwd om welk apparaat het gaat.

[Voor 18% gewijzigd door DeadMetal op 29-03-2020 12:34]


  • peligro2k
  • Registratie: december 2001
  • Laatst online: 12:25
DeadMetal schreef op zondag 29 maart 2020 @ 12:33:
Begrijp ik goed dat als je een knop indrukt, deze toggelt tussen true en false. En dat je in hetzelfde bericht ook de status van alle andere knoppen meegestuurd krijgt? M.a.w. je moet zelf nog uitvogelen welke knop werd ingedrukt?
Is het dus eigenlijk een soort afstandsbediening met 20 knoppen? Ben benieuwd om welk apparaat het gaat.
Ja dat klopt. Ik vind het zelf ook een erg vreemde opzet, maar het is een soort DIY project.

https://translate.google....2Fmodkam.ru%2F%3Fp%3D1114


Ik probeer met een RBE functie in NR alleen de waarde uit te lezen die veranderd is, maar dit lijkt niks te doen.

Acties:
  • +2Henk 'm!

  • sOid
  • Registratie: maart 2004
  • Niet online
DeadMetal schreef op zaterdag 28 maart 2020 @ 09:33:
[...]


Ik doe het als volgt (met mijn Denon HEOS speaker)
code:
1
[{"id":"61d71f76.530158","type":"link in","z":"9a51dd22.996408","name":"HEOS Wekker","links":["502f8407.2a78e4","94042966.0efaa8"],"x":515,"y":780,"wires":[["41dfb69a.21891"]]},{"id":"eaabad28.677f3","type":"api-call-service","z":"9a51dd22.996408","name":"Afspeellijst starten","server":"2df28887.b05ab8","version":1,"service_domain":"media_player","service":"play_media","entityId":"media_player.heos_zolder","data":"{\"media_content_type\":\"playlist\",\"media_content_id\":\"wekker\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1160,"y":780,"wires":[["37b438f2.02d5e8"]]},{"id":"c7dba0d4.20493","type":"delay","z":"9a51dd22.996408","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":990,"y":780,"wires":[["eaabad28.677f3"]]},{"id":"37b438f2.02d5e8","type":"delay","z":"9a51dd22.996408","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1340,"y":780,"wires":[["60458d30.9c631c"]]},{"id":"3994b04b.297b28","type":"api-call-service","z":"9a51dd22.996408","name":"Volume 1%","server":"2df28887.b05ab8","version":1,"service_domain":"media_player","service":"volume_set","entityId":"media_player.heos_zolder","data":"{\"volume_level\":0.01}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":820,"y":780,"wires":[["c7dba0d4.20493"]]},{"id":"41dfb69a.21891","type":"delay","z":"9a51dd22.996408","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":670,"y":780,"wires":[["3994b04b.297b28"]]},{"id":"60458d30.9c631c","type":"api-call-service","z":"9a51dd22.996408","name":"HEOS unmute","server":"2df28887.b05ab8","version":1,"service_domain":"media_player","service":"volume_mute","entityId":"media_player.heos_zolder","data":"{\"is_volume_muted\":false}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1510,"y":780,"wires":[["adb9342d.bb8508"]]},{"id":"477b3b72.b1ff94","type":"function","z":"9a51dd22.996408","name":"Volume 1 hoger","func":"newmsg = {};\nvolume = msg.payload;\n\nif (volume < 15)\n{\n  volume = volume + 1;\n  newmsg.payload = volume;\n  return newmsg;\n}","outputs":1,"noerr":0,"x":1900,"y":780,"wires":[["44f1af6d.155918","388077b8.209e28"]]},{"id":"44f1af6d.155918","type":"delay","z":"9a51dd22.996408","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1980,"y":710,"wires":[["477b3b72.b1ff94"]]},{"id":"388077b8.209e28","type":"function","z":"9a51dd22.996408","name":"Delen door 100","func":"newmsg = {};\nvolume = msg.payload;\nvolume = volume / 100;\nnewmsg.payload = volume;\nreturn newmsg;","outputs":1,"noerr":0,"x":2120,"y":780,"wires":[["4ec65c0c.c14364"]]},{"id":"adb9342d.bb8508","type":"change","z":"9a51dd22.996408","name":"1","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1680,"y":780,"wires":[["477b3b72.b1ff94"]]},{"id":"4ec65c0c.c14364","type":"api-call-service","z":"9a51dd22.996408","name":"Volume","server":"2df28887.b05ab8","version":1,"service_domain":"media_player","service":"volume_set","entityId":"media_player.heos_zolder","data":"{\"volume_level\":{{payload}}}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":2290,"y":780,"wires":[[]]},{"id":"2df28887.b05ab8","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]


M.a.w. ik zet het volume expliciet op 0.01 door HA, daarna start ik het afspelen van een playlist (en doe ik nog een unmute voor de zekerheid). Daarna wordt de payload op 1 gezet, en is er een loopje die elke paar seconden de payload ophoogt totdat deze 15 is (dat is in mijn geval het maximale volume wat ik wil bereiken). Voordat HA aangeroepen wordt, deelt hij het door 100, omdat HA een waarde tussen 0 en 1 wil krijgen.
(uiteraard kan dat rekenwerk ook simpeler)
Held, 't werkt! Heel blij mee, dankjewel. Maar waarom zou een waarde van 0.01 niet kunnen? Dan hoef je die tweede functie (door 100 delen) niet uit te voeren.

@peligro2k Grappig projectje!

Acties:
  • +1Henk 'm!
sOid schreef op zondag 29 maart 2020 @ 21:40:
[...]
Maar waarom zou een waarde van 0.01 niet kunnen? Dan hoef je die tweede functie (door 100 delen) niet uit te voeren.
Super! Klopt, dat bedoelde ik met 'uiteraard kan dat rekenwerk ook simpeler'. Je zou inderdaad de payload op 0.01 kunnen zetten, en steeds verhogen met 0.01 totdat je het gewenste volume bereikt hebt, in mijn geval 0.15

/edit: bij mijzelf thuis nu ook meteen maar aangepast :)

[Voor 5% gewijzigd door DeadMetal op 30-03-2020 08:15]


  • sOid
  • Registratie: maart 2004
  • Niet online
DeadMetal schreef op maandag 30 maart 2020 @ 08:12:
[...]


Super! Klopt, dat bedoelde ik met 'uiteraard kan dat rekenwerk ook simpeler'. Je zou inderdaad de payload op 0.01 kunnen zetten, en steeds verhogen met 0.01 totdat je het gewenste volume bereikt hebt, in mijn geval 0.15

/edit: bij mijzelf thuis nu ook meteen maar aangepast :)
Zou je de nieuwe ook 's willen delen? Want somehow krijg ik het niet werkend (ja ik ben nog beginnend met NR ;)).

Ik heb de eerste function node aangepast naar dit, en de tweede verwijderd. Maar om een of andere reden wordt de laatste node (het daadwerkelijk verhogen van de volume) niet aangeroepen.

code:
1
2
3
4
5
6
7
8
9
newmsg = {};
volume = msg.payload;

if (volume < 0.25)
{
  volume = volume + 0.01;
  newmsg.payload = volume;
  return newmsg;
}
Ik heb het toch weer teruggedraaid. Blijkbaar vind NR het moeilijk om er 0.01 bij op te tellen, onvoorstelbaar.
Als ik er een debug node achter hang, is dit de sequence:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0.01
0.02
0.03
0.04
0.05
0.060000000000000005
0.07
0.08
0.09
0.09999999999999999
0.10999999999999999
0.11999999999999998
0.12999999999999998
0.13999999999999999
0.15


/edit: dat is blijkbaar een kenmerk van Javascript, niet specifiek een NR probleem: https://www.w3schools.com/js/js_numbers.asp

[Voor 15% gewijzigd door DeadMetal op 30-03-2020 19:07]


Acties:
  • +1Henk 'm!

  • Andre_J
  • Registratie: september 2005
  • Laatst online: 07-04 22:28
DeadMetal schreef op maandag 30 maart 2020 @ 19:01:
Ik heb het toch weer teruggedraaid. Blijkbaar vind NR het moeilijk om er 0.01 bij op te tellen, onvoorstelbaar.
Als ik er een debug node achter hang, is dit de sequence:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0.01
0.02
0.03
0.04
0.05
0.060000000000000005
0.07
0.08
0.09
0.09999999999999999
0.10999999999999999
0.11999999999999998
0.12999999999999998
0.13999999999999999
0.15


/edit: dat is blijkbaar een kenmerk van Javascript, niet specifiek een NR probleem: https://www.w3schools.com/js/js_numbers.asp
Misschien zo ?
var num = 5.56789;
var n = num.toFixed(2);
Oplossen ?

Acties:
  • +1Henk 'm!
peligro2k schreef op zondag 29 maart 2020 @ 20:33:
[...]
Ja dat klopt. Ik vind het zelf ook een erg vreemde opzet, maar het is een soort DIY project.

https://translate.google....2Fmodkam.ru%2F%3Fp%3D1114


Ik probeer met een RBE functie in NR alleen de waarde uit te lezen die veranderd is, maar dit lijkt niks te doen.
Mooie uitdaging, maar het is gelukt :)

https://tweakers.net/i/5T2TsUsbuSslhwjUrkaTtYuziXA=/800x/filters:strip_exif()/f/image/ifIMpX74JxBY7hez1BZ0cv8w.png?f=fotoalbum_large

Wat ik doe: de inject-node bevat even de kopie van jouw voorbeeldbericht.
Via een split node splits ik jouw grote bericht op in 23 losse berichten (de 20 knoppen, de battery/linkquality/voltage). De 'key' (de naam van de knop) wordt in msg.topic gestopt.

Daarna een switch node om de battery/linkquality/voltage berichten af te stoppen. De rest gaat door.

Vervolgens een RBE node. Het leuke daarvan is dat die per topic (en dus per knop) filtert!
Dus per topic kijkt hij of de waarde anders is dan de vorige keer.
Enkel het bericht van de ingedrukte knop wordt doorgelaten.
Tenslotte via de grote switch node kan je per knop bepalen wat er moet gebeuren.

Let op: de allereerste keer (na het starten van NR) laat de RBE-node nog alle knoppen door, want alles is 'nieuw' voor hem. Dat is ook wel weer te voorkomen, maar kijk eerst maar of je met deze opzet verder kan.

code:
1
[{"id":"c2c4a154.ae45d","type":"inject","z":"9a51dd22.996408","name":"","topic":"","payload":"{\"btn_17\":false,\"linkquality\":111,\"battery\":38,\"voltage\":2438,\"btn_1\":false,\"btn_5\":true,\"btn_13\":true,\"btn_9\":true,\"btn_18\":true,\"btn_10\":true,\"btn_6\":true,\"btn_7\":true,\"btn_14\":true,\"btn_19\":true,\"btn_15\":true,\"btn_2\":true,\"btn_16\":true,\"btn_8\":true,\"btn_3\":true,\"btn_11\":true,\"btn_12\":true,\"btn_20\":false,\"btn_4\":true}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":260,"wires":[["7d40271f.397e4"]]},{"id":"7d40271f.397e4","type":"split","z":"9a51dd22.996408","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"topic","x":250,"y":260,"wires":[["f2d26bc2.550f5"]]},{"id":"f144cacf.dc9a88","type":"switch","z":"9a51dd22.996408","name":"Welke knop?","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"btn_1","vt":"str"},{"t":"eq","v":"btn_2","vt":"str"},{"t":"eq","v":"btn_3","vt":"str"},{"t":"eq","v":"btn_4","vt":"str"},{"t":"eq","v":"btn_5","vt":"str"},{"t":"eq","v":"btn_6","vt":"str"},{"t":"eq","v":"btn_7","vt":"str"},{"t":"eq","v":"btn_8","vt":"str"},{"t":"eq","v":"btn_9","vt":"str"},{"t":"eq","v":"btn_10","vt":"str"},{"t":"eq","v":"btn_11","vt":"str"},{"t":"eq","v":"btn_12","vt":"str"},{"t":"eq","v":"btn_13","vt":"str"},{"t":"eq","v":"btn_14","vt":"str"},{"t":"eq","v":"btn_15","vt":"str"},{"t":"eq","v":"btn_16","vt":"str"},{"t":"eq","v":"btn_17","vt":"str"},{"t":"eq","v":"btn_18","vt":"str"},{"t":"eq","v":"btn_19","vt":"str"},{"t":"eq","v":"btn_20","vt":"str"}],"checkall":"true","repair":false,"outputs":20,"x":790,"y":260,"wires":[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]},{"id":"be649a0.cc7bc68","type":"rbe","z":"9a51dd22.996408","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":610,"y":260,"wires":[["f144cacf.dc9a88","f2f649ed.38e53"]]},{"id":"f2d26bc2.550f5","type":"switch","z":"9a51dd22.996408","name":"Enkel knoppen doorlaten","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"btn_","vt":"str"}],"checkall":"false","repair":false,"outputs":1,"x":430,"y":260,"wires":[["be649a0.cc7bc68"]]},{"id":"f2f649ed.38e53","type":"debug","z":"9a51dd22.996408","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":790,"y":440,"wires":[]}]

  • peligro2k
  • Registratie: december 2001
  • Laatst online: 12:25
DeadMetal schreef op maandag 30 maart 2020 @ 19:37:
[...]


Mooie uitdaging, maar het is gelukt :)

[Afbeelding]

Wat ik doe: de inject-node bevat even de kopie van jouw voorbeeldbericht.
Via een split node splits ik jouw grote bericht op in 23 losse berichten (de 20 knoppen, de battery/linkquality/voltage). De 'key' (de naam van de knop) wordt in msg.topic gestopt.

Daarna een switch node om de battery/linkquality/voltage berichten af te stoppen. De rest gaat door.

Vervolgens een RBE node. Het leuke daarvan is dat die per topic (en dus per knop) filtert!
Dus per topic kijkt hij of de waarde anders is dan de vorige keer.
Enkel het bericht van de ingedrukte knop wordt doorgelaten.
Tenslotte via de grote switch node kan je per knop bepalen wat er moet gebeuren.

Let op: de allereerste keer (na het starten van NR) laat de RBE-node nog alle knoppen door, want alles is 'nieuw' voor hem. Dat is ook wel weer te voorkomen, maar kijk eerst maar of je met deze opzet verder kan.

code:
1
[{"id":"c2c4a154.ae45d","type":"inject","z":"9a51dd22.996408","name":"","topic":"","payload":"{\"btn_17\":false,\"linkquality\":111,\"battery\":38,\"voltage\":2438,\"btn_1\":false,\"btn_5\":true,\"btn_13\":true,\"btn_9\":true,\"btn_18\":true,\"btn_10\":true,\"btn_6\":true,\"btn_7\":true,\"btn_14\":true,\"btn_19\":true,\"btn_15\":true,\"btn_2\":true,\"btn_16\":true,\"btn_8\":true,\"btn_3\":true,\"btn_11\":true,\"btn_12\":true,\"btn_20\":false,\"btn_4\":true}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":260,"wires":[["7d40271f.397e4"]]},{"id":"7d40271f.397e4","type":"split","z":"9a51dd22.996408","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"topic","x":250,"y":260,"wires":[["f2d26bc2.550f5"]]},{"id":"f144cacf.dc9a88","type":"switch","z":"9a51dd22.996408","name":"Welke knop?","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"btn_1","vt":"str"},{"t":"eq","v":"btn_2","vt":"str"},{"t":"eq","v":"btn_3","vt":"str"},{"t":"eq","v":"btn_4","vt":"str"},{"t":"eq","v":"btn_5","vt":"str"},{"t":"eq","v":"btn_6","vt":"str"},{"t":"eq","v":"btn_7","vt":"str"},{"t":"eq","v":"btn_8","vt":"str"},{"t":"eq","v":"btn_9","vt":"str"},{"t":"eq","v":"btn_10","vt":"str"},{"t":"eq","v":"btn_11","vt":"str"},{"t":"eq","v":"btn_12","vt":"str"},{"t":"eq","v":"btn_13","vt":"str"},{"t":"eq","v":"btn_14","vt":"str"},{"t":"eq","v":"btn_15","vt":"str"},{"t":"eq","v":"btn_16","vt":"str"},{"t":"eq","v":"btn_17","vt":"str"},{"t":"eq","v":"btn_18","vt":"str"},{"t":"eq","v":"btn_19","vt":"str"},{"t":"eq","v":"btn_20","vt":"str"}],"checkall":"true","repair":false,"outputs":20,"x":790,"y":260,"wires":[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]},{"id":"be649a0.cc7bc68","type":"rbe","z":"9a51dd22.996408","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":610,"y":260,"wires":[["f144cacf.dc9a88","f2f649ed.38e53"]]},{"id":"f2d26bc2.550f5","type":"switch","z":"9a51dd22.996408","name":"Enkel knoppen doorlaten","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"btn_","vt":"str"}],"checkall":"false","repair":false,"outputs":1,"x":430,"y":260,"wires":[["be649a0.cc7bc68"]]},{"id":"f2f649ed.38e53","type":"debug","z":"9a51dd22.996408","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":790,"y":440,"wires":[]}]
Wow super nice! Ik ga het straks testen! Thanks!

  • Aegle
  • Registratie: november 2013
  • Laatst online: 08:40

Aegle

"hier" = Schiedam, ZH...

Ik doe vast iets verkeerd, maar ik krijg deze flow niet werkend.

De bedoeling is om de MQTT afkomstig van de Nefit EMS-ESP-module te uploaden naar een Influx database genaamd "cvketel". Het gaat om de Moduline300 thermostaat. Later wil ik de andere ketel parameters ook wegeschrijven, maar eerst dit maar eens aan de gang krijgen...

Het volgende MQTT topic en payload worden gepublished:
code:
1
2
Topic:          Payload:
thermostat_data {"hc1":{"seltemp":21.0,"currtemp":21.0,"mode":"auto"}}

Zo dus:
code:
1
2
3
4
5
6
7
{
    "hc1":{
        "seltemp":21.5,
        "currtemp":21.8,
        "mode":"auto"
    }
}

'seltemp' is de ingestelde temperatuur
'currtemp' is de huidige temperatuur
'auto' is de auto/handbediening.

Nu probeer ik de volgende flow aan de gang te krijgen, maar volgens mij gaat er in de json conversie iets fout. Het gaat me met name om de data naar Influx weg te schrijven.

https://tweakers.net/i/DhVpQEAFBxZrNv-UJlAeVBoODBw=/f/image/3lhaHX2XMJA7pasLZAsvGxlc.jpg
code:
1
[{"id":"77704f6c.ce8cc","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"fc346f30.01b588","type":"mqtt in","z":"77704f6c.ce8cc","name":"Thermostaat","topic":"home/ems-esp/thermostat_data","qos":"0","datatype":"json","broker":"1b944fe3.2d79c","x":150,"y":120,"wires":[["c07e719e.215ad"]]},{"id":"a5cb2177.6e883","type":"debug","z":"77704f6c.ce8cc","name":"Thermostaat","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":630,"y":100,"wires":[]},{"id":"c07e719e.215ad","type":"json","z":"77704f6c.ce8cc","name":"","property":"payload","action":"","pretty":false,"x":170,"y":220,"wires":[["9112b0c4.5c7828","df6b3307.6f0d4","b44055f.65bf0a8","a5cb2177.6e883","68831dbb.3b7c8c"]]},{"id":"df6b3307.6f0d4","type":"change","z":"77704f6c.ce8cc","name":"thermostat_currtemp","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.currtemp","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":220,"wires":[["8c002d06.b8c13"]]},{"id":"9112b0c4.5c7828","type":"change","z":"77704f6c.ce8cc","name":"thermostat_seltemp","rules":[{"t":"set","p":"payload.hc1","pt":"msg","to":"payload.seltemp","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":280,"wires":[["bc0ab2f4.4505a8"]]},{"id":"b44055f.65bf0a8","type":"change","z":"77704f6c.ce8cc","name":"thermostat_mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.thermostat_mode","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":340,"wires":[["1b96fc5e.ae5954"]]},{"id":"1b96fc5e.ae5954","type":"debug","z":"77704f6c.ce8cc","name":"mode","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":610,"y":340,"wires":[]},{"id":"bc0ab2f4.4505a8","type":"debug","z":"77704f6c.ce8cc","name":"seltemp","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":620,"y":280,"wires":[]},{"id":"8c002d06.b8c13","type":"debug","z":"77704f6c.ce8cc","name":"currtemp","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":620,"y":220,"wires":[]},{"id":"68831dbb.3b7c8c","type":"influxdb out","z":"77704f6c.ce8cc","influxdb":"f52b8f57.2b81f8","name":"","measurement":"home","precision":"","retentionPolicy":"","x":640,"y":160,"wires":[]},{"id":"1b944fe3.2d79c","type":"mqtt-broker","z":"","name":"MQTT","broker":"192.168.178.230","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"f52b8f57.2b81f8","type":"influxdb","z":"","hostname":"192.168.178.230","port":"8086","protocol":"http","database":"cvketel","name":"CV-ketel","usetls":false,"tls":"e6d9cc5.95860b"},{"id":"e6d9cc5.95860b","type":"tls-config","z":"","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","verifyservercert":false}][]}]


Kan iemand hier iets zinnigs over zeggen? of heeft iemand misschien al een een flow gemaakt voor de EMS-ESP module?

[Voor 54% gewijzigd door Aegle op 31-03-2020 15:20]

10 x Yingli YL260C-30b @ 10 x OP300 SolarEdge optimizers en SE3000 op 158º. Live: PVoutput , SolarEdge


  • sOid
  • Registratie: maart 2004
  • Niet online
@Aegle Je code klopt niet. Ik importeer er alleen een debug-node mee :+

Edit: ah, je was er al mee bezig ;)

Als ik 'm importeer krijg ik een JSON-foutmelding:
code:
1
2
3
SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 1 column 3136 of the JSON data

ert":false}][]}]





Een heel andere vraag. Ik heb een HueTap schakelaar die ik uitlees via deCONZ. Als ik op een van de buttons op de schakelaar duw, krijg ik zoiets: "buttonevent: 16". Elke button lijkt een andere cijfer te hebben.

Maar hoe kan ik dat vervolgens uitlezen? Ik heb nu een hele simpele opzet waarbij ik een change-node gebruik om "buttonevent: 16" (als string) te vertalen naar iets anders. Maar dat werkt niet. Ook niet als ik bijvoorbeeld alleen "search for number: 16" ipv string gebruik.

Iemand een suggestie?

Edit: Laat maar, heb het gevonden!

[Voor 109% gewijzigd door sOid op 31-03-2020 20:37]


  • Aegle
  • Registratie: november 2013
  • Laatst online: 08:40

Aegle

"hier" = Schiedam, ZH...

sOid schreef op dinsdag 31 maart 2020 @ 13:48:
@Aegle Je code klopt niet. Ik importeer er alleen een debug-node mee :+

Edit: ah, je was er al mee bezig ;)

Als ik 'm importeer krijg ik een JSON-foutmelding:
code:
1
2
3
SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 1 column 3136 of the JSON data

ert":false}][]}]
Apart :?. het is een rechtstreekse copy/paste vanuit NR.
Hierbij nog een keer:
code:
1
[{"id":"77704f6c.ce8cc","type":"tab","label":"Flow 4","disabled":false,"info":""},{"id":"fc346f30.01b588","type":"mqtt in","z":"77704f6c.ce8cc","name":"Thermostaat","topic":"home/ems-esp/thermostat_data","qos":"0","datatype":"json","broker":"1b944fe3.2d79c","x":150,"y":120,"wires":[["c07e719e.215ad","68831dbb.3b7c8c"]]},{"id":"a5cb2177.6e883","type":"debug","z":"77704f6c.ce8cc","name":"Thermostaat","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":630,"y":100,"wires":[]},{"id":"c07e719e.215ad","type":"json","z":"77704f6c.ce8cc","name":"","property":"payload","action":"","pretty":false,"x":170,"y":220,"wires":[["9112b0c4.5c7828","df6b3307.6f0d4","b44055f.65bf0a8","a5cb2177.6e883"]]},{"id":"df6b3307.6f0d4","type":"change","z":"77704f6c.ce8cc","name":"thermostat_currtemp","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.currtemp","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":220,"wires":[["8c002d06.b8c13"]]},{"id":"9112b0c4.5c7828","type":"change","z":"77704f6c.ce8cc","name":"thermostat_seltemp","rules":[{"t":"set","p":"payload.hc1","pt":"msg","to":"payload.seltemp","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":280,"wires":[["bc0ab2f4.4505a8"]]},{"id":"b44055f.65bf0a8","type":"change","z":"77704f6c.ce8cc","name":"thermostat_mode","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.thermostat_mode","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":370,"y":340,"wires":[["1b96fc5e.ae5954"]]},{"id":"1b96fc5e.ae5954","type":"debug","z":"77704f6c.ce8cc","name":"mode","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":610,"y":340,"wires":[]},{"id":"bc0ab2f4.4505a8","type":"debug","z":"77704f6c.ce8cc","name":"seltemp","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":620,"y":280,"wires":[]},{"id":"8c002d06.b8c13","type":"debug","z":"77704f6c.ce8cc","name":"currtemp","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":620,"y":220,"wires":[]},{"id":"68831dbb.3b7c8c","type":"influxdb out","z":"77704f6c.ce8cc","influxdb":"f52b8f57.2b81f8","name":"","measurement":"","precision":"","retentionPolicy":"","x":620,"y":160,"wires":[]},{"id":"1b944fe3.2d79c","type":"mqtt-broker","z":"","name":"MQTT","broker":"192.168.178.230","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closeQos":"0","closeRetain":"false","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"f52b8f57.2b81f8","type":"influxdb","z":"","hostname":"192.168.178.230","port":"8086","protocol":"http","database":"cvketel","name":"CV-ketel","usetls":false,"tls":"e6d9cc5.95860b"},{"id":"e6d9cc5.95860b","type":"tls-config","z":"","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","verifyservercert":false}]


Een heel andere vraag. Ik heb een HueTap schakelaar die ik uitlees via deCONZ. Als ik op een van de buttons op de schakelaar duw, krijg ik zoiets: "buttonevent: 16". Elke button lijkt een andere cijfer te hebben.

Maar hoe kan ik dat vervolgens uitlezen? Ik heb nu een hele simpele opzet waarbij ik een change-node gebruik om "buttonevent: 16" (als string) te vertalen naar iets anders. Maar dat werkt niet. Ook niet als ik bijvoorbeeld alleen "search for number: 16" ipv string gebruik.

Iemand een suggestie?
Helaas. daar kan ik je niet mee helpen...

10 x Yingli YL260C-30b @ 10 x OP300 SolarEdge optimizers en SE3000 op 158º. Live: PVoutput , SolarEdge


  • peligro2k
  • Registratie: december 2001
  • Laatst online: 12:25
DeadMetal schreef op maandag 30 maart 2020 @ 19:37:
[...]


Mooie uitdaging, maar het is gelukt :)

[Afbeelding]

Wat ik doe: de inject-node bevat even de kopie van jouw voorbeeldbericht.
Via een split node splits ik jouw grote bericht op in 23 losse berichten (de 20 knoppen, de battery/linkquality/voltage). De 'key' (de naam van de knop) wordt in msg.topic gestopt.

Daarna een switch node om de battery/linkquality/voltage berichten af te stoppen. De rest gaat door.

Vervolgens een RBE node. Het leuke daarvan is dat die per topic (en dus per knop) filtert!
Dus per topic kijkt hij of de waarde anders is dan de vorige keer.
Enkel het bericht van de ingedrukte knop wordt doorgelaten.
Tenslotte via de grote switch node kan je per knop bepalen wat er moet gebeuren.

Let op: de allereerste keer (na het starten van NR) laat de RBE-node nog alle knoppen door, want alles is 'nieuw' voor hem. Dat is ook wel weer te voorkomen, maar kijk eerst maar of je met deze opzet verder kan.

code:
1
[{"id":"c2c4a154.ae45d","type":"inject","z":"9a51dd22.996408","name":"","topic":"","payload":"{\"btn_17\":false,\"linkquality\":111,\"battery\":38,\"voltage\":2438,\"btn_1\":false,\"btn_5\":true,\"btn_13\":true,\"btn_9\":true,\"btn_18\":true,\"btn_10\":true,\"btn_6\":true,\"btn_7\":true,\"btn_14\":true,\"btn_19\":true,\"btn_15\":true,\"btn_2\":true,\"btn_16\":true,\"btn_8\":true,\"btn_3\":true,\"btn_11\":true,\"btn_12\":true,\"btn_20\":false,\"btn_4\":true}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":260,"wires":[["7d40271f.397e4"]]},{"id":"7d40271f.397e4","type":"split","z":"9a51dd22.996408","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"topic","x":250,"y":260,"wires":[["f2d26bc2.550f5"]]},{"id":"f144cacf.dc9a88","type":"switch","z":"9a51dd22.996408","name":"Welke knop?","property":"topic","propertyType":"msg","rules":[{"t":"eq","v":"btn_1","vt":"str"},{"t":"eq","v":"btn_2","vt":"str"},{"t":"eq","v":"btn_3","vt":"str"},{"t":"eq","v":"btn_4","vt":"str"},{"t":"eq","v":"btn_5","vt":"str"},{"t":"eq","v":"btn_6","vt":"str"},{"t":"eq","v":"btn_7","vt":"str"},{"t":"eq","v":"btn_8","vt":"str"},{"t":"eq","v":"btn_9","vt":"str"},{"t":"eq","v":"btn_10","vt":"str"},{"t":"eq","v":"btn_11","vt":"str"},{"t":"eq","v":"btn_12","vt":"str"},{"t":"eq","v":"btn_13","vt":"str"},{"t":"eq","v":"btn_14","vt":"str"},{"t":"eq","v":"btn_15","vt":"str"},{"t":"eq","v":"btn_16","vt":"str"},{"t":"eq","v":"btn_17","vt":"str"},{"t":"eq","v":"btn_18","vt":"str"},{"t":"eq","v":"btn_19","vt":"str"},{"t":"eq","v":"btn_20","vt":"str"}],"checkall":"true","repair":false,"outputs":20,"x":790,"y":260,"wires":[[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]]},{"id":"be649a0.cc7bc68","type":"rbe","z":"9a51dd22.996408","name":"","func":"rbe","gap":"","start":"","inout":"out","property":"payload","x":610,"y":260,"wires":[["f144cacf.dc9a88","f2f649ed.38e53"]]},{"id":"f2d26bc2.550f5","type":"switch","z":"9a51dd22.996408","name":"Enkel knoppen doorlaten","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"btn_","vt":"str"}],"checkall":"false","repair":false,"outputs":1,"x":430,"y":260,"wires":[["be649a0.cc7bc68"]]},{"id":"f2f649ed.38e53","type":"debug","z":"9a51dd22.996408","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":790,"y":440,"wires":[]}]
Het is me nog niet helemaal gelukt. Je voorbeeeld lijkt inderdaad te werken, maar als ik de MQTT input eraan koppel in NR dan splitst hij het op een andere manier op. Ik ga er nog even mee spelen zo!
peligro2k schreef op dinsdag 31 maart 2020 @ 17:42:
[...]
Het is me nog niet helemaal gelukt. Je voorbeeeld lijkt inderdaad te werken, maar als ik de MQTT input eraan koppel in NR dan splitst hij het op een andere manier op. Ik ga er nog even mee spelen zo!
De split-node in mijn voorbeeld verwacht een parsed json-object binnen te krijgen. Ik denk dat jouw MQTT-input node een string uitspuugt. Configureer bij de mqtt-input eens expliciet: output = 'a parsed JSON object'.

Acties:
  • +1Henk 'm!

  • peligro2k
  • Registratie: december 2001
  • Laatst online: 12:25
DeadMetal schreef op woensdag 1 april 2020 @ 08:54:
[...]


De split-node in mijn voorbeeld verwacht een parsed json-object binnen te krijgen. Ik denk dat jouw MQTT-input node een string uitspuugt. Configureer bij de mqtt-input eens expliciet: output = 'a parsed JSON object'.
Yes! Hij doet het! Heel cool, onwijs bedankt voor de moeite! Ik had dit met mijn Google werk niet zo kunnen uitvinden!

  • Mr_Viking
  • Registratie: september 2010
  • Laatst online: 07-04 20:26
Ik ben echt een n00bje, situatie is als volgt:

Ik wil mijn GoodWe omvormer uitlezen met een Pi. Dat is gelukt met dit script.

Alleen nu moet de data die het script uitleest nog naar een app/site. Ik dacht aan PVoutput en dan via Node-RED.

Ik heb het geïnstalleerd op m'n Pi en vond op de Git de vraag en reply hoe je de data naar PVoutput kan versturen. https://github.com/sircuri/GoodWeUSBLogger/issues/5

Alleen nu weet ik niet zo goed wat ik moet doen. Moet ik een node maken via de terminal of via de webinterface een MQTT in en dan uit doen?

Ik ben echt n00b hoor ;(

  • AUijtdehaag
  • Registratie: oktober 2006
  • Niet online
@Mr_Viking Ik zou eerst node red installeren via
https://nodered.org/docs/getting-started/raspberrypi

En dan kan je de flow importeren via het hamburgermenu
https://tweakers.net/i/eBmPz27XDSxQY8zXcGtjXmQwqbU=/800x/filters:strip_icc():strip_exif()/f/image/J33AV2vsOBlnScYSYL2QlDtN.jpg?f=fotoalbum_large

PV Output - Panasonic Hit Kuro/Solar Frontier - 5 kW Mitsubsidie


  • Mr_Viking
  • Registratie: september 2010
  • Laatst online: 07-04 20:26
@AUijtdehaag wauw thanks! ik ga 't proberen! <3

  • dfp_team
  • Registratie: april 2020
  • Laatst online: 09:10
KvNwPPr schreef op dinsdag 13 november 2018 @ 16:44:
[...]


De "handmatig ingeschakeld" node checkt of ik de Aqara wall switch heb gebruikt. JA = niks doen, NEE = licht aan/uit.
Wat bedoel je met dat de Aqara cube nog niks doet? Die zin is een beetje wazig ;). Je kan een flow.stoptimer maken voor de Cube.


[...]


Dus om dit voor elkaar te krijgen :

1. change node (https://i.imgur.com/JdaBayr.png)toevoegen aan je wall switch met deze settings: https://i.imgur.com/u8cHomA.png
2. Switch node toevoegen aan je licht flow met deze settings: https://i.imgur.com/yRqWXmK.png

Het enige wat ik zelf niet handig vind is dat je het ook weer moet "resetten". Dan is het minder geautomatiseerd. Ik krijg nu 1 uur nadat ik de lampen handmatig heb ingeschakeld een telegram bericht met de vraag of ik de normale automation weer aan wil zetten. https://imgur.com/ThqYfXI
Kan je misschien even iets meer uitleggen hoe de switch weet wanneer ik handmatig heb ingeschakeld?
je hebt hiervoor ook de all events, licht switches en click type staan, zijn deze allen van belang?
Zoja hoe moet ik deze dan instellen?

Acties:
  • 0Henk 'm!

  • dfp_team
  • Registratie: april 2020
  • Laatst online: 09:10
Ik probeer flow te maken om de verlichting in de living automatisch te schakelen van zonsondergang tot 22:00u indien er iemand thuis is, ik wil deze zo programmeren dat de verlichting niet terug ingeschakeld word op dezelfde dag wanneer ik deze handmatig uitschakel (tenzij we zijn weg geweest), wat me is gelukt met de trigger note. Nu wil ik ook dat wanneer ik handmatig de verlichting inschakel dat deze niet vanzelf uit gaat om 22:00u, is er een eenvoudige manier om dit voor elkaar te krijgen? ik heb totaal geen ervaring met programmeren en node red.
https://tweakers.net/i/ngHUDHEzwCzefXY4aSh9k4To_DE=/800x/filters:strip_icc():strip_exif()/f/image/FXyzV3jFAS5wRXuWJzbjpmdi.jpg?f=fotoalbum_large


Nu kwam ik deze post tegen van KvNwPPr, die een gelijkaardig probleem heeft opgelost van zijn bewegingssensor met een switch en change node maar ik begrijp niet hoe ik de informatie kan verkrijgen of er handmatig is ingeschakeld. Ik gebruik de fibaro dimmer 2.
https://tweakers.net/i/GysT0UuIv9T4ooxyel9mhYOg66Y=/800x/filters:strip_exif()/f/image/JgxDijSvS4dWeJF5tO9jHdw9.png?f=fotoalbum_large

Is er iemand die me wat meer uitleg kan geven of eventueel een flow kan posten?

Mvg ,
Davy

[Voor 6% gewijzigd door dfp_team op 05-04-2020 14:22. Reden: afbeelding vervangen na aanpassing flow]


Acties:
  • 0Henk 'm!

  • Dacuuu
  • Registratie: maart 2009
  • Laatst online: 13:01
dfp_team schreef op zondag 5 april 2020 @ 13:22:
Ik probeer flow te maken om de verlichting in de living automatisch te schakelen van zonsondergang tot 22:00u indien er iemand thuis is, ik wil deze zo programmeren dat de verlichting niet terug ingeschakeld word op dezelfde dag wanneer ik deze handmatig uitschakel (tenzij we zijn weg geweest), wat me is gelukt met de trigger note. Nu wil ik ook dat wanneer ik handmatig de verlichting inschakel dat deze niet vanzelf uit gaat om 22:00u, is er een eenvoudige manier om dit voor elkaar te krijgen? ik heb totaal geen ervaring met programmeren en node red.
[Afbeelding]

Nu kwam ik deze post tegen van KvNwPPr, die een gelijkaardig probleem heeft opgelost van zijn bewegingssensor met een switch en change node maar ik begrijp niet hoe ik de informatie kan verkrijgen of er handmatig is ingeschakeld. Ik gebruik de fibaro dimmer 2.

[Afbeelding]

Is er iemand die me wat meer uitleg kan geven of eventueel een flow kan posten?

Mvg ,
Davy
Buiten je echte vraag om, je kan de personen beter groeperen in Home assistant.
Zo heb ik 2 telefoons toegevoegd aan mijn groep. Dat scheelt je heel veen nodes en ongein.

group:
aanwezigheid:
name: Aanwezigheid
entities:
- device_tracker.phone1
- device_tracker.samsung_galaxy_s8


Als beide telefoons thuis zijn = groep aanwezig
Als 1 telefoon thuis is = groep aanwezig

Als beide telefoons thuis zijn = groep afwezig

Mijn Youtube reviews: https://www.youtube.com/user/BartjuhB/videos


Acties:
  • 0Henk 'm!

  • dfp_team
  • Registratie: april 2020
  • Laatst online: 09:10
Dacuuu schreef op zondag 5 april 2020 @ 13:32:
[...]


Buiten je echte vraag om, je kan de personen beter groeperen in Home assistant.
Zo heb ik 2 telefoons toegevoegd aan mijn groep. Dat scheelt je heel veen nodes en ongein.

group:
aanwezigheid:
name: Aanwezigheid
entities:
- device_tracker.phone1
- device_tracker.samsung_galaxy_s8


Als beide telefoons thuis zijn = groep aanwezig
is 1 van de 2 telefoons weg = groep afwezig
Is het ook mogelijk dat de groep afwezig is enkel als beide telefoons weg zijn?
Zoals jij het nu beschrijft zou mijn licht uit blijven indien er 1 van de 2 weg zijn.

Acties:
  • 0Henk 'm!

  • Dacuuu
  • Registratie: maart 2009
  • Laatst online: 13:01
dfp_team schreef op zondag 5 april 2020 @ 13:37:
[...]


Is het ook mogelijk dat de groep afwezig is enkel als beide telefoons weg zijn?
Zoals jij het nu beschrijft zou mijn licht uit blijven indien er 1 van de 2 weg zijn.
Sorry, ik had het fout, heb mn post ge-edit.
De groep gaat pas op afwezig als beide personen weg zijn. :)

Mijn Youtube reviews: https://www.youtube.com/user/BartjuhB/videos


Acties:
  • 0Henk 'm!

  • dfp_team
  • Registratie: april 2020
  • Laatst online: 09:10
Dacuuu schreef op zondag 5 april 2020 @ 13:40:
[...]


Sorry, ik had het fout, heb mn post ge-edit.
De groep gaat pas op afwezig als beide personen weg zijn. :)
Bedankt voor de tip, na even zoeken het aangepast gekregen.
Toch al 2 nodes weg kunnen laten nu.

https://tweakers.net/i/ngHUDHEzwCzefXY4aSh9k4To_DE=/800x/filters:strip_icc():strip_exif()/f/image/FXyzV3jFAS5wRXuWJzbjpmdi.jpg?f=fotoalbum_large

Acties:
  • 0Henk 'm!

  • Tsurany
  • Registratie: juni 2006
  • Niet online
dfp_team schreef op zondag 5 april 2020 @ 13:22:
Nu kwam ik deze post tegen van KvNwPPr, die een gelijkaardig probleem heeft opgelost van zijn bewegingssensor met een switch en change node maar ik begrijp niet hoe ik de informatie kan verkrijgen of er handmatig is ingeschakeld. Ik gebruik de fibaro dimmer 2.
[Afbeelding]

Is er iemand die me wat meer uitleg kan geven of eventueel een flow kan posten?

Mvg ,
Davy
Je weet wat de trigger is, dan kan je dus een flow context gebruiken om deze data te bewaren. Dan hoef je dus enkel te vergelijken met de flow context die door een andere node gezet is.

Acties:
  • 0Henk 'm!

  • dfp_team
  • Registratie: april 2020
  • Laatst online: 09:10
Tsurany schreef op zondag 5 april 2020 @ 15:22:
[...]

Je weet wat de trigger is, dan kan je dus een flow context gebruiken om deze data te bewaren. Dan hoef je dus enkel te vergelijken met de flow context die door een andere node gezet is.
Bedankt voor de reactie, ik ben echt een beginner op dit vlak en gebruik home assistant nog maar een dag of twee. ik heb geen flauw idee wat een flow context is en hoe deze te gebruiken. is het mogelijk om even een voorbeeld te geven aub.

Mvg,
davy

Acties:
  • 0Henk 'm!

  • Tsurany
  • Registratie: juni 2006
  • Niet online
dfp_team schreef op zondag 5 april 2020 @ 16:01:
[...]


Bedankt voor de reactie, ik ben echt een beginner op dit vlak en gebruik home assistant nog maar een dag of twee. ik heb geen flauw idee wat een flow context is en hoe deze te gebruiken. is het mogelijk om even een voorbeeld te geven aub.

Mvg,
davy
code:
1
[{"id":"7756da.c2a07928","type":"tab","label":"P1 + SMA Logging","disabled":false,"info":""},{"id":"eec48ef7.1e65a","type":"modbus-getter","z":"7756da.c2a07928","name":"Yield","showStatusActivities":true,"showErrors":true,"logIOActivities":false,"unitid":"3","dataType":"HoldingRegister","adr":"30531","quantity":"2","server":"84430495.b18c58","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":450,"y":220,"wires":[["3adbb600.567eea"],[]]},{"id":"e6de8775.8d10c8","type":"modbus-getter","z":"7756da.c2a07928","name":"DC1 - AC","showStatusActivities":true,"showErrors":true,"logIOActivities":false,"unitid":"","dataType":"HoldingRegister","adr":"30769","quantity":"16","server":"84430495.b18c58","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":467.50000381469727,"y":441.00001335144043,"wires":[["22c97d98.393f42","6301bae2.3f5074"],[]]},{"id":"2667525d.d4587e","type":"modbus-getter","z":"7756da.c2a07928","name":"Temp - DC2 - AC","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"unitid":"","dataType":"HoldingRegister","adr":"30953","quantity":"26","server":"84430495.b18c58","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":490.50000381469727,"y":320.00001335144043,"wires":[["e3742847.b7c648","b7dd203f.2d9fc"],[]]},{"id":"e3742847.b7c648","type":"function","z":"7756da.c2a07928","name":"Extract + Format SMA DC2","func":"let DCCurrent2 =    msg.payload[5] / 1000;      // 30957\nlet DCVoltage2 =    msg.payload[7] / 100;       // 30959\nlet DCPower2 =      msg.payload[9];             // 30961\n\nlet _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        measurement: \"energy\",\n\t\tfields: {\n\t\t\tcurrent: DCCurrent2,\n\t\t\tvoltage: DCVoltage2,\n\t\t\tpower: DCPower2,\n\t\t},\n\t\ttags:{\n\t\t    device: \"SMA 5.0 - MPPT A\",\n\t\t    orientation: \"West\",\n\t\t    type: \"DC\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":744.0000038146973,"y":282.00001335144043,"wires":[["97880c2a.6eb01"]]},{"id":"3adbb600.567eea","type":"function","z":"7756da.c2a07928","name":"Extract + Format SMA Yield","func":"let TotalYield = msg.payload[1] ;    // 30531\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: TotalYield,\n\t\t},\n\t\ttags:{\n\t\t    device: \"SMA 5.0 - System\",\n\t\t    direction: \"Internal Production\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":740,"y":220,"wires":[["4b398d0a.a3d4b4"]]},{"id":"290b2fe2.20b1d","type":"debug","z":"7756da.c2a07928","name":"Debug","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1848.5001773834229,"y":361.0000972747803,"wires":[]},{"id":"6301bae2.3f5074","type":"function","z":"7756da.c2a07928","name":"Extract + Format SMA DC1","func":"let DCCurrent1    = msg.payload[1] / 1000;       // 30769\nlet DCVoltage1    = msg.payload[3] / 100;        // 30771\nlet DCPower1      = msg.payload[5];              // 30773\n\nlet _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        measurement: \"energy\",\n\t\tfields: {\n\t\t\tcurrent: DCCurrent1,\n\t\t\tvoltage: DCVoltage1,\n\t\t\tpower: DCPower1, \n\t\t},\n\t\ttags:{\n\t\t    device: \"SMA 5.0 - MPPT B\",\n\t\t    orientation: \"East\",\n\t\t    type: \"DC\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":760,"y":480,"wires":[["1e17b172.7275df"]]},{"id":"8a66b781.4da878","type":"join","z":"7756da.c2a07928","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"8","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":1717.5000381469727,"y":360.0000343322754,"wires":[["290b2fe2.20b1d","af180fcb.2713"]]},{"id":"22c97d98.393f42","type":"function","z":"7756da.c2a07928","name":"Extract SMA AC","func":"let PowerTot      = msg.payload[7];              // 30775\nlet GridVoltagePhase1 = msg.payload[15] / 100;  // 30783\n\n\nlet _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n\t\t\tsma_ac_power_tot: PowerTot,\n\t\t\tsma_ac_voltage: GridVoltagePhase1,\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":760,"y":400,"wires":[["d1e04a8a.16dab8","fc0157c7.890438"]]},{"id":"b7dd203f.2d9fc","type":"function","z":"7756da.c2a07928","name":"Extract SMA AC + Temp","func":"let InternalTemperature = msg.payload[1] /10; // 30953\nlet ACCurrentL1 = msg.payload[25] / 1000;    // 30977\n\nlet _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n\t\t\tsma_temperature: InternalTemperature,\n\t\t\tsma_ac_currentL1: ACCurrentL1,\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":733.0000038146973,"y":344.00001335144043,"wires":[["d1e04a8a.16dab8"]]},{"id":"d1e04a8a.16dab8","type":"join","z":"7756da.c2a07928","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"5","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":954.5000534057617,"y":374.0000057220459,"wires":[["43b4944b.cfe70c","9c7ab38.1cb1e5"]]},{"id":"43b4944b.cfe70c","type":"function","z":"7756da.c2a07928","name":"Format SMA AC","func":"let _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        measurement: \"energy\",\n\t\tfields: {\n\t\t\tcurrent: msg.payload.sma_ac_currentL1,\n\t\t\tvoltage: msg.payload.sma_ac_voltage,\n\t\t\tpower: msg.payload.sma_ac_power_tot,\n\t\t},\n\t\ttags:{\n\t\t    device: \"SMA 5.0 - System\",\n\t\t    type: \"AC\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":1140,"y":400,"wires":[["7042bec2.84394"]]},{"id":"9c7ab38.1cb1e5","type":"function","z":"7756da.c2a07928","name":"Format SMA Temp","func":"let _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        measurement: \"temperature\",\n\t\tfields: {\n\t\t\ttemperature: msg.payload.sma_temperature,\n\t\t},\n\t\ttags:{\n\t\t    device: \"SMA 5.0 - System\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":1150,"y":340,"wires":[["7f250d9c.d6b234"]]},{"id":"af180fcb.2713","type":"influxdb batch","z":"7756da.c2a07928","influxdb":"27e18148.8340de","precision":"","retentionPolicy":"","name":"InfluxDB","x":1858.4999961853027,"y":302.0000743865967,"wires":[]},{"id":"1e17b172.7275df","type":"switch","z":"7756da.c2a07928","name":"Filter null","property":"payload.fields.power","propertyType":"msg","rules":[{"t":"neq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1340,"y":480,"wires":[["8a66b781.4da878"]]},{"id":"7f250d9c.d6b234","type":"switch","z":"7756da.c2a07928","name":"Filter null","property":"payload.fields.temperature","propertyType":"msg","rules":[{"t":"neq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1340,"y":340,"wires":[["8a66b781.4da878"]]},{"id":"7042bec2.84394","type":"switch","z":"7756da.c2a07928","name":"Filter null","property":"payload.fields.power","propertyType":"msg","rules":[{"t":"neq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1340,"y":400,"wires":[["8a66b781.4da878"]]},{"id":"97880c2a.6eb01","type":"switch","z":"7756da.c2a07928","name":"Filter null","property":"payload.fields.power","propertyType":"msg","rules":[{"t":"neq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1340,"y":280,"wires":[["8a66b781.4da878"]]},{"id":"d6aca862.f625e8","type":"function","z":"7756da.c2a07928","name":"Set totalyield filter value","func":"flow.set('totalyield_sma',msg.payload.fields.totalyield);","outputs":1,"noerr":0,"x":1590,"y":180,"wires":[[]]},{"id":"fa879f77.4baf9","type":"switch","z":"7756da.c2a07928","name":"Limit Repeating","property":"payload.fields.totalyield","propertyType":"msg","rules":[{"t":"neq","v":"totalyield_sma","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":1360,"y":220,"wires":[["d6aca862.f625e8","8a66b781.4da878"]]},{"id":"fb9defaf.71ff3","type":"inject","z":"7756da.c2a07928","name":"Reset totalyield filter","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":171.5,"y":58,"wires":[["3453826b.5f907e"]]},{"id":"3453826b.5f907e","type":"function","z":"7756da.c2a07928","name":"Reset totalyield filter value","func":"flow.set('totalyield',0);\nflow.set('gas',0);","outputs":1,"noerr":0,"x":486,"y":58,"wires":[[]]},{"id":"4b398d0a.a3d4b4","type":"switch","z":"7756da.c2a07928","name":"Filter invalid","property":"payload.fields.totalyield","propertyType":"msg","rules":[{"t":"neq","v":"65535","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":990,"y":220,"wires":[["fa879f77.4baf9"]]},{"id":"cb4f0568.7f1c48","type":"exec","z":"7756da.c2a07928","command":"smeterd","addpay":false,"append":"read-meter --serial-baudrate 115200 --show-output consumed current produced voltage --tsv","useSpawn":"false","timer":"5","oldrc":false,"name":"","x":462.99999237060547,"y":552.0000896453857,"wires":[["a5d9004b.b9b74"],[],[]]},{"id":"a5d9004b.b9b74","type":"function","z":"7756da.c2a07928","name":"Extract smeterd","func":"var payload = msg.payload\nvar clean_payload = msg.payload.trim();\n\nvar output = clean_payload.split('\\t');\n\n\nvar consumed_high = output[0];\nvar consumed_low = output[1];\nvar consumed_gas = output[2];\nvar produced_high = output[3];\nvar produced_low = output[4];\nvar current_consumption = output[5];\nvar current_production = output[6];\nvar current_voltage = output[7];\n\nlet _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        consumed_high: consumed_high,\n        consumed_low: consumed_low,\n        consumed_gas: consumed_gas,\n        produced_high: produced_high,\n        produced_low: produced_low,\n        current_consumption: current_consumption,\n        current_production: current_production,\n        current_voltage: current_voltage,\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":780,"y":740,"wires":[["572cb1c4.d6324","a21b3f99.78007","7582d8e5.0c4718","738333a1.49e76c","1bf75599.c1bb0a","fd89fd27.fb04c","322d7b8a.da34b4","87173f8d.eb97b","2775d582.eea69a","cfe0670a.b415e8","f303e6a6.68dd68"]]},{"id":"a21b3f99.78007","type":"function","z":"7756da.c2a07928","name":"Format P1 Consumption Low","func":"let consumed_low = msg.payload.consumed_low / 1000;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: consumed_low,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"Low\",\n\t\t    direction: \"Grid Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1420,"y":840,"wires":[["8a66b781.4da878"]]},{"id":"7582d8e5.0c4718","type":"function","z":"7756da.c2a07928","name":"Format P1 Consumption High","func":"let consumed_high = msg.payload.consumed_high / 1000;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: consumed_high,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"High\",\n\t\t    direction: \"Grid Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1430,"y":880,"wires":[["8a66b781.4da878"]]},{"id":"1bf75599.c1bb0a","type":"function","z":"7756da.c2a07928","name":"Format P1 Production Low","func":"let produced_high = msg.payload.produced_high / 1000;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: produced_high,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"Low\",\n\t\t    direction: \"Grid Production\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1420,"y":980,"wires":[["8a66b781.4da878"]]},{"id":"fd89fd27.fb04c","type":"function","z":"7756da.c2a07928","name":"Format P1 Production High","func":"let produced_low = msg.payload.produced_low / 1000;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: produced_low,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"High\",\n\t\t    direction: \"Grid Production\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1420,"y":1020,"wires":[["8a66b781.4da878"]]},{"id":"2775d582.eea69a","type":"function","z":"7756da.c2a07928","name":"Extract P1 Power","func":"let current_voltage = msg.payload.current_voltage\nlet current_consumption = msg.payload.current_consumption\nlet current_production = msg.payload.current_production\n\nlet _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n\t\t\tp1_ac_power_usage: Number(current_consumption),\n\t\t\tp1_ac_power_delivery: Number(current_production),\n\t\t\tp1_ac_voltage: Number(current_voltage),\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":778.0002098083496,"y":578.4999980926514,"wires":[["84a802bd.23e6d","c1c79824.373528","89ffe83e.9f1548","fc0157c7.890438"]]},{"id":"84a802bd.23e6d","type":"function","z":"7756da.c2a07928","name":"Format Grid Net Consumption","func":"let _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        measurement: \"energy\",\n\t\tfields: {\n\t\t\tvoltage: msg.payload.p1_ac_voltage,\n\t\t\tpower: msg.payload.p1_ac_power_usage - msg.payload.p1_ac_power_delivery,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    type: \"AC\",\n\t\t    direction: \"Grid Net Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":1230,"y":580,"wires":[["8a66b781.4da878"]]},{"id":"738333a1.49e76c","type":"function","z":"7756da.c2a07928","name":"Format P1 Consumption Total","func":"let consumed_high = msg.payload.consumed_high / 1000;\nlet consumed_low = msg.payload.consumed_low / 1000;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: consumed_high + consumed_low,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"Total\",\n\t\t    direction: \"Grid Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1430,"y":920,"wires":[["8a66b781.4da878"]]},{"id":"322d7b8a.da34b4","type":"function","z":"7756da.c2a07928","name":"Format P1 Production Total","func":"let produced_low = msg.payload.produced_low / 1000;\nlet produced_high = msg.payload.produced_high / 1000;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: produced_low + produced_high,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"Total\",\n\t\t    direction: \"Grid Production\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1420,"y":1060,"wires":[["8a66b781.4da878"]]},{"id":"87173f8d.eb97b","type":"function","z":"7756da.c2a07928","name":"Format P1 Net Consumption Total","func":"let consumed_low = msg.payload.consumed_low / 1000;\nlet consumed_high = msg.payload.consumed_high / 1000;\nlet produced_low = msg.payload.produced_low / 1000;\nlet produced_high = msg.payload.produced_high / 1000;\n\nlet TotalUsage = consumed_low + consumed_high;\nlet TotalDelivery = produced_low + produced_high;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: TotalUsage - TotalDelivery,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"Total\",\n\t\t    direction: \"Grid Net Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1440,"y":1200,"wires":[["8a66b781.4da878"]]},{"id":"572cb1c4.d6324","type":"function","z":"7756da.c2a07928","name":"Format P1 Gas","func":"let consumed_gas = msg.payload.consumed_gas / 1000;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"gas\",\n\t\tfields: {\n\t\t\ttotalyield: consumed_gas,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    direction: \"Grid Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1180,"y":740,"wires":[["6cb3edd2.321ea4"]]},{"id":"c1c79824.373528","type":"function","z":"7756da.c2a07928","name":"Format Grid Consumption","func":"let _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        measurement: \"energy\",\n\t\tfields: {\n\t\t\tvoltage: msg.payload.p1_ac_voltage,\n\t\t\tpower: msg.payload.p1_ac_power_usage,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    type: \"AC\",\n\t\t    direction: \"Grid Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":1210,"y":620,"wires":[["d5c9153c.0cb918"]]},{"id":"89ffe83e.9f1548","type":"function","z":"7756da.c2a07928","name":"Format Grid Production","func":"let _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        measurement: \"energy\",\n\t\tfields: {\n\t\t\tvoltage: msg.payload.p1_ac_voltage,\n\t\t\tpower: msg.payload.p1_ac_power_delivery*-1,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    type: \"AC\",\n\t\t    direction: \"Grid Production\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":1210,"y":660,"wires":[["224570fd.c5023"]]},{"id":"d5c9153c.0cb918","type":"switch","z":"7756da.c2a07928","name":"Filter null","property":"payload.fields.power","propertyType":"msg","rules":[{"t":"neq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1440,"y":620,"wires":[["8a66b781.4da878"]]},{"id":"224570fd.c5023","type":"switch","z":"7756da.c2a07928","name":"Filter null","property":"payload.fields.power","propertyType":"msg","rules":[{"t":"neq","v":"","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1440,"y":660,"wires":[["8a66b781.4da878"]]},{"id":"a854d0c0.09489","type":"function","z":"7756da.c2a07928","name":"Format Internal Consumption","func":"grid_consumption = msg.payload.p1_ac_power_usage;\ngrid_production = msg.payload.p1_ac_power_delivery;\n\ninternal_production = msg.payload.sma_ac_power_tot;\nif(internal_production == null)\n{\n    internal_production = 0;\n}\n\nnet_grid = grid_consumption - grid_production;\nnet_internal_consumption = internal_production + net_grid;\n\n\n\n\n_msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        measurement: \"energy\",\n\t\tfields: {\n\t\t\tvoltage: msg.payload.p1_ac_voltage,\n\t\t\tpower: net_internal_consumption,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    type: \"AC\",\n\t\t    direction: \"Internal Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":1220,"y":540,"wires":[["8a66b781.4da878"]]},{"id":"fc0157c7.890438","type":"join","z":"7756da.c2a07928","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"5","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1010,"y":540,"wires":[["a854d0c0.09489"]]},{"id":"efe46d48.f4459","type":"function","z":"7756da.c2a07928","name":"Create Timestamp","func":"let _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n\t\ttimestamp: new Date(),\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":190,"y":260,"wires":[["43ea38a0.da2d88"]]},{"id":"43ea38a0.da2d88","type":"change","z":"7756da.c2a07928","name":"Set Timestamp","rules":[{"t":"move","p":"payload.timestamp","pt":"msg","to":"timestamp","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":244.28905487060547,"y":320.3437786102295,"wires":[["eec48ef7.1e65a","2667525d.d4587e","e6de8775.8d10c8","cb4f0568.7f1c48"]]},{"id":"6cb3edd2.321ea4","type":"switch","z":"7756da.c2a07928","name":"Limit Repeating","property":"payload.fields.totalyield","propertyType":"msg","rules":[{"t":"neq","v":"gas","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":1420,"y":740,"wires":[["9cb9e059.073ea","8a66b781.4da878"]]},{"id":"9cb9e059.073ea","type":"function","z":"7756da.c2a07928","name":"Set totalyield filter value","func":"flow.set('gas',msg.payload.fields.totalyield);","outputs":1,"noerr":0,"x":1370,"y":780,"wires":[[]]},{"id":"1680367.9ef68ca","type":"interval","z":"7756da.c2a07928","name":"interval","interval":10,"onstart":false,"msg":"ping","showstatus":true,"unit":"seconds","statusformat":"YYYY-MM-D HH:mm:ss","x":90,"y":200,"wires":[["efe46d48.f4459"]]},{"id":"f303e6a6.68dd68","type":"function","z":"7756da.c2a07928","name":"Format P1 Net Consumption Low","func":"let consumed_low = msg.payload.consumed_low / 1000;\nlet produced_low = msg.payload.produced_low / 1000;\n\nlet TotalUsage = consumed_low;\nlet TotalDelivery = produced_low;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: TotalUsage - TotalDelivery,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"Low\",\n\t\t    direction: \"Grid Net Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1440,"y":1120,"wires":[["8a66b781.4da878"]]},{"id":"cfe0670a.b415e8","type":"function","z":"7756da.c2a07928","name":"Format P1 Net Consumption High","func":"let consumed_high = msg.payload.consumed_high / 1000;\nlet produced_high = msg.payload.produced_high / 1000;\n\nlet TotalUsage = consumed_high;\nlet TotalDelivery = produced_high;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: TotalUsage - TotalDelivery,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"High\",\n\t\t    direction: \"Grid Net Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1440,"y":1160,"wires":[["8a66b781.4da878"]]},{"id":"84430495.b18c58","type":"modbus-client","z":"","name":"SMA","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":true,"tcpHost":"10.5.0.70","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"3","commandDelay":"1","clientTimeout":"1500","reconnectTimeout":"2000"},{"id":"27e18148.8340de","type":"influxdb","z":"","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"SMA","name":"","usetls":false,"tls":"b2a3d022.4f648"},{"id":"b2a3d022.4f648","type":"tls-config","z":"","name":"local-tls","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","verifyservercert":false}]


https://tweakers.net/i/xnMHCoUe1zuhoOASalzvFHv5U2w=/800x/filters:strip_exif()/f/image/p3Zxy3oD4oL4dwWuLU1cwthC.png?f=fotoalbum_large


Let dan even op de blauw gemarkeerde stukken. Ik gebruik deze functie: flow.set('totalyield_sma',msg.payload.fields.totalyield); Dat geeft de totalyield_sma flow context de waarde van msg.payload.fields.totalyield. Vervolgens heb ik daarvoor een switch node die bij elk opvolgend bericht kijkt of de waarde ongelijk is aan de huidige waarde. Is dat zo dan gaat hij door, anders stopt hij daar. Dit voorkomt in mijn geval dat ik dubbele waarden naar mijn database weg schrijf.

Wat jij dus kan doen is een boolean flow context gebruiken die je op true zet als hij handmatig is aangezet en op false als het via automation is gedaan. Vervolgens gebruik je een switch om op die waarde te controleren.

Acties:
  • 0Henk 'm!

  • dfp_team
  • Registratie: april 2020
  • Laatst online: 09:10
Tsurany schreef op zondag 5 april 2020 @ 16:08:
[...]


code:
1
[{"id":"7756da.c2a07928","type":"tab","label":"P1 + SMA Logging","disabled":false,"info":""},{"id":"eec48ef7.1e65a","type":"modbus-getter","z":"7756da.c2a07928","name":"Yield","showStatusActivities":true,"showErrors":true,"logIOActivities":false,"unitid":"3","dataType":"HoldingRegister","adr":"30531","quantity":"2","server":"84430495.b18c58","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":450,"y":220,"wires":[["3adbb600.567eea"],[]]},{"id":"e6de8775.8d10c8","type":"modbus-getter","z":"7756da.c2a07928","name":"DC1 - AC","showStatusActivities":true,"showErrors":true,"logIOActivities":false,"unitid":"","dataType":"HoldingRegister","adr":"30769","quantity":"16","server":"84430495.b18c58","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":467.50000381469727,"y":441.00001335144043,"wires":[["22c97d98.393f42","6301bae2.3f5074"],[]]},{"id":"2667525d.d4587e","type":"modbus-getter","z":"7756da.c2a07928","name":"Temp - DC2 - AC","showStatusActivities":false,"showErrors":false,"logIOActivities":false,"unitid":"","dataType":"HoldingRegister","adr":"30953","quantity":"26","server":"84430495.b18c58","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":490.50000381469727,"y":320.00001335144043,"wires":[["e3742847.b7c648","b7dd203f.2d9fc"],[]]},{"id":"e3742847.b7c648","type":"function","z":"7756da.c2a07928","name":"Extract + Format SMA DC2","func":"let DCCurrent2 =    msg.payload[5] / 1000;      // 30957\nlet DCVoltage2 =    msg.payload[7] / 100;       // 30959\nlet DCPower2 =      msg.payload[9];             // 30961\n\nlet _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        measurement: \"energy\",\n\t\tfields: {\n\t\t\tcurrent: DCCurrent2,\n\t\t\tvoltage: DCVoltage2,\n\t\t\tpower: DCPower2,\n\t\t},\n\t\ttags:{\n\t\t    device: \"SMA 5.0 - MPPT A\",\n\t\t    orientation: \"West\",\n\t\t    type: \"DC\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":744.0000038146973,"y":282.00001335144043,"wires":[["97880c2a.6eb01"]]},{"id":"3adbb600.567eea","type":"function","z":"7756da.c2a07928","name":"Extract + Format SMA Yield","func":"let TotalYield = msg.payload[1] ;    // 30531\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: TotalYield,\n\t\t},\n\t\ttags:{\n\t\t    device: \"SMA 5.0 - System\",\n\t\t    direction: \"Internal Production\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":740,"y":220,"wires":[["4b398d0a.a3d4b4"]]},{"id":"290b2fe2.20b1d","type":"debug","z":"7756da.c2a07928","name":"Debug","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1848.5001773834229,"y":361.0000972747803,"wires":[]},{"id":"6301bae2.3f5074","type":"function","z":"7756da.c2a07928","name":"Extract + Format SMA DC1","func":"let DCCurrent1    = msg.payload[1] / 1000;       // 30769\nlet DCVoltage1    = msg.payload[3] / 100;        // 30771\nlet DCPower1      = msg.payload[5];              // 30773\n\nlet _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        measurement: \"energy\",\n\t\tfields: {\n\t\t\tcurrent: DCCurrent1,\n\t\t\tvoltage: DCVoltage1,\n\t\t\tpower: DCPower1, \n\t\t},\n\t\ttags:{\n\t\t    device: \"SMA 5.0 - MPPT B\",\n\t\t    orientation: \"East\",\n\t\t    type: \"DC\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":760,"y":480,"wires":[["1e17b172.7275df"]]},{"id":"8a66b781.4da878","type":"join","z":"7756da.c2a07928","name":"","mode":"custom","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"8","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":1717.5000381469727,"y":360.0000343322754,"wires":[["290b2fe2.20b1d","af180fcb.2713"]]},{"id":"22c97d98.393f42","type":"function","z":"7756da.c2a07928","name":"Extract SMA AC","func":"let PowerTot      = msg.payload[7];              // 30775\nlet GridVoltagePhase1 = msg.payload[15] / 100;  // 30783\n\n\nlet _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n\t\t\tsma_ac_power_tot: PowerTot,\n\t\t\tsma_ac_voltage: GridVoltagePhase1,\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":760,"y":400,"wires":[["d1e04a8a.16dab8","fc0157c7.890438"]]},{"id":"b7dd203f.2d9fc","type":"function","z":"7756da.c2a07928","name":"Extract SMA AC + Temp","func":"let InternalTemperature = msg.payload[1] /10; // 30953\nlet ACCurrentL1 = msg.payload[25] / 1000;    // 30977\n\nlet _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n\t\t\tsma_temperature: InternalTemperature,\n\t\t\tsma_ac_currentL1: ACCurrentL1,\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":733.0000038146973,"y":344.00001335144043,"wires":[["d1e04a8a.16dab8"]]},{"id":"d1e04a8a.16dab8","type":"join","z":"7756da.c2a07928","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"5","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":954.5000534057617,"y":374.0000057220459,"wires":[["43b4944b.cfe70c","9c7ab38.1cb1e5"]]},{"id":"43b4944b.cfe70c","type":"function","z":"7756da.c2a07928","name":"Format SMA AC","func":"let _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        measurement: \"energy\",\n\t\tfields: {\n\t\t\tcurrent: msg.payload.sma_ac_currentL1,\n\t\t\tvoltage: msg.payload.sma_ac_voltage,\n\t\t\tpower: msg.payload.sma_ac_power_tot,\n\t\t},\n\t\ttags:{\n\t\t    device: \"SMA 5.0 - System\",\n\t\t    type: \"AC\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":1140,"y":400,"wires":[["7042bec2.84394"]]},{"id":"9c7ab38.1cb1e5","type":"function","z":"7756da.c2a07928","name":"Format SMA Temp","func":"let _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        measurement: \"temperature\",\n\t\tfields: {\n\t\t\ttemperature: msg.payload.sma_temperature,\n\t\t},\n\t\ttags:{\n\t\t    device: \"SMA 5.0 - System\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":1150,"y":340,"wires":[["7f250d9c.d6b234"]]},{"id":"af180fcb.2713","type":"influxdb batch","z":"7756da.c2a07928","influxdb":"27e18148.8340de","precision":"","retentionPolicy":"","name":"InfluxDB","x":1858.4999961853027,"y":302.0000743865967,"wires":[]},{"id":"1e17b172.7275df","type":"switch","z":"7756da.c2a07928","name":"Filter null","property":"payload.fields.power","propertyType":"msg","rules":[{"t":"neq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1340,"y":480,"wires":[["8a66b781.4da878"]]},{"id":"7f250d9c.d6b234","type":"switch","z":"7756da.c2a07928","name":"Filter null","property":"payload.fields.temperature","propertyType":"msg","rules":[{"t":"neq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1340,"y":340,"wires":[["8a66b781.4da878"]]},{"id":"7042bec2.84394","type":"switch","z":"7756da.c2a07928","name":"Filter null","property":"payload.fields.power","propertyType":"msg","rules":[{"t":"neq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1340,"y":400,"wires":[["8a66b781.4da878"]]},{"id":"97880c2a.6eb01","type":"switch","z":"7756da.c2a07928","name":"Filter null","property":"payload.fields.power","propertyType":"msg","rules":[{"t":"neq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1340,"y":280,"wires":[["8a66b781.4da878"]]},{"id":"d6aca862.f625e8","type":"function","z":"7756da.c2a07928","name":"Set totalyield filter value","func":"flow.set('totalyield_sma',msg.payload.fields.totalyield);","outputs":1,"noerr":0,"x":1590,"y":180,"wires":[[]]},{"id":"fa879f77.4baf9","type":"switch","z":"7756da.c2a07928","name":"Limit Repeating","property":"payload.fields.totalyield","propertyType":"msg","rules":[{"t":"neq","v":"totalyield_sma","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":1360,"y":220,"wires":[["d6aca862.f625e8","8a66b781.4da878"]]},{"id":"fb9defaf.71ff3","type":"inject","z":"7756da.c2a07928","name":"Reset totalyield filter","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":171.5,"y":58,"wires":[["3453826b.5f907e"]]},{"id":"3453826b.5f907e","type":"function","z":"7756da.c2a07928","name":"Reset totalyield filter value","func":"flow.set('totalyield',0);\nflow.set('gas',0);","outputs":1,"noerr":0,"x":486,"y":58,"wires":[[]]},{"id":"4b398d0a.a3d4b4","type":"switch","z":"7756da.c2a07928","name":"Filter invalid","property":"payload.fields.totalyield","propertyType":"msg","rules":[{"t":"neq","v":"65535","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":990,"y":220,"wires":[["fa879f77.4baf9"]]},{"id":"cb4f0568.7f1c48","type":"exec","z":"7756da.c2a07928","command":"smeterd","addpay":false,"append":"read-meter --serial-baudrate 115200 --show-output consumed current produced voltage --tsv","useSpawn":"false","timer":"5","oldrc":false,"name":"","x":462.99999237060547,"y":552.0000896453857,"wires":[["a5d9004b.b9b74"],[],[]]},{"id":"a5d9004b.b9b74","type":"function","z":"7756da.c2a07928","name":"Extract smeterd","func":"var payload = msg.payload\nvar clean_payload = msg.payload.trim();\n\nvar output = clean_payload.split('\\t');\n\n\nvar consumed_high = output[0];\nvar consumed_low = output[1];\nvar consumed_gas = output[2];\nvar produced_high = output[3];\nvar produced_low = output[4];\nvar current_consumption = output[5];\nvar current_production = output[6];\nvar current_voltage = output[7];\n\nlet _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        consumed_high: consumed_high,\n        consumed_low: consumed_low,\n        consumed_gas: consumed_gas,\n        produced_high: produced_high,\n        produced_low: produced_low,\n        current_consumption: current_consumption,\n        current_production: current_production,\n        current_voltage: current_voltage,\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":780,"y":740,"wires":[["572cb1c4.d6324","a21b3f99.78007","7582d8e5.0c4718","738333a1.49e76c","1bf75599.c1bb0a","fd89fd27.fb04c","322d7b8a.da34b4","87173f8d.eb97b","2775d582.eea69a","cfe0670a.b415e8","f303e6a6.68dd68"]]},{"id":"a21b3f99.78007","type":"function","z":"7756da.c2a07928","name":"Format P1 Consumption Low","func":"let consumed_low = msg.payload.consumed_low / 1000;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: consumed_low,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"Low\",\n\t\t    direction: \"Grid Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1420,"y":840,"wires":[["8a66b781.4da878"]]},{"id":"7582d8e5.0c4718","type":"function","z":"7756da.c2a07928","name":"Format P1 Consumption High","func":"let consumed_high = msg.payload.consumed_high / 1000;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: consumed_high,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"High\",\n\t\t    direction: \"Grid Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1430,"y":880,"wires":[["8a66b781.4da878"]]},{"id":"1bf75599.c1bb0a","type":"function","z":"7756da.c2a07928","name":"Format P1 Production Low","func":"let produced_high = msg.payload.produced_high / 1000;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: produced_high,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"Low\",\n\t\t    direction: \"Grid Production\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1420,"y":980,"wires":[["8a66b781.4da878"]]},{"id":"fd89fd27.fb04c","type":"function","z":"7756da.c2a07928","name":"Format P1 Production High","func":"let produced_low = msg.payload.produced_low / 1000;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: produced_low,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"High\",\n\t\t    direction: \"Grid Production\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1420,"y":1020,"wires":[["8a66b781.4da878"]]},{"id":"2775d582.eea69a","type":"function","z":"7756da.c2a07928","name":"Extract P1 Power","func":"let current_voltage = msg.payload.current_voltage\nlet current_consumption = msg.payload.current_consumption\nlet current_production = msg.payload.current_production\n\nlet _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n\t\t\tp1_ac_power_usage: Number(current_consumption),\n\t\t\tp1_ac_power_delivery: Number(current_production),\n\t\t\tp1_ac_voltage: Number(current_voltage),\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":778.0002098083496,"y":578.4999980926514,"wires":[["84a802bd.23e6d","c1c79824.373528","89ffe83e.9f1548","fc0157c7.890438"]]},{"id":"84a802bd.23e6d","type":"function","z":"7756da.c2a07928","name":"Format Grid Net Consumption","func":"let _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        measurement: \"energy\",\n\t\tfields: {\n\t\t\tvoltage: msg.payload.p1_ac_voltage,\n\t\t\tpower: msg.payload.p1_ac_power_usage - msg.payload.p1_ac_power_delivery,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    type: \"AC\",\n\t\t    direction: \"Grid Net Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":1230,"y":580,"wires":[["8a66b781.4da878"]]},{"id":"738333a1.49e76c","type":"function","z":"7756da.c2a07928","name":"Format P1 Consumption Total","func":"let consumed_high = msg.payload.consumed_high / 1000;\nlet consumed_low = msg.payload.consumed_low / 1000;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: consumed_high + consumed_low,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"Total\",\n\t\t    direction: \"Grid Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1430,"y":920,"wires":[["8a66b781.4da878"]]},{"id":"322d7b8a.da34b4","type":"function","z":"7756da.c2a07928","name":"Format P1 Production Total","func":"let produced_low = msg.payload.produced_low / 1000;\nlet produced_high = msg.payload.produced_high / 1000;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: produced_low + produced_high,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"Total\",\n\t\t    direction: \"Grid Production\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1420,"y":1060,"wires":[["8a66b781.4da878"]]},{"id":"87173f8d.eb97b","type":"function","z":"7756da.c2a07928","name":"Format P1 Net Consumption Total","func":"let consumed_low = msg.payload.consumed_low / 1000;\nlet consumed_high = msg.payload.consumed_high / 1000;\nlet produced_low = msg.payload.produced_low / 1000;\nlet produced_high = msg.payload.produced_high / 1000;\n\nlet TotalUsage = consumed_low + consumed_high;\nlet TotalDelivery = produced_low + produced_high;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: TotalUsage - TotalDelivery,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"Total\",\n\t\t    direction: \"Grid Net Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1440,"y":1200,"wires":[["8a66b781.4da878"]]},{"id":"572cb1c4.d6324","type":"function","z":"7756da.c2a07928","name":"Format P1 Gas","func":"let consumed_gas = msg.payload.consumed_gas / 1000;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"gas\",\n\t\tfields: {\n\t\t\ttotalyield: consumed_gas,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    direction: \"Grid Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1180,"y":740,"wires":[["6cb3edd2.321ea4"]]},{"id":"c1c79824.373528","type":"function","z":"7756da.c2a07928","name":"Format Grid Consumption","func":"let _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        measurement: \"energy\",\n\t\tfields: {\n\t\t\tvoltage: msg.payload.p1_ac_voltage,\n\t\t\tpower: msg.payload.p1_ac_power_usage,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    type: \"AC\",\n\t\t    direction: \"Grid Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":1210,"y":620,"wires":[["d5c9153c.0cb918"]]},{"id":"89ffe83e.9f1548","type":"function","z":"7756da.c2a07928","name":"Format Grid Production","func":"let _msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        measurement: \"energy\",\n\t\tfields: {\n\t\t\tvoltage: msg.payload.p1_ac_voltage,\n\t\t\tpower: msg.payload.p1_ac_power_delivery*-1,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    type: \"AC\",\n\t\t    direction: \"Grid Production\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":1210,"y":660,"wires":[["224570fd.c5023"]]},{"id":"d5c9153c.0cb918","type":"switch","z":"7756da.c2a07928","name":"Filter null","property":"payload.fields.power","propertyType":"msg","rules":[{"t":"neq","v":"0","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1440,"y":620,"wires":[["8a66b781.4da878"]]},{"id":"224570fd.c5023","type":"switch","z":"7756da.c2a07928","name":"Filter null","property":"payload.fields.power","propertyType":"msg","rules":[{"t":"neq","v":"","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1440,"y":660,"wires":[["8a66b781.4da878"]]},{"id":"a854d0c0.09489","type":"function","z":"7756da.c2a07928","name":"Format Internal Consumption","func":"grid_consumption = msg.payload.p1_ac_power_usage;\ngrid_production = msg.payload.p1_ac_power_delivery;\n\ninternal_production = msg.payload.sma_ac_power_tot;\nif(internal_production == null)\n{\n    internal_production = 0;\n}\n\nnet_grid = grid_consumption - grid_production;\nnet_internal_consumption = internal_production + net_grid;\n\n\n\n\n_msg = {\n    payload: []\n};\n\n_msg.payload=\n    {\n        measurement: \"energy\",\n\t\tfields: {\n\t\t\tvoltage: msg.payload.p1_ac_voltage,\n\t\t\tpower: net_internal_consumption,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    type: \"AC\",\n\t\t    direction: \"Internal Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\nreturn _msg;","outputs":1,"noerr":0,"x":1220,"y":540,"wires":[["8a66b781.4da878"]]},{"id":"fc0157c7.890438","type":"join","z":"7756da.c2a07928","name":"","mode":"custom","build":"merged","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"5","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1010,"y":540,"wires":[["a854d0c0.09489"]]},{"id":"efe46d48.f4459","type":"function","z":"7756da.c2a07928","name":"Create Timestamp","func":"let _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n\t\ttimestamp: new Date(),\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":190,"y":260,"wires":[["43ea38a0.da2d88"]]},{"id":"43ea38a0.da2d88","type":"change","z":"7756da.c2a07928","name":"Set Timestamp","rules":[{"t":"move","p":"payload.timestamp","pt":"msg","to":"timestamp","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":244.28905487060547,"y":320.3437786102295,"wires":[["eec48ef7.1e65a","2667525d.d4587e","e6de8775.8d10c8","cb4f0568.7f1c48"]]},{"id":"6cb3edd2.321ea4","type":"switch","z":"7756da.c2a07928","name":"Limit Repeating","property":"payload.fields.totalyield","propertyType":"msg","rules":[{"t":"neq","v":"gas","vt":"flow"}],"checkall":"true","repair":false,"outputs":1,"x":1420,"y":740,"wires":[["9cb9e059.073ea","8a66b781.4da878"]]},{"id":"9cb9e059.073ea","type":"function","z":"7756da.c2a07928","name":"Set totalyield filter value","func":"flow.set('gas',msg.payload.fields.totalyield);","outputs":1,"noerr":0,"x":1370,"y":780,"wires":[[]]},{"id":"1680367.9ef68ca","type":"interval","z":"7756da.c2a07928","name":"interval","interval":10,"onstart":false,"msg":"ping","showstatus":true,"unit":"seconds","statusformat":"YYYY-MM-D HH:mm:ss","x":90,"y":200,"wires":[["efe46d48.f4459"]]},{"id":"f303e6a6.68dd68","type":"function","z":"7756da.c2a07928","name":"Format P1 Net Consumption Low","func":"let consumed_low = msg.payload.consumed_low / 1000;\nlet produced_low = msg.payload.produced_low / 1000;\n\nlet TotalUsage = consumed_low;\nlet TotalDelivery = produced_low;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: TotalUsage - TotalDelivery,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"Low\",\n\t\t    direction: \"Grid Net Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1440,"y":1120,"wires":[["8a66b781.4da878"]]},{"id":"cfe0670a.b415e8","type":"function","z":"7756da.c2a07928","name":"Format P1 Net Consumption High","func":"let consumed_high = msg.payload.consumed_high / 1000;\nlet produced_high = msg.payload.produced_high / 1000;\n\nlet TotalUsage = consumed_high;\nlet TotalDelivery = produced_high;\nlet _msg = {\n    payload:[]\n};\n\n_msg.payload=\n    {\n        measurement: \"yield\",\n\t\tfields: {\n\t\t\ttotalyield: TotalUsage - TotalDelivery,\n\t\t},\n\t\ttags:{\n\t\t    device: \"P1\",\n\t\t    rate: \"High\",\n\t\t    direction: \"Grid Net Consumption\",\n\t\t},\n\t\ttimestamp: flow.get('timestamp')\n\t}\n\n\nreturn _msg;","outputs":1,"noerr":0,"x":1440,"y":1160,"wires":[["8a66b781.4da878"]]},{"id":"84430495.b18c58","type":"modbus-client","z":"","name":"SMA","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":true,"tcpHost":"10.5.0.70","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","unit_id":"3","commandDelay":"1","clientTimeout":"1500","reconnectTimeout":"2000"},{"id":"27e18148.8340de","type":"influxdb","z":"","hostname":"127.0.0.1","port":"8086","protocol":"http","database":"SMA","name":"","usetls":false,"tls":"b2a3d022.4f648"},{"id":"b2a3d022.4f648","type":"tls-config","z":"","name":"local-tls","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"","verifyservercert":false}]


[Afbeelding]


Let dan even op de blauw gemarkeerde stukken. Ik gebruik deze functie: flow.set('totalyield_sma',msg.payload.fields.totalyield); Dat geeft de totalyield_sma flow context de waarde van msg.payload.fields.totalyield. Vervolgens heb ik daarvoor een switch node die bij elk opvolgend bericht kijkt of de waarde ongelijk is aan de huidige waarde. Is dat zo dan gaat hij door, anders stopt hij daar. Dit voorkomt in mijn geval dat ik dubbele waarden naar mijn database weg schrijf.

Wat jij dus kan doen is een boolean flow context gebruiken die je op true zet als hij handmatig is aangezet en op false als het via automation is gedaan. Vervolgens gebruik je een switch om op die waarde te controleren.
Ik ben aan het proberen geweest om te werken met flow context, maar begrijp niet goed hoe jij deze gebruikt. Heb op youtube net een video gevonden met voorbeelden en uitleg en heb deze nu wat nagemaakt. Ik ben nu zo ver dat mijn trigger node een true boolean zend naar de change node wardoor deze weet dat er automatisch is ingeschakeld. Ik vind echter niet waar ik vandaan kan halen of er handmatig is ingeschakeld, met een input node die de false zendt ipv de schakelaar werkt de flow zoals ik zou willen. Waar moet ik juist op zoek naar de schakelaar?
https://tweakers.net/i/_AsB1pLjFOjZuB95YHsgDkdb5Hw=/800x/filters:strip_icc():strip_exif()/f/image/yiX9nL82OBJFlTFMKqvrjCYF.jpg?f=fotoalbum_large

code:
1
[{"id":"c06f437a.0ecf38","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"5db126cc.05c118","type":"api-call-service","z":"c06f437a.0ecf38","name":"doe licht aan","server":"108395f9.caaaca","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.fibaro_system_fgd212_dimmer_2_level_2","data":"{\"entity_id\":\"light.fibaro_system_fgd212_dimmer_2_level_2\",\"brightness_pct\":20}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1510,"y":300,"wires":[[]]},{"id":"2c7fa6a0.77d79a","type":"api-call-service","z":"c06f437a.0ecf38","name":"doe licht uit","server":"108395f9.caaaca","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.fibaro_system_fgd212_dimmer_2_level_2","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1510,"y":520,"wires":[[]]},{"id":"67c74677.e08fe","type":"switch","z":"c06f437a.0ecf38","name":"thuis of afwezig","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":440,"y":360,"wires":[["c8bdd196.8a9278"],["5abe2be.0a056d4"]]},{"id":"c8bdd196.8a9278","type":"time-range-switch","z":"c06f437a.0ecf38","name":"sunset - 22:00","lat":"71.025","lon":"2.41","startTime":"05:00","endTime":"04:00","startOffset":0,"endOffset":0,"x":600,"y":200,"wires":[["a1f107d7.087148"],[]]},{"id":"a1f107d7.087148","type":"api-current-state","z":"c06f437a.0ecf38","name":"is het licht al aan?","server":"108395f9.caaaca","version":1,"outputs":2,"halt_if":"true","halt_if_type":"msg","halt_if_compare":"is","override_topic":false,"entity_id":"light.fibaro_system_fgd212_dimmer_2_level_2","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":930,"y":200,"wires":[[],["f4405c67.50fb38"]]},{"id":"5abe2be.0a056d4","type":"api-current-state","z":"c06f437a.0ecf38","name":"is er nog iemand thuis?","server":"108395f9.caaaca","version":1,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"group.aanwezigheid","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":630,"y":520,"wires":[["77b8d0c7.c77de8","cfbff668.dc3178"],[]]},{"id":"77b8d0c7.c77de8","type":"api-current-state","z":"c06f437a.0ecf38","name":"is het licht al uit?","server":"108395f9.caaaca","version":1,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.fibaro_system_fgd212_dimmer_2_level_2","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1080,"y":520,"wires":[[],["56f67262.6feeac"]]},{"id":"1168585b.b27518","type":"poll-state","z":"c06f437a.0ecf38","name":"is er iemand thuis?","server":"108395f9.caaaca","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"updateinterval":"1","updateIntervalUnits":"seconds","outputinitially":false,"outputonchanged":false,"entity_id":"group.aanwezigheid","state_type":"str","halt_if":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"x":170,"y":360,"wires":[["67c74677.e08fe"]]},{"id":"f4405c67.50fb38","type":"trigger","z":"c06f437a.0ecf38","op1":"true","op2":"0","op1type":"bool","op2type":"str","duration":"0","extend":false,"units":"ms","reset":"reset","bytopic":"all","name":"zendt true en wachten op reset","x":1210,"y":300,"wires":[["5db126cc.05c118","712a5f18.97b1c8"]]},{"id":"cfbff668.dc3178","type":"change","z":"c06f437a.0ecf38","name":"reset indien niemand thuis","rules":[{"t":"change","p":"payload","pt":"msg","from":"off","fromt":"str","to":"reset","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":400,"wires":[["f4405c67.50fb38"]]},{"id":"6b5fc49.ef0ec3c","type":"inject","z":"c06f437a.0ecf38","name":"reset om 03:00","topic":"","payload":"reset","payloadType":"str","repeat":"","crontab":"00 03 * * *","once":false,"onceDelay":0.1,"x":900,"y":300,"wires":[["f4405c67.50fb38"]]},{"id":"368bab4.9b5a7d4","type":"inject","z":"c06f437a.0ecf38","name":"Licht uit om 22:00","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"00 22 * * *","once":false,"onceDelay":0.1,"x":630,"y":680,"wires":[["77b8d0c7.c77de8"]]},{"id":"712a5f18.97b1c8","type":"change","z":"c06f437a.0ecf38","name":"auto af hand aan?","rules":[{"t":"set","p":"auto","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1510,"y":140,"wires":[[]]},{"id":"56f67262.6feeac","type":"switch","z":"c06f437a.0ecf38","name":"true of false?","property":"auto","propertyType":"flow","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":1310,"y":520,"wires":[["2c7fa6a0.77d79a"],[]]},{"id":"e7c81116.10751","type":"inject","z":"c06f437a.0ecf38","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1230,"y":120,"wires":[["712a5f18.97b1c8"]]},{"id":"108395f9.caaaca","type":"server","z":"","name":"Home Assistant","addon":true}]
Pagina: 1 ... 8 9 10 Laatste


Apple iPhone 11 Microsoft Xbox Series X LG OLED C9 Google Pixel 4 CES 2020 Samsung Galaxy S20 4G Sony PlayStation 5 Nintendo Switch Lite

'14 '15 '16 '17 2018

Tweakers vormt samen met Hardware Info, AutoTrack, Gaspedaal.nl, Nationale Vacaturebank, Intermediair en Independer DPG Online Services B.V.
Alle rechten voorbehouden © 1998 - 2020 Hosting door True