Gå til innhold
  • Bli medlem
Støtt hjemmeautomasjon.no!

Flow eksempler


henlagt

Anbefalte innlegg

Flow for å dimme opp/ned lyset over tid. Noden som er brukt for å loope heter "node-red-contrib-looptimer" og den støtter stop-melding, noen som kan være kjekt om du ønsker mange loop eller loop over lang tidsperiode.

 

Denne flow'en trigges manuelt og er kun laget som eksempel.

image.thumb.png.19bad9a5c7fbb007c8ec59a5aee18805.png

 

[{"id":"dbcadc41.af56f","type":"inject","z":"c73cf615.f18078","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"on","payloadType":"str","x":150,"y":1580,"wires":[["8a89756b.e4c8e8","2e1c83c6.594f0c"]]},{"id":"f535a633.460a28","type":"api-call-service","z":"c73cf615.f18078","name":"Brightness opp 2","server":"ac20270b.4d8de8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.wled_lampe","data":"{\"brightness\": data.attributes.brightness + 2}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":670,"y":1560,"wires":[[]]},{"id":"73397c27.5837e4","type":"api-current-state","z":"c73cf615.f18078","name":"Hent lysnivå","server":"ac20270b.4d8de8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.wled_lampe","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":490,"y":1560,"wires":[["f535a633.460a28"]]},{"id":"de189e5b.269e8","type":"api-current-state","z":"c73cf615.f18078","name":"Hent lysnivå","server":"ac20270b.4d8de8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.lys_stue","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":490,"y":1620,"wires":[["86cdf1a3.41c84"]]},{"id":"86cdf1a3.41c84","type":"api-call-service","z":"c73cf615.f18078","name":"Brightness opp 2","server":"ac20270b.4d8de8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lys_stue","data":"{\"brightness\": data.attributes.brightness + 2}","dataType":"jsonata","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":670,"y":1620,"wires":[[]]},{"id":"8a89756b.e4c8e8","type":"looptimer","z":"c73cf615.f18078","duration":"5","units":"Second","maxloops":"100","maxtimeout":"1","maxtimeoutunits":"Hour","name":"","x":320,"y":1560,"wires":[["73397c27.5837e4"],[]]},{"id":"2e1c83c6.594f0c","type":"looptimer","z":"c73cf615.f18078","duration":"5","units":"Second","maxloops":"100","maxtimeout":"1","maxtimeoutunits":"Hour","name":"","x":320,"y":1620,"wires":[["de189e5b.269e8"],[]]},{"id":"ac20270b.4d8de8","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

 

Endret av henlagt
Lenke til kommentar
Del på andre sider

  • 1 måned senere...

Laget en super enkel flow i dag, før gjorde HA denne jobben, men om man sletter en integrasjon midlertidig i HA, så fu*** man også opp alle automasjonene da entitien forsvinner.

Så derfor flytter jeg absolutt alle automasjonene ut i Node-Red og benytter MQTT så ofte jeg kan/orker.. 

 

Ringeklokken har tilkoblet en Sage doorbell enhet.

Når noen ringer på, så publiserer Sage en action: 'on'

"Switch" blir derfor trigget om msg.payload.action == on.

 

Videre er det en template med payload som sendes videre til nettbrettet.

Payloaden her består av { "speak": "Ding-Dong,  det ringer på døren!" }.

Nettbrettet kjører WallPanel med MQTT og publiserer til topicen "wallpanel/nettbrett/command"

 

Resultatet er at når noen ringer på, så sier nettbrettet "Ding-Dong,  det ringer på døren!"

 

 

Spoiler

image.png.2d668cce4ea8d8aa159edf762c8e9941.png

 

  • Like 1
Lenke til kommentar
Del på andre sider

  • 3 uker senere...

Har gjort den smarte roborocken et par hakk smartere, ble jækla lei av at den starter opp når man er hjemme pga feks en rød dag eller noe annet uforutsett.

Flowen til venstre starter støvsugeren man-fre 1200 om ingen er hjemme.

"svc: counter-increment" øker en teller for når den må tømmes.

 

Flowen til høyre sjekker telleren hver andre time, om den blir 7 eller mer, så vil roborocken automatisk gå til søppelbøtta og telleren blir resatt til 0.

Den skal også kun gå til søppelbøtta om ingen er tilstedet.

image.thumb.png.732943b39024269e558b19e575e763b6.png

 

  • Like 1
Lenke til kommentar
Del på andre sider

Dagens flow er skrevet, gjenstår enda litt test men tror den skal fungere som tiltenkt om funksjonen jeg skrev virker som tiltenkt..

Sende varsel til mobilen min kvelden før, eller på morgenen om det tid for og trille søppelboksen ned til veien 🙂

 

image.thumb.png.db283761f997d5fa015eb05137dc5af5.png

  • Like 1
Lenke til kommentar
Del på andre sider

Flow for renovasjon, de som benytter appen "Min renovasjon" kan benytte denne.

Søk opp adressen din på hjemmesidene til renovasjonssiden, i HTML-koden finner man app-keyen, gatekode, kommune nr osv..

 

Her finner man også gatekode, kommunenr osv: https://ws.geonorge.no/adresser/v1/sok?sok=Gatenavn Husnr 12

 

[{"id":"19a61e2a.75f152","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"7268b8b9.eb7ae","type":"inject","z":"19a61e2a.75f152","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 12 * * *","once":false,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":130,"y":120,"wires":[["72257540.a12fbc"]]},{"id":"c70310c4.a7eb78","type":"http request","z":"19a61e2a.75f152","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://komteksky.norkart.no/komtek.renovasjonwebapi/api/tommekalender/?gatenavn=GATENAVN&gatekode=GATEKODE&husnr=HUSNR","tls":"","persist":false,"proxy":"","authType":"","x":150,"y":280,"wires":[["6ddd6b7b.e15cf4"]]},{"id":"72257540.a12fbc","type":"change","z":"19a61e2a.75f152","name":"","rules":[{"t":"set","p":"headers","pt":"msg","to":"{\"Kommunenr\":\"KOMMUENR\",\"RenovasjonAppKey\":\"APPKEY\",\"OS\":\"Android\",\"Connection\":\"Keep-Alive\",\"Accept-Encoding\":\"gzip\",\"User-Agent\":\"okhttp/3.2.0\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":150,"y":220,"wires":[["c70310c4.a7eb78"]]},{"id":"3f136545.bf33ca","type":"api-call-service","z":"19a61e2a.75f152","name":"","server":"ed1ce5cc.927bb8","version":1,"debugenabled":true,"service_domain":"input_datetime","service":"set_datetime","entityId":"input_datetime.matavfall","data":"{\"datetime\": tommedato }","dataType":"jsonata","mergecontext":"","output_location":"payload","output_location_type":"msg","mustacheAltTags":false,"x":180,"y":400,"wires":[[]]},{"id":"6ddd6b7b.e15cf4","type":"change","z":"19a61e2a.75f152","name":"","rules":[{"t":"set","p":"tommedato","pt":"msg","to":"payload[0].Tommedatoer[0]","tot":"msg"},{"t":"set","p":"tommedato2","pt":"msg","to":"payload[0].Tommedatoer[1]","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":160,"y":340,"wires":[["3f136545.bf33ca"]]},{"id":"933ca3bc.8010f8","type":"comment","z":"19a61e2a.75f152","name":"Henter data fra min_renovasjon","info":"","x":170,"y":60,"wires":[]},{"id":"456b8e1f.d725d8","type":"inject","z":"19a61e2a.75f152","name":"Man - Fre 07:30","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"30 07 * * 1,2,3,4,5","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":470,"y":140,"wires":[["736a1536.f05b44"]]},{"id":"736a1536.f05b44","type":"api-current-state","z":"19a61e2a.75f152","name":"","server":"ed1ce5cc.927bb8","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_datetime.matavfall","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":510,"y":240,"wires":[["f08da0ae.8c6bd","5f7a2b73.ee12ec"]]},{"id":"3955f9d6.8f2f26","type":"switch","z":"19a61e2a.75f152","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"idag","vt":"str"},{"t":"eq","v":"imorgen","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":430,"y":440,"wires":[["8aac29ce.304d1"],["45aa2ee.529a2d"]]},{"id":"319b0046.3d0ff","type":"function","z":"19a61e2a.75f152","name":"Utregning","func":"var PickupDate = new Date (flow.get(\"PickupDate\"));\nvar date = new Date();\nvar Tomming;\nvar DiffTime\nvar DiffDays\n\n//Regner ut differansen, og gjør det om til antall dager.\nDiffTime = date.getTime() - PickupDate.getTime();\nDiffDays = DiffTime / (1000 * 3600 * 24);\n\n//Gjør datoene om til formatet år/mnd/dag 00:00\ndate = (date.getFullYear() + '-' + ('00' + (date.getMonth()+1)).slice(-2) + '-' + ('00' + date.getDate()).slice(-2) + ' ' + ('00') + ':' + ('00') + ':' + ('00'));\nPickupDate = (PickupDate.getFullYear() + '-' + ('00' + (PickupDate.getMonth()+1)).slice(-2) + '-' + ('00' + PickupDate.getDate()).slice(-2) + ' ' + ('00') + ':' + ('00') + ':' + ('00'));\n\n\nif (PickupDate == date) {\n    Tomming = \"idag\";\n}\nelse if ((DiffDays > 1) && (DiffDays < 2)) {\n    Tomming = \"imorgen\";\n}\nelse Tomming = false;\n\nmsg.payload = Tomming\n\nreturn msg","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":360,"wires":[["3955f9d6.8f2f26"]]},{"id":"c5522a8d.1bf24","type":"inject","z":"19a61e2a.75f152","name":"Man - Fre 22:30","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"30 22 * * 1,2,3,4,5","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":470,"y":180,"wires":[["736a1536.f05b44"]]},{"id":"f08da0ae.8c6bd","type":"function","z":"19a61e2a.75f152","name":"Setter hentedato","func":"flow.set(\"PickupDate\", msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":790,"y":240,"wires":[[]]},{"id":"8aac29ce.304d1","type":"api-call-service","z":"19a61e2a.75f152","name":"Søppeltømming idag","server":"ed1ce5cc.927bb8","version":1,"debugenabled":false,"service_domain":"notify","service":"","entityId":"","data":"{\"message\":\"Det er søppeltømming idag\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":680,"y":400,"wires":[[]]},{"id":"45aa2ee.529a2d","type":"api-call-service","z":"19a61e2a.75f152","name":"Søppeltømming imorgen","server":"ed1ce5cc.927bb8","version":1,"debugenabled":false,"service_domain":"notify","service":"","entityId":"","data":"{\"message\":\"Det er søppeltømming imorgen\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":690,"y":480,"wires":[[]]},{"id":"5f7a2b73.ee12ec","type":"api-current-state","z":"19a61e2a.75f152","name":"Is home","server":"ed1ce5cc.927bb8","version":1,"outputs":2,"halt_if":"home","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":440,"y":300,"wires":[["319b0046.3d0ff"],[]]},{"id":"e3cbf0de.ddb918","type":"comment","z":"19a61e2a.75f152","name":"Sender varsel til mobiltelefon","info":"","x":480,"y":60,"wires":[]},{"id":"ed1ce5cc.927bb8","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

 

image.thumb.png.3ff2c2915b363be390f58d4367006264.png

Endret av slippern
Lenke til kommentar
Del på andre sider


Samsung TV-en min kobler ikke bluetooth høyttaleren automatisk til, men det dukker opp en dialogboks på TV-en ved oppstart som spør om man vil koble høyttaleren til.

Flowen sjekker om TV-en har blitt slått på, 15 sekunders delay, det er ca den tiden det tar etter at TV-en og dialogboksen dukker opp.

En ny sjekk sjekker at TV-en nå faktisk er på, i tilfelle at noen slo den på også av igjen like fort.

Så sender HA dette til TV-en; {"media_content_type":"send_key","media_content_id":"KEY_ENTER"}, det tilsvarer et "OK" trykk på fjernkontrollen, og høyttaleren kobles til.

I samme slengen skrues også Apple TV-en på.. 🙂

 

Skulle helst ha fått til at den også leser i loggboken om hvem/hva som skrudde på TV-en, slik at om man gjør det via fjernkontrollen, så trigges ikke dette. Men ser ikke ut som dette er mulig per dags dato.

image.thumb.png.e3ebe654d977b30dd2b5f94ed7191fbb.png

Lenke til kommentar
Del på andre sider

  • 1 måned senere...

Har smartifisert ringeklokken med en Aeotec Door/Window Sensor 7 da denne har mulighet for og koble på en bryter.

Den "analoge" ding-dongen og trafoen er utkoblet, da Aeotecen ville lidd en rask død om man kjørt på med AC-spenning inn på den.

 

Flowen er ganske rett fram, men måtte begrense hvor mange meldinger som skal sendes da Aeotecen også blir trigget når man slipper ringe-knappen.

Ellers sender den melding til et nettbrett i stua som roper ut "Ding-Dong, det ringer på døren!"... Om jeg ikke er hjemme får jeg en notifikasjon på mobilen.

image.thumb.png.ac7d8e24136ece1b4d6edfc2ceda56f5.png

Lenke til kommentar
Del på andre sider

  • 2 uker senere...

Etter ønske om å få rask oversikt i Home Assistant over nye korona-smittede i vår kommune fikk jeg satt opp en flyt i Node-RED som henter og bruker data fra https://www.covid19data.no/ / https://github.com/thohan88/covid19-nor-data (Credits til nevnte). 

Kode for flyt om noen er interessert: 

[{"id":"7dd6bce.af8c844","type":"group","z":"bb6e8086.6c545","name":"Covidsensor ","style":{"stroke":"#ff0000","fill":"#ff0000","fill-opacity":"0.15","label":true},"nodes":["90eed3d2.3e261","b0fff39.6d0931","ea569ee3.85a95","b802a2b2.ff655","6a4e5870.ca4be8","c7c59bd.5518268","ef5ccb12.ee96b8","b081c8a7.91d578","386b5ad0.348216","cb51e487.ab1338","ab0d46b0.c3f558","810385c3.3d2c58","b0f32536.4af398","5f09b0de.93084"],"x":74,"y":1639,"w":1752,"h":202},{"id":"90eed3d2.3e261","type":"csv","z":"bb6e8086.6c545","g":"7dd6bce.af8c844","name":"","sep":",","hdrin":true,"hdrout":"none","multi":"mult","ret":"\\n","temp":"date,date_time,kommune_bydel_no,kommune_bydel_name,bydel_no,bydel_name,kommune_no,kommune_name,fylke_no,fylke_name,population,cases","skip":"0","strings":true,"include_empty_strings":false,"include_null_values":false,"x":550,"y":1680,"wires":[["cb51e487.ab1338"]]},{"id":"b0fff39.6d0931","type":"http request","z":"bb6e8086.6c545","g":"7dd6bce.af8c844","name":"Datainnhenting","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://raw.githubusercontent.com/thohan88/covid19-nor-data/master/data/01_infected/msis/municipality_and_district.csv","tls":"","persist":false,"proxy":"","authType":"","x":380,"y":1680,"wires":[["90eed3d2.3e261"]]},{"id":"ea569ee3.85a95","type":"function","z":"bb6e8086.6c545","g":"7dd6bce.af8c844","name":"Caseoutput","func":"let cases = msg.payload.pop().cases;\nmsg.payload = cases;\nmsg.topic = \"Dag0\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1110,"y":1680,"wires":[["ab0d46b0.c3f558","810385c3.3d2c58"]]},{"id":"b802a2b2.ff655","type":"function","z":"bb6e8086.6c545","g":"7dd6bce.af8c844","name":"Datofilter -1","func":"\nvar yesterday = new Date((new Date()).valueOf() - 1000*60*60*24).toISOString();\nu = yesterday.substr(0,10);\nmsg.payload = msg.payload.filter(e => e.date == u);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":1740,"wires":[["ef5ccb12.ee96b8"]]},{"id":"6a4e5870.ca4be8","type":"function","z":"bb6e8086.6c545","g":"7dd6bce.af8c844","name":"Datofilter -2","func":"\nvar yesterday = new Date((new Date()).valueOf() - 1000*60*60*48).toISOString();\nu = yesterday.substr(0,10);\nmsg.payload = msg.payload.filter(e => e.date == u);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":910,"y":1800,"wires":[["b081c8a7.91d578"]]},{"id":"c7c59bd.5518268","type":"function","z":"bb6e8086.6c545","g":"7dd6bce.af8c844","name":"Datofilter idag","func":"var t=(new Date()).toISOString();\n//var yyyy=(new Date()).getUTCFullYear();\n//var mm=(new Date()).getUTCMonth();\n//var dd=(new Date()).getUTCDate();\nvar u = t.substr(0,10);\nmsg.payload = msg.payload.filter(e => e.date == u);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":920,"y":1680,"wires":[["ea569ee3.85a95"]]},{"id":"ef5ccb12.ee96b8","type":"function","z":"bb6e8086.6c545","g":"7dd6bce.af8c844","name":"Caseoutput","func":"let cases = msg.payload.pop().cases;\nmsg.payload = cases;\nmsg.topic = \"Dag1\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1110,"y":1740,"wires":[["ab0d46b0.c3f558","810385c3.3d2c58"]]},{"id":"b081c8a7.91d578","type":"function","z":"bb6e8086.6c545","g":"7dd6bce.af8c844","name":"Caseoutput","func":"let cases = msg.payload.pop().cases;\nmsg.payload = cases;\nmsg.topic = \"Dag2\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1110,"y":1800,"wires":[["ab0d46b0.c3f558"]]},{"id":"386b5ad0.348216","type":"function","z":"bb6e8086.6c545","g":"7dd6bce.af8c844","name":"Økning siste døgn","func":"var a = (msg.payload.Dag0);\nvar b = (msg.payload.Dag1);\nvar siste = a - b;\nmsg.payload = siste;\nmsg.topic = \"Diff\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1530,"y":1680,"wires":[["ab0d46b0.c3f558"]]},{"id":"cb51e487.ab1338","type":"function","z":"bb6e8086.6c545","g":"7dd6bce.af8c844","name":"Kommunefilter","func":"msg.payload = msg.payload.filter(e => e.kommune_name == \"Trondheim\");\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":720,"y":1680,"wires":[["c7c59bd.5518268","b802a2b2.ff655","6a4e5870.ca4be8"]]},{"id":"ab0d46b0.c3f558","type":"join","z":"bb6e8086.6c545","g":"7dd6bce.af8c844","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"4","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":1550,"y":1800,"wires":[["b0f32536.4af398"]]},{"id":"810385c3.3d2c58","type":"join","z":"bb6e8086.6c545","g":"7dd6bce.af8c844","name":"","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":1330,"y":1680,"wires":[["386b5ad0.348216"]]},{"id":"b0f32536.4af398","type":"ha-entity","z":"bb6e8086.6c545","d":true,"g":"7dd6bce.af8c844","name":"Covidsensor","server":"6ba97421.43379c","version":1,"debugenabled":false,"outputs":1,"entityType":"sensor","config":[{"property":"name","value":"smitte_sted"},{"property":"device_class","value":""},{"property":"icon","value":"mdi:hospital-building"},{"property":"unit_of_measurement","value":"nye smittede"}],"state":"payload.Diff","stateType":"msg","attributes":[{"property":"Dagens smittetall","value":"payload.Dag0","valueType":"msg"},{"property":"Smittetall dag 1","value":"payload.Dag1","valueType":"msg"},{"property":"Smittetall dag 2","value":"payload.Dag2","valueType":"msg"},{"property":"Datakilde","value":"https://raw.githubusercontent.com/thohan88/covid19-nor-data/master/data/01_infected/msis/municipality_and_district.csv","valueType":"str"}],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","outputOnStateChange":false,"outputPayload":"$entity().state ? \"on\": \"off\"","outputPayloadType":"jsonata","x":1730,"y":1800,"wires":[[]]},{"id":"5f09b0de.93084","type":"inject","z":"bb6e8086.6c545","g":"7dd6bce.af8c844","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"45 05 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":190,"y":1680,"wires":[["b0fff39.6d0931"]]},{"id":"6ba97421.43379c","type":"server","name":"Home Assistant","version":1,"legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

 

OBS! Funksjon i funksjonsnode "kommunefilter" må endres med navn på kommune det ønskes data fra i kode, og sensor til HA må etableres etter ønske.

 

Oppsettet over etablerer en sensor i HA som viser nye smittede siste døgn samt det akkumulerte antallet smittede som er registrert de siste 3 dagene.

 

Flyten kunne helt sikkert vært bedre, men til å være en bygg-mann er jeg fornøyd med resultatet :) 

flyt.png

  • Like 2
Lenke til kommentar
Del på andre sider

  • 3 måneder senere...

 

henlagt skrev (På 3.12.2020 den 12.36):

Oppdatert versjon 🙂

 

image.thumb.png.090814ad4318487a5515c3ba342bead3.png

 


[{"id":"8df51809.834bf8","type":"tab","label":"Do","disabled":false,"info":""},{"id":"b7f54c85.d6ff","type":"time-range-switch","z":"8df51809.834bf8","name":"Tid = Morgenlys","lat":"","lon":"","startTime":"04:00","endTime":"07:30","startOffset":0,"endOffset":0,"x":1000,"y":100,"wires":[["9f9a8fa8.2a143"],["f580ce3c.8e034"]]},{"id":"263e8cc4.4e41b4","type":"change","z":"8df51809.834bf8","name":"Send stop to timer","rules":[{"t":"set","p":"payload","pt":"msg","to":"stop","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":870,"y":340,"wires":[["4f6e7d61.187c84","42f99041.a5957","2c7f01c5.d1483e","77713445.407e8c"]]},{"id":"59a50991.835d68","type":"server-state-changed","z":"8df51809.834bf8","name":"Motion changed to = on","server":"ac20270b.4d8de8","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"binary_sensor.motionsensor_do","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":320,"y":160,"wires":[["3712c8ee.ab6208"],["4a8517b.ff755e8"]]},{"id":"cef25b82.07e338","type":"server-state-changed","z":"8df51809.834bf8","name":"Manuell change to = on","server":"ac20270b.4d8de8","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_boolean.manuell_do","entityidfiltertype":"exact","outputinitially":true,"state_type":"str","haltifstate":"on","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"x":220,"y":260,"wires":[["263e8cc4.4e41b4"],["759ad7f.a917628"]]},{"id":"759ad7f.a917628","type":"api-current-state","z":"8df51809.834bf8","name":"Motion = on","server":"ac20270b.4d8de8","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"binary_sensor.motionsensor_do","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":470,"y":300,"wires":[["d2be6cb0.8aa88"],["6d0ee25f.ae05bc"]]},{"id":"3712c8ee.ab6208","type":"api-current-state","z":"8df51809.834bf8","name":"Manuell = off","server":"ac20270b.4d8de8","version":1,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_boolean.manuell_do","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":550,"y":140,"wires":[["263e8cc4.4e41b4","d2be6cb0.8aa88"],[]]},{"id":"4a8517b.ff755e8","type":"api-current-state","z":"8df51809.834bf8","name":"Manuell = off","server":"ac20270b.4d8de8","version":1,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_boolean.manuell_do","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":550,"y":189,"wires":[["2de39bf8.bdb664"],[]]},{"id":"d2be6cb0.8aa88","type":"api-current-state","z":"8df51809.834bf8","name":"Nattlys = off","server":"ac20270b.4d8de8","version":1,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_boolean.scene_nattlys","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":810,"y":140,"wires":[["b7f54c85.d6ff"],["49f45adb.35ff04"]]},{"id":"2de39bf8.bdb664","type":"api-current-state","z":"8df51809.834bf8","name":"Nattlys = off","server":"ac20270b.4d8de8","version":1,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"input_boolean.scene_nattlys","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":810,"y":200,"wires":[["a22383a7.08742"],["2c7f01c5.d1483e","77713445.407e8c"]]},{"id":"4f6e7d61.187c84","type":"stoptimer","z":"8df51809.834bf8","duration":"5","units":"Minute","payloadtype":"num","payloadval":"0","name":"","x":1240,"y":300,"wires":[["99bfd66f.91ce28"],[]]},{"id":"42f99041.a5957","type":"stoptimer","z":"8df51809.834bf8","duration":"10","units":"Minute","payloadtype":"num","payloadval":"0","name":"","x":1240,"y":360,"wires":[["43054cb1.e3ae64"],[]]},{"id":"8cf81503.5305d8","type":"api-call-service","z":"8df51809.834bf8","name":"Set lys Do 75%","server":"ac20270b.4d8de8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lys_do","data":"{\"brightness_pct\":75,\"transition\":3}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1520,"y":109,"wires":[[]]},{"id":"2c7f01c5.d1483e","type":"stoptimer","z":"8df51809.834bf8","duration":"1","units":"Minute","payloadtype":"num","payloadval":"0","name":"","x":1240,"y":420,"wires":[["ed2f0ad9.e1a8f8"],[]]},{"id":"867f9a4e.6b3de8","type":"api-call-service","z":"8df51809.834bf8","name":"Set lys Do 35%","server":"ac20270b.4d8de8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lys_do","data":"{\"brightness_pct\":35,\"transition\":4}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1520,"y":40,"wires":[[]]},{"id":"f7096aba.1c3eb8","type":"api-call-service","z":"8df51809.834bf8","name":"Set lys Do 20%","server":"ac20270b.4d8de8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lys_do","data":"{\"brightness_pct\":20,\"transition\":4}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1540,"y":180,"wires":[[]]},{"id":"a22383a7.08742","type":"time-range-switch","z":"8df51809.834bf8","name":"Tid = Morgenlys","lat":"","lon":"","startTime":"04:00","endTime":"07:30","startOffset":0,"endOffset":0,"x":1020,"y":200,"wires":[["2c7f01c5.d1483e","77713445.407e8c"],["4f6e7d61.187c84","42f99041.a5957"]]},{"id":"77713445.407e8c","type":"stoptimer","z":"8df51809.834bf8","duration":"2","units":"Minute","payloadtype":"num","payloadval":"0","name":"","x":1240,"y":480,"wires":[["f6b91247.e0e51"],[]]},{"id":"f6b91247.e0e51","type":"api-call-service","z":"8df51809.834bf8","name":"Turn off lys Do","server":"ac20270b.4d8de8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.lys_do","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1440,"y":480,"wires":[[]]},{"id":"ed2f0ad9.e1a8f8","type":"api-call-service","z":"8df51809.834bf8","name":"Set lys Do 2%","server":"ac20270b.4d8de8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lys_do","data":"{\"brightness_pct\":2,\"transition\":10}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1440,"y":420,"wires":[[]]},{"id":"43054cb1.e3ae64","type":"api-call-service","z":"8df51809.834bf8","name":"Turn off lys Do","server":"ac20270b.4d8de8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_off","entityId":"light.lys_do","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1440,"y":360,"wires":[[]]},{"id":"99bfd66f.91ce28","type":"api-call-service","z":"8df51809.834bf8","name":"Set lys Do 5%","server":"ac20270b.4d8de8","version":1,"debugenabled":false,"service_domain":"light","service":"turn_on","entityId":"light.lys_do","data":"{\"brightness_pct\":5,\"transition\":10}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1440,"y":300,"wires":[[]]},{"id":"a5d88682.cbd918","type":"comment","z":"8df51809.834bf8","name":"Do","info":"","x":290,"y":100,"wires":[]},{"id":"6d0ee25f.ae05bc","type":"api-current-state","z":"8df51809.834bf8","name":"Lys på?","server":"ac20270b.4d8de8","version":1,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.lys_do","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":660,"y":300,"wires":[["2de39bf8.bdb664"],[]]},{"id":"9f9a8fa8.2a143","type":"api-current-state","z":"8df51809.834bf8","name":"Lys av?","server":"ac20270b.4d8de8","version":1,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.lys_do","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1220,"y":60,"wires":[["867f9a4e.6b3de8"],["cb92530f.c8b22"]]},{"id":"cb92530f.c8b22","type":"switch","z":"8df51809.834bf8","name":"Ikke 35%","property":"data.attributes.brightness","propertyType":"msg","rules":[{"t":"neq","v":"35","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1360,"y":73,"wires":[["867f9a4e.6b3de8"]]},{"id":"f580ce3c.8e034","type":"api-current-state","z":"8df51809.834bf8","name":"Lys av?","server":"ac20270b.4d8de8","version":1,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.lys_do","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1220,"y":109,"wires":[["8cf81503.5305d8"],["60821e56.a5464"]]},{"id":"60821e56.a5464","type":"switch","z":"8df51809.834bf8","name":"Ikke 75%","property":"data.attributes.brightness","propertyType":"msg","rules":[{"t":"neq","v":"75","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1360,"y":129,"wires":[["8cf81503.5305d8"]]},{"id":"49f45adb.35ff04","type":"api-current-state","z":"8df51809.834bf8","name":"Lys av?","server":"ac20270b.4d8de8","version":1,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"light.lys_do","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":1220,"y":168,"wires":[["f7096aba.1c3eb8"],["df9854c4.b5dcc8"]]},{"id":"df9854c4.b5dcc8","type":"switch","z":"8df51809.834bf8","name":"Ikke 20%","property":"data.attributes.brightness","propertyType":"msg","rules":[{"t":"neq","v":"20","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":1380,"y":200,"wires":[["f7096aba.1c3eb8"]]},{"id":"ac20270b.4d8de8","type":"server","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

 

Rimelig ny på Node-Red selv, og prøver få til til bevegelsesaktivert lys.

Det jeg prøver på er ved bruk av to sensorer, light.tak og sensor.bevegelse.

Dette vil jeg gjøre:

- Hvis bevegelse når lys er av: Slå på lys, og ha det på frem til bevegelse ikke har vært i 5 min

- Hvis bevegelse og lys er på: Ikke gjør noe, men ikke skru av etter 5 min.

 

Enkelt fortalt vil jeg at bevegelsessensor-automasjonen kun skal slå på/av dersom lyset i utgangspunktet ikke var på. Slik jeg skjønner opplegget ditt bruker du en egen input_boolean fra home-assistant for å oppnå dette, men er det mulig uten? Jeg ser for meg en virtuell input_boolean bryter i Node-Red, men har ikke funnet noe.

stigvi skrev (På 21.3.2021 den 19.22):

Bare nevner det - Automasjoner kan du slå av midlertidig til du får lagt tilbake integrasjonen og når den legges tilbake er det lurt å passe på at entiteter får samme navn som de hadde før.

Kan til og med få en automasjon til å slå av og på andre automasjoner etter kriterier ;) for dem som gidder så klart.

Lenke til kommentar
Del på andre sider

Da har jeg laget en automasjon som:

- Kun kjører hvis lyset ikke var på i utgangspunktet. (Slår dermed ikke av lyset etter manglende bevegelse)

- Slår seg av 5+ min etter siste bevegelse.

- Det innenfor rød strek er bare ekstra special case for meg da lyset i gangen trenger flere "off" meldinger for å registreres off i Home-Assistant.

 

Funker fint. Noen som mener noe burde vært gjort annerledes?

Entities brukt:

Bevegelse: binary_sensor.zigbee_36_occupancy
Status holder: input_boolean.zwave_25_trigged_by_motion
Lampe: light.zwave_25_dimmer
 

image.thumb.png.969175a79b707f4458f6c9e83685cccb.png

Lenke til kommentar
Del på andre sider

Ser de fleste av dere som bruker NodeRed bruker det sammen med HA. Det gjør ikke jeg, og derfor må jeg kanskje lage noe dere har allerede i HA. Aldri brukt HA, så vet ikke hva som finnes der. Jeg lager hele smarthuset mitt i NodeRed.

Uansett, så har jeg laget mine egne funksjoner som kanskje andre har bruk for. Det er bare enkle oppgaver, som jeg har samlet i en subflow for enkelhets skyld.

Jeg har flere, og deler kanskje senere...

Alle er veldig simple, og krever ingen andre enn standard nodene som følger med. Jeg bare liker å ha enkelt funksjon i en node. Blir litt ryddigere...

 

Interval - En slags timer som sender TRUE og FALSE annenhver gang, og der du setter hvor lang tid det skal gå mellom hver sending. Egen tid for på-tid og av-tid.

Tenkte å bruke denne for å skru av og på varmekabler i noen vannrør under bakken. De trenger liksom ikke stå på kontinuerlig. Får se hvor lenge releet funker da...

[{"id":"d35448c7f2f887cf","type":"subflow","name":"Interval","info":"Number in node settings is seconds.\n\nInputs expects boolean in msg.payload.\nmsg.payload = TRUE: Immidiately sends TRUE to the output. After OnTime seconds, FALSE is sent to output. TRUE is again sent after OffTime seconds. This repeats.\n\nmsg.payload = FALSE: Immidiatly sends FALSE to the output, resets the interval timer.","category":"","in":[{"x":60,"y":80,"wires":[{"id":"de221c39069801f6"}]}],"out":[{"x":900,"y":200,"wires":[{"id":"192e433ef027253f","port":0},{"id":"192e433ef027253f","port":1},{"id":"5a7758da64dd7022","port":0}]}],"env":[{"name":"OnTime","type":"num","value":"10"},{"name":"OffTime","type":"num","value":"10"}],"meta":{},"color":"#D8BFD8","inputLabels":["Bool start/stop signal"],"outputLabels":["Bool output"],"icon":"node-red-contrib-bigtimer/timer.png"},{"id":"a986685eec7783e8","type":"delay","z":"d35448c7f2f887cf","name":"","pauseType":"delay","timeout":"${OffTime}","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"x":650,"y":160,"wires":[["192e433ef027253f"]]},{"id":"192e433ef027253f","type":"trigger","z":"d35448c7f2f887cf","name":"","op1":"true","op2":"false","op1type":"bool","op2type":"bool","duration":"${OnTime}","extend":false,"overrideDelay":false,"units":"s","reset":"","bytopic":"all","topic":"topic","outputs":2,"x":620,"y":80,"wires":[[],["a986685eec7783e8"]]},{"id":"93b45e6dba16bffd","type":"change","z":"d35448c7f2f887cf","name":"","rules":[{"t":"set","p":"reset","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":120,"wires":[["192e433ef027253f","a986685eec7783e8"]]},{"id":"de221c39069801f6","type":"switch","z":"d35448c7f2f887cf","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":190,"y":80,"wires":[["192e433ef027253f"],["93b45e6dba16bffd","5a7758da64dd7022"]]},{"id":"5a7758da64dd7022","type":"change","z":"d35448c7f2f887cf","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":200,"wires":[[]]},{"id":"0e84960fd063f349","type":"subflow:d35448c7f2f887cf","z":"bab04e18.f68f9","name":"","env":[],"x":320,"y":2760,"wires":[["14b2cb9a2ac36f4c"]]}]

 

Payload multiplier - Send hva som helst inn som msg.payload. Velg hvor mange kopier du vil ha ut, og hvor lang tid mellom.

Lagde en "fjernkontroll" dashboard for TV'en. Hvis man skal endre lyden, så tar det så mange trykk hvis man må trykke + volume mange ganger, så lagde en +5 volum knapp, som sender samme msg.payload x antall ganger. Så ett trykk sender mange trykk liksom...

[{"id":"310dc46f.ecb86c","type":"subflow","name":"Payload mulitplier","info":"Send whatever in msg.payload into this node.\nSet how many msg.payload you want out, and at what rate.\nWatch as the glorious msg.payloads appear at the output.\n\nHint: Usefull for changing volume a set steps at a push of a button.","category":"","in":[{"x":60,"y":80,"wires":[{"id":"9223d1e3.b0479"}]}],"out":[{"x":620,"y":80,"wires":[{"id":"2f6e0124.d782fe","port":0}]}],"env":[{"name":"Multiplier","type":"num","value":"2"},{"name":"Rate","type":"num","value":"2"}],"meta":{},"color":"#DDAA99","inputLabels":["msg.payload you want multiplied"],"outputLabels":["Output at correct rate"]},{"id":"2f6e0124.d782fe","type":"delay","z":"310dc46f.ecb86c","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"${Rate}","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":470,"y":80,"wires":[[]]},{"id":"9223d1e3.b0479","type":"function","z":"310dc46f.ecb86c","name":"","func":"var i = 0;\nvar counter = env.get(\"Multiplier\");\nvar temp = [];\nvar variable = msg.payload;\n\nfor (i=0; i<counter; i++) {\n    temp.push(variable)\n}\n\nmsg.payload = temp;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":200,"y":80,"wires":[["37d9a9c6.82d4b6"]]},{"id":"37d9a9c6.82d4b6","type":"split","z":"310dc46f.ecb86c","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":330,"y":80,"wires":[["2f6e0124.d782fe"]]},{"id":"e70a14acf6f8ab00","type":"subflow:310dc46f.ecb86c","z":"bab04e18.f68f9","name":"","env":[],"x":260,"y":2640,"wires":[[]]}]

 

  • Like 1
Lenke til kommentar
Del på andre sider

  • 3 måneder senere...
On 18/09/2021 at 14:33, Evelen said:

Da har jeg laget en automasjon som:

- Kun kjører hvis lyset ikke var på i utgangspunktet. (Slår dermed ikke av lyset etter manglende bevegelse)

- Slår seg av 5+ min etter siste bevegelse.

- Det innenfor rød strek er bare ekstra special case for meg da lyset i gangen trenger flere "off" meldinger for å registreres off i Home-Assistant.

 

Funker fint. Noen som mener noe burde vært gjort annerledes?

Entities brukt:

Bevegelse: binary_sensor.zigbee_36_occupancy
Status holder: input_boolean.zwave_25_trigged_by_motion
Lampe: light.zwave_25_dimmer
 

image.thumb.png.969175a79b707f4458f6c9e83685cccb.png

 

Ser helt fint ut, men du ønsker kanskje å kunne resette timeren? Hvordan fungerer det i praksis?

Og trenger du trigge timeren når bevegelse går til on, holder det ikke at den trigges ved bevegelse off?

Endret av henlagt
Lenke til kommentar
Del på andre sider

Har nå fått sansen for Google Nest Hub som dashboard og "kontroller" til huset, spesielt Sonos.

Har laget eget dashboard og Sonos kontroller da knappene i standard media-spillerne i HA ofte blir litt små på et sånt panel.


Fronten på Nest huben:

IMG_0531.thumb.jpeg.411a5bc36aff2013a4f6f442a6aec961.jpeg

 

Sonos-kontroll:

IMG_0588.thumb.jpeg.837432da184a25e0cb5cfdad15264797.jpeg

 

NodeRed flow, inkludert sub flow, for sonos kontrolleren:

image.thumb.png.460fcace22b4559970b953d0edfffae0.png

 

image.thumb.png.64d7f40ef8e4132c14921f4ec1dc41c6.png

 

NodeRed flow for cast til Nest Hub. Mesteparten her er @Sune sin kode, og han jobber med en oppdatert litt ryddigere versjon med sub flow, som skal være enklere å kopiere. Denne resetter også visning tilbake til startskjermen hvis sonos kontrolleren er brukt og det ikke har vært aktivitet på 1 minutt:

image.thumb.png.e523eb565b34ef050c2435c5f2a07558.png

 

Endret av henlagt
Lenke til kommentar
Del på andre sider

  • 7 måneder senere...

Jeg driver å fikler med en automasjon som skal gjøre følgende. Når boolean går til "on", alle varmekabler blir skrudd ned med 5 grader i 15 minutter, varmepumpe skrus av i 15 minutter. Utfordringen er at jeg vil ha varmepumpen til å gå tilbake til samme status som den var før automasjonen. Dvs, hvis varmepumpen var av skal ikke automasjonen slå på varmepumpen etter 15 minutter etter at automasjonen var trigget. Er ikke veldig flink med node red. Setter pris på om noen vil lage en slik flow og dele kode. Hensikten er at jeg skal holde meg under 5 kwt.

Lenke til kommentar
Del på andre sider

Noe sånt?

image.png.c7fcdd78eed6bad4de74efbfb3e0480c.png

Forutsetter at setpunkt for varmekabel og driftsstatus varmepumpe ligger i flow variabel. Setpunkt og drift  settes her ved å trykke på injektor-nodene. En switch i Node Red Dashboard slår på strømsparing og resultatet vises i debugnoden til høyre. 10 sek forsinkelse her bare for testing.

 

Mange måter å gjøre det på men dette kan være en måte.

[{"id":"fd9e0989f6f4947b","type":"change","z":"b283eef3.e91d1","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"VarmekabelSP","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":380,"wires":[["efc93f77fb9bc8f6"]]},{"id":"df4aea6be354937c","type":"switch","z":"b283eef3.e91d1","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":400,"y":390,"wires":[["98d1aab379c41465","d7249953dfa353a2","8eadc1d45e88a9f4"],["fd9e0989f6f4947b","f1504ab57213e203"]]},{"id":"6f2d885796e2c568","type":"ui_switch","z":"b283eef3.e91d1","name":"","label":"Strømsparing","tooltip":"","group":"ab0b4b6271303101","order":7,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":false,"className":"","x":190,"y":390,"wires":[["df4aea6be354937c"]]},{"id":"98d1aab379c41465","type":"function","z":"b283eef3.e91d1","name":"","func":"var setpunkt = flow.get(\"VarmekabelSP\")||20\nsetpunkt = setpunkt - 5;\nmsg.payload = setpunkt;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":640,"y":350,"wires":[["efc93f77fb9bc8f6"]]},{"id":"efc93f77fb9bc8f6","type":"debug","z":"b283eef3.e91d1","name":"Varmekabel","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":930,"y":350,"wires":[]},{"id":"adb85977b1eaf6df","type":"delay","z":"b283eef3.e91d1","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":320,"y":530,"wires":[["ff9f6e175ff1170d"]]},{"id":"ff9f6e175ff1170d","type":"change","z":"b283eef3.e91d1","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":530,"wires":[["6f2d885796e2c568"]]},{"id":"97ccfb0ab30d3958","type":"inject","z":"b283eef3.e91d1","name":"Lagre setpunkt for varmekabler","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":250,"y":250,"wires":[["eae5ceee986bad56"]]},{"id":"eae5ceee986bad56","type":"change","z":"b283eef3.e91d1","name":"","rules":[{"t":"set","p":"VarmekabelSP","pt":"flow","to":"22","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":250,"wires":[[]]},{"id":"d7249953dfa353a2","type":"function","z":"b283eef3.e91d1","name":"Reset delay","func":"var m1 = {reset:true};\nreturn [[m1,msg]];","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":160,"y":530,"wires":[["adb85977b1eaf6df"]]},{"id":"8eadc1d45e88a9f4","type":"change","z":"b283eef3.e91d1","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":430,"wires":[["eecb4f42b6064c39"]]},{"id":"f1504ab57213e203","type":"change","z":"b283eef3.e91d1","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"VarmepumpeDrift","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":460,"wires":[["eecb4f42b6064c39"]]},{"id":"eecb4f42b6064c39","type":"debug","z":"b283eef3.e91d1","name":"Varmepumpe","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":930,"y":440,"wires":[]},{"id":"ee193022daaea826","type":"inject","z":"b283eef3.e91d1","name":"Varmepumpe på","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":200,"y":280,"wires":[["83877150e4beaa94"]]},{"id":"83877150e4beaa94","type":"change","z":"b283eef3.e91d1","name":"","rules":[{"t":"set","p":"VarmepumpeDrift","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":280,"wires":[[]]},{"id":"7ba087e1277fedc5","type":"inject","z":"b283eef3.e91d1","name":"Varmepumpe av","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":200,"y":310,"wires":[["83877150e4beaa94"]]},{"id":"ab0b4b6271303101","type":"ui_group","name":"Kolonne1","tab":"e3ef94435f0945bf","order":2,"disp":false,"width":"10","collapse":false,"className":""},{"id":"e3ef94435f0945bf","type":"ui_tab","name":"Teknisk","icon":"timeline","order":7,"disabled":false,"hidden":false}]

 

Lenke til kommentar
Del på andre sider

SveinHa skrev (16 timer siden):

Noe sånt?

image.png.c7fcdd78eed6bad4de74efbfb3e0480c.png

Forutsetter at setpunkt for varmekabel og driftsstatus varmepumpe ligger i flow variabel. Setpunkt og drift  settes her ved å trykke på injektor-nodene. En switch i Node Red Dashboard slår på strømsparing og resultatet vises i debugnoden til høyre. 10 sek forsinkelse her bare for testing.

 

Mange måter å gjøre det på men dette kan være en måte.

[{"id":"fd9e0989f6f4947b","type":"change","z":"b283eef3.e91d1","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"VarmekabelSP","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":380,"wires":[["efc93f77fb9bc8f6"]]},{"id":"df4aea6be354937c","type":"switch","z":"b283eef3.e91d1","name":"","property":"payload","propertyType":"msg","rules":[{"t":"true"},{"t":"false"}],"checkall":"true","repair":false,"outputs":2,"x":400,"y":390,"wires":[["98d1aab379c41465","d7249953dfa353a2","8eadc1d45e88a9f4"],["fd9e0989f6f4947b","f1504ab57213e203"]]},{"id":"6f2d885796e2c568","type":"ui_switch","z":"b283eef3.e91d1","name":"","label":"Strømsparing","tooltip":"","group":"ab0b4b6271303101","order":7,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":false,"className":"","x":190,"y":390,"wires":[["df4aea6be354937c"]]},{"id":"98d1aab379c41465","type":"function","z":"b283eef3.e91d1","name":"","func":"var setpunkt = flow.get(\"VarmekabelSP\")||20\nsetpunkt = setpunkt - 5;\nmsg.payload = setpunkt;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":640,"y":350,"wires":[["efc93f77fb9bc8f6"]]},{"id":"efc93f77fb9bc8f6","type":"debug","z":"b283eef3.e91d1","name":"Varmekabel","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":930,"y":350,"wires":[]},{"id":"adb85977b1eaf6df","type":"delay","z":"b283eef3.e91d1","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":320,"y":530,"wires":[["ff9f6e175ff1170d"]]},{"id":"ff9f6e175ff1170d","type":"change","z":"b283eef3.e91d1","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":530,"wires":[["6f2d885796e2c568"]]},{"id":"97ccfb0ab30d3958","type":"inject","z":"b283eef3.e91d1","name":"Lagre setpunkt for varmekabler","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":250,"y":250,"wires":[["eae5ceee986bad56"]]},{"id":"eae5ceee986bad56","type":"change","z":"b283eef3.e91d1","name":"","rules":[{"t":"set","p":"VarmekabelSP","pt":"flow","to":"22","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":540,"y":250,"wires":[[]]},{"id":"d7249953dfa353a2","type":"function","z":"b283eef3.e91d1","name":"Reset delay","func":"var m1 = {reset:true};\nreturn [[m1,msg]];","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":160,"y":530,"wires":[["adb85977b1eaf6df"]]},{"id":"8eadc1d45e88a9f4","type":"change","z":"b283eef3.e91d1","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":430,"wires":[["eecb4f42b6064c39"]]},{"id":"f1504ab57213e203","type":"change","z":"b283eef3.e91d1","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"VarmepumpeDrift","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":460,"wires":[["eecb4f42b6064c39"]]},{"id":"eecb4f42b6064c39","type":"debug","z":"b283eef3.e91d1","name":"Varmepumpe","active":true,"tosidebar":false,"console":false,"tostatus":true,"complete":"payload","targetType":"msg","statusVal":"payload","statusType":"auto","x":930,"y":440,"wires":[]},{"id":"ee193022daaea826","type":"inject","z":"b283eef3.e91d1","name":"Varmepumpe på","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":200,"y":280,"wires":[["83877150e4beaa94"]]},{"id":"83877150e4beaa94","type":"change","z":"b283eef3.e91d1","name":"","rules":[{"t":"set","p":"VarmepumpeDrift","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":280,"wires":[[]]},{"id":"7ba087e1277fedc5","type":"inject","z":"b283eef3.e91d1","name":"Varmepumpe av","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"false","payloadType":"bool","x":200,"y":310,"wires":[["83877150e4beaa94"]]},{"id":"ab0b4b6271303101","type":"ui_group","name":"Kolonne1","tab":"e3ef94435f0945bf","order":2,"disp":false,"width":"10","collapse":false,"className":""},{"id":"e3ef94435f0945bf","type":"ui_tab","name":"Teknisk","icon":"timeline","order":7,"disabled":false,"hidden":false}]

 

Må si det var ganske gresk for meg. Som sagt er jeg ganske ny med node red, og driver kun å tester ut

Lenke til kommentar
Del på andre sider

solosuper skrev (59 minutter siden):

Må si det var ganske gresk for meg. Som sagt er jeg ganske ny med node red, og driver kun å tester ut

De 3 første grå er for å slå av/på varmepumpe og sette standardsetpunkt for gulvvarme.

 

"Strømsparing" er bare en bryter der du setter strømsparing av/på (=Når boolean går til "on",)

 

Switch er valget om hva som skjer om strømsparing er på (true) eller av (false).

 

Function og de 3 set... utfører oppgaven.

 

Resultatet vises i de grønne debugnodene.

 

Hele greiene må jo bygges inn i annen automasjon, "Når boolean går til "on"," må jo komme fra en plass, i eksempelet er det i Node Red Dashboard og resultatet må jo brukes en eller annen plass og ikke bare vises på skjermen. flow-variablenes verdi finner du i menyen "Context data" (oppdateres ikke før du trykker "Refresh").

Lenke til kommentar
Del på andre sider

Bli med i samtalen

Du kan publisere innhold nå og registrere deg senere. Hvis du har en konto, logg inn nå for å poste med kontoen din.

Gjest
Skriv svar til emnet...

×   Du har limt inn tekst med formatering.   Lim inn uten formatering i stedet

  Du kan kun bruke opp til 75 smilefjes.

×   Lenken din har blitt bygget inn på siden automatisk.   Vis som en ordinær lenke i stedet

×   Tidligere tekst har blitt gjenopprettet.   Tøm tekstverktøy

×   Du kan ikke lime inn bilder direkte. Last opp eller legg inn bilder fra URL.

×
×
  • Opprett ny...

Viktig informasjon

Vi har plassert informasjonskapsler/cookies på din enhet for å gjøre denne siden bedre. Du kan justere dine innstillinger for informasjonskapsler, ellers vil vi anta at dette er ok for deg.