Node-red-contrib-bigtimer from dawn to dusk depending on the gps location

Hey,

i would like do get a true/fals 1/0 on dawn/dusk depending on the gps location.

i inject to the input:
S1 : msg.payload : string[22]

"geo_override 53.22 6.6"

but the off time is always wrong with the injected coordinates. With fixed coordinates its correct.

i have no idea what's wrong

best Lars

I noticed here

https://tech.scargill.net/big-timer/

that in the comments the author says this

Peter Scargill says:

January 17, 2022 at 11:23 am

Not much more to clarify – the override commend to inject is for example “geo_override aa.aa bb.bb” without the quotes where aa.aa and bb.bb are longitude and latitude..

so perhaps you need 06.06 for the longitude value or whatever the correct value is in the format of 2 digits on both sides of the decimal.

simple with cron-plus...

[{"id":"2841416eb427f04e","type":"inject","z":"6e46a349d744ceaa","name":"next dusk/dawn @ 54.999,-1.417","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"dusk/dawn @ 54.999,-1.417","payload":"{\"command\":\"describe\",\"expressionType\":\"solar\",\"location\":\"54.999,-1.417\",\"solarType\":\"selected\",\"solarEvents\":\"civilDawn,civilDusk\"}","payloadType":"json","x":1330,"y":140,"wires":[["a73c3e1c13b31c96"]]},{"id":"66d9c0851faea407","type":"cronplus","z":"6e46a349d744ceaa","name":"","outputField":"payload","timeZone":"Europe/London","storeName":"","commandResponseMsgOutput":"output1","defaultLocation":"","defaultLocationType":"default","outputs":1,"options":[],"x":1300,"y":240,"wires":[["76ac87326e9f6a2e","07532012d69faf80"]]},{"id":"76ac87326e9f6a2e","type":"debug","z":"6e46a349d744ceaa","name":"all data","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1500,"y":240,"wires":[]},{"id":"b64210a4eb1ed826","type":"inject","z":"6e46a349d744ceaa","name":" dusk/dawn for N Greenland (83.653 -31.245)","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":" dusk/dawn for N greenland (83.653 -31.245)","payload":"{\"command\":\"describe\",\"expressionType\":\"solar\",\"location\":\"83.653 -31.245\",\"solarType\":\"selected\",\"solarEvents\":\"civilDawn,civilDusk\"}","payloadType":"json","x":1290,"y":100,"wires":[["a73c3e1c13b31c96"]]},{"id":"07532012d69faf80","type":"function","z":"6e46a349d744ceaa","name":"times in locale","func":"\nconst payload = {}\n\n// loop eventTimes & format the date objects\nfor (let index = 0; index < msg.payload.result.eventTimes.length; index++) {\n    const eventData = msg.payload.result.eventTimes[index];\n    payload[eventData.event] = {\n        dateObject: eventData.time,\n        asString: eventData.time.toString(),\n        asLocale: eventData.time.toLocaleString()\n    }\n}\n\nmsg.payload = payload\n\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1320,"y":300,"wires":[["b260679fedee2cde"]]},{"id":"b260679fedee2cde","type":"debug","z":"6e46a349d744ceaa","name":"formatted dates","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1520,"y":300,"wires":[]},{"id":"bf8e1c3dada4ff87","type":"inject","z":"6e46a349d744ceaa","name":"dusk/dawn on 1-jun-2024 @ 54.999,-1.417","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"dusk/dawn on 1-jun-2024 @ 54.999,-1.417","payload":"{\"command\":\"describe\",\"expressionType\":\"solar\",\"location\":\"54.999,-1.417\",\"solarType\":\"selected\",\"solarEvents\":\"civilDawn,civilDusk\",\"time\":\"2024-06-01 01:00\"}","payloadType":"json","x":1300,"y":180,"wires":[["a73c3e1c13b31c96"]]},{"id":"a73c3e1c13b31c96","type":"junction","z":"6e46a349d744ceaa","x":1560,"y":180,"wires":[["66d9c0851faea407"]]}]


NOTES

Why did I chose Northern Greenland as an example?
Why did I do a future date example?

Not many solar nodes/modules do a good job of figuring out the prev/next solar events - and it gets worse when the location doesnt have that event until some months later.

Look closely at the screenshot - see how Northern Greenland's next Dawn event is not until 23rd Sept.

53.22 6.6 is in the Netherlands

urm, ok :rofl:

I was just showing you how you can get dawn/dusk/you-name-it dynamically using cron-plus & you will get more features and more importantly, it works! import the flow demo & enter 53.22 6.6 to see for yourself (or not! :slight_smile: )

thx! such an easy fix....hopefully.
we will see on tomorrow.

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