Skip to content

Instantly share code, notes, and snippets.

@Cavemanz
Created April 30, 2019 11:11
Show Gist options
  • Save Cavemanz/f3b826afcf0b9079b66e81606754aca7 to your computer and use it in GitHub Desktop.
Save Cavemanz/f3b826afcf0b9079b66e81606754aca7 to your computer and use it in GitHub Desktop.
Node Red - Pollen
[{"id":"668152c.2638aac","type":"inject","z":"552174b1.4b349c","name":"","topic":"","payload":"[\"sensor.pollen_bjork\",\"sensor.pollen_burot\",\"sensor.pollen_gress\",\"sensor.pollen_hassel\",\"sensor.pollen_or\",\"sensor.pollen_salix\"]","payloadType":"json","repeat":"","crontab":"00 07 * * *","once":false,"onceDelay":0.1,"x":90,"y":40,"wires":[["125c1b35.ddea15"]]},{"id":"125c1b35.ddea15","type":"function","z":"552174b1.4b349c","name":"","func":"var newMsg = []\n\nfor (i=0;i<msg.payload.length;i++) {\n payload = { \"payload\": { \"entity_id\" : msg.payload[i] } } \n newMsg.push(payload)\n}\n\nnode.log([newMsg]);\nreturn [newMsg];","outputs":1,"noerr":0,"x":230,"y":40,"wires":[["7a3548b5.1fbaa8"]]},{"id":"7a3548b5.1fbaa8","type":"api-current-state","z":"552174b1.4b349c","name":"state","server":"73dec648.42a798","halt_if":"Ingen spredning","override_topic":false,"override_payload":true,"override_data":true,"entity_id":"","x":370,"y":40,"wires":[["401349fb.8ab2d8"]]},{"id":"a7ba8ddf.acefd","type":"api-call-service","z":"552174b1.4b349c","name":"","server":"73dec648.42a798","service_domain":"notify","service":"telegram_morten","data":"","render_data":false,"mergecontext":"","x":860,"y":40,"wires":[[]]},{"id":"401349fb.8ab2d8","type":"join","z":"552174b1.4b349c","name":"","mode":"custom","build":"array","property":"data","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"0.7","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":510,"y":40,"wires":[["53cbaf5b.3e705"]]},{"id":"53cbaf5b.3e705","type":"function","z":"552174b1.4b349c","name":"","func":"message = \"\"\nfor (i=0;i<msg.data.length;i++) {\n text = \" *\" + \n msg.data[i].state + \n \"* av *\" + \n msg.data[i].attributes.friendly_name +\n \"*\\n\"\n message += text\n}\nvar newMsg = {\"payload\": { \"data\": { \"message\" : message } } }\nreturn newMsg;","outputs":1,"noerr":0,"x":650,"y":40,"wires":[["a7ba8ddf.acefd"]]},{"id":"73dec648.42a798","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true}]
@Jacksonbm1
Copy link

Any chance you could tell me what your dependencies are?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment