Pull times from a file and write to another

Hello everyone,

I'm looking for help, I had previously a working node that was pulling 6 times every day on a website and writing on a file called timex.txt The website implemented some security I'm unable to query but the webpage has option to export the full calendar year with the 6 times daily. Can someone assist me creating a node?

Current setup which stopped working

[{"id":"25204c8da7c94154","type":"tab","label":"Diyanet Namaz Vakitleri","disabled":false,"info":"","env":[]},{"id":"af97dd1eb36b36c8","type":"inject","z":"25204c8da7c94154","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"15 00 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":40,"wires":[["b9bd128be5681bc5"]]},{"id":"b9bd128be5681bc5","type":"http request","z":"25204c8da7c94154","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://namazvakitleri.diyanet.gov.tr/tr-TR/9132/montreal-icin-namaz-vakti","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"User-Agent","keyValue":"","valueType":"other","valueValue":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:89.0) Gecko/20100101 Firefox/89.0"}],"x":250,"y":100,"wires":[["c1d11906950c26ff"]]},{"id":"c1d11906950c26ff","type":"html","z":"25204c8da7c94154","name":"html select","property":"payload","outproperty":"payload","tag":"td","ret":"text","as":"single","chr":"","x":390,"y":160,"wires":[["1a4a36bc8fda9e9c"]]},{"id":"1a4a36bc8fda9e9c","type":"template","z":"25204c8da7c94154","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"time\":[\"{{payload.2}}\",\"{{payload.3}}\",\"{{payload.4}}\",\"{{payload.5}}\",\"{{payload.6}}\",\"{{payload.7}}\"],\"date\":\"{{payload.0}}\"}","output":"str","x":520,"y":220,"wires":[["f127216b9eb82840"]]},{"id":"f127216b9eb82840","type":"file","z":"25204c8da7c94154","name":"","filename":"/homeassistant/times.txt","filenameType":"str","appendNewline":true,"createDir":false,"overwriteFile":"true","encoding":"none","x":690,"y":280,"wires":[[]]}]

Because the website is now secure, I exported the calendar to cvs file which is in this format

I would like to have a node that look on this file everyday at 00:01 and take the 6 hours and write in timex.txt file

Thank you in advance!

The flow you posted is corrupt, due to not following guide to posting code/flows..

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

Also please supply the csv file in text format, you do not need to post the whole csv text the first 4-5 lines would be enough.

An example with limited csv data

[{"id":"63999ac0c1ecc5d5","type":"debug","z":"d1395164b4eec73e","name":"debug 265","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":80,"wires":[]},{"id":"1a4a36bc8fda9e9c","type":"template","z":"d1395164b4eec73e","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{\"time\":[\"{{payload.fajr}}\",\"{{payload.sun}}\",\"date\":\"{{payload.date}}\"}","output":"str","x":500,"y":80,"wires":[["63999ac0c1ecc5d5"]]},{"id":"af97dd1eb36b36c8","type":"inject","z":"d1395164b4eec73e","name":"run yearly ","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":20,"wires":[["8792f21b0cabe252"]]},{"id":"8792f21b0cabe252","type":"template","z":"d1395164b4eec73e","name":"simulater csv file in output","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"Calender Date,Fajr,Sun\n23.08.2024,05:01,07:02\n24.08.2024,05.23,07:34\n25.08.2024,05:45,07:45","output":"str","x":340,"y":20,"wires":[["2c8921423c576b68"]]},{"id":"2c8921423c576b68","type":"csv","z":"d1395164b4eec73e","name":"","sep":",","hdrin":false,"hdrout":"none","multi":"one","ret":"\\n","temp":"date,fajr,sun","skip":"1","strings":false,"include_empty_strings":"","include_null_values":"","x":530,"y":20,"wires":[["0a9078ed240fb210"]]},{"id":"0a9078ed240fb210","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"parts.type","pt":"msg","to":"object","tot":"str"},{"t":"set","p":"parts.key","pt":"msg","to":"payload.date","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":680,"y":20,"wires":[["27a60f01181bf304"]]},{"id":"27a60f01181bf304","type":"join","z":"d1395164b4eec73e","name":"","mode":"auto","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":"false","timeout":"","count":"","reduceRight":false,"x":830,"y":20,"wires":[["2095f40f6ace247e"]]},{"id":"2095f40f6ace247e","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"prayer_dates","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1000,"y":20,"wires":[[]]},{"id":"9e9a80858efdd5da","type":"inject","z":"d1395164b4eec73e","name":"run nightly","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"01 00 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":80,"wires":[["cbdff60b23e58eed"]]},{"id":"cbdff60b23e58eed","type":"change","z":"d1395164b4eec73e","name":"","rules":[{"t":"set","p":"date","pt":"msg","to":"$moment().format(\"DD.MM.YYYY\")","tot":"jsonata"},{"t":"set","p":"payload","pt":"msg","to":"prayer_dates[msg.date]","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":80,"wires":[["1a4a36bc8fda9e9c"]]}]

I updated the initial post above.

this is the content of csv file, I just took the first 4lines.

Calendar Date Fajr Sun Dhuhr Asr Maghrib Isha
01.01.2024 05:47 07:27 12:02 14:07 16:27 17:56
02.01.2024 05:47 07:27 12:03 14:08 16:28 17:57
03.01.2024 05:47 07:27 12:03 14:08 16:29 17:58
04.01.2024 05:47 07:27 12:04 14:09 16:30 17:59

We would require the exact format of the csv file, not a forum markdown equivalent.

There are of course APIs to report prayer times, which might be a viable alternative to downloading and parsing a CSV file.

I couldn't find something to report from the website I'm using..

Hi E1cid, thanks the example of code you gave above worked. I just modified my cvs file to have all in one cell with commas and modified your code to have the 6columns..

Tarih,İmsak,Güneş,Öğle,İkindi,Akşam,Yatsı
01.01.2024,05:47,07:27,12:02,14:07,16:27,17:56
02.01.2024,05:47,07:27,12:03,14:08,16:28,17:57
03.01.2024,05:47,07:27,12:03,14:08,16:29,17:58

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.