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

**URL:** <https://discourse.nodered.org/t/node-red-contrib-bigtimer-from-dawn-to-dusk-depending-on-the-gps-location/80085>\
**Category:** General\
**Created:** [26 July 2023 11:55 UTC](https://discourse.nodered.org/t/node-red-contrib-bigtimer-from-dawn-to-dusk-depending-on-the-gps-location/80085 "2023-07-26T11:55:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lars78](https://avatars.discourse-cdn.com/v4/letter/l/e68b1a/32.png) [@Lars78](https://discourse.nodered.org/u/Lars78)\
**Post date:** [26 July 2023 11:55 UTC](https://discourse.nodered.org/t/node-red-contrib-bigtimer-from-dawn-to-dusk-depending-on-the-gps-location/80085/1 "2023-07-26T11:55:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tonymacdonald](https://avatars.discourse-cdn.com/v4/letter/t/77aa72/32.png) [@tonymacdonald](https://discourse.nodered.org/u/tonymacdonald)\
**Post date:** [26 July 2023 19:00 UTC](https://discourse.nodered.org/t/node-red-contrib-bigtimer-from-dawn-to-dusk-depending-on-the-gps-location/80085/2 "2023-07-26T19:00:59Z")

</div>

I noticed here

[https://tech.scargill.net/big-timer/](https://tech.scargill.net/big-timer/)

that in the comments the author says this

> **[Peter Scargill](https://tech.scargill.net/user/ventadelperel/)** says:
> 
> [January 17, 2022 at 11:23 am](https://tech.scargill.net/big-timer/#comment-79273)
> 
> 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.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 July 2023 19:14 UTC](https://discourse.nodered.org/t/node-red-contrib-bigtimer-from-dawn-to-dusk-depending-on-the-gps-location/80085/3 "2023-07-26T19:14:22Z")

</div>

simple with [cron-plus](https://flows.nodered.org/node/node-red-contrib-cron-plus)...

```auto
[{"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"]]}]

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/1/0134f40b0f30b9a1221ab3715499e34b87ff20cd.png)

* * *

### 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.

---

<div class="post-metadata">

**Author:** ![Lars78](https://avatars.discourse-cdn.com/v4/letter/l/e68b1a/32.png) [@Lars78](https://discourse.nodered.org/u/Lars78)\
**Post date:** [26 July 2023 20:51 UTC](https://discourse.nodered.org/t/node-red-contrib-bigtimer-from-dawn-to-dusk-depending-on-the-gps-location/80085/4 "2023-07-26T20:51:50Z")

</div>

53.22 6.6 is in the Netherlands

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 July 2023 21:14 UTC](https://discourse.nodered.org/t/node-red-contrib-bigtimer-from-dawn-to-dusk-depending-on-the-gps-location/80085/5 "2023-07-26T21:14:47Z")

</div>

> [@Lars78](#):
>
> is in the Netherlands

urm, ok 🤣

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! 🙂 )

---

<div class="post-metadata">

**Author:** ![Lars78](https://avatars.discourse-cdn.com/v4/letter/l/e68b1a/32.png) [@Lars78](https://discourse.nodered.org/u/Lars78)\
**Post date:** [26 July 2023 21:28 UTC](https://discourse.nodered.org/t/node-red-contrib-bigtimer-from-dawn-to-dusk-depending-on-the-gps-location/80085/6 "2023-07-26T21:28:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [24 September 2023 21:29 UTC](https://discourse.nodered.org/t/node-red-contrib-bigtimer-from-dawn-to-dusk-depending-on-the-gps-location/80085/7 "2023-09-24T21:29:50Z")

</div>

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