# Node-red-contrib-nighttime. Need to provide GPS Day or Night node via JSON

**URL:** https://discourse.nodered.org/t/node-red-contrib-nighttime-need-to-provide-gps-day-or-night-node-via-json/94078
**Category:** General
**Tags:** function-node
**Created:** [21 December 2024 14:06 UTC](https://discourse.nodered.org/t/node-red-contrib-nighttime-need-to-provide-gps-day-or-night-node-via-json/94078 "2024-12-21T14:06:13Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![pcborges](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@pcborges](https://discourse.nodered.org/u/pcborges)
#### Post date: [21 December 2024 14:06 UTC](https://discourse.nodered.org/t/node-red-contrib-nighttime-need-to-provide-gps-day-or-night-node-via-json/94078/1 "2024-12-21T14:06:13Z")

</div>

I am using node-red-contrib-nighttime and currently I am typing LAT & LONG manualy.  
I need to make it autonomous so I am getting coordinates from on line service.  
Day\_or\_Night node says it can get LAT/LONG data from location service.  
"lat and long will autofill if you allowed location service."  
But I am finding problems on how to make it work in my Raspberry Pi, not even ChatGPT is provinding something that works.  
Assistance wellcome.

---

<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: [21 December 2024 14:41 UTC](https://discourse.nodered.org/t/node-red-contrib-nighttime-need-to-provide-gps-day-or-night-node-via-json/94078/2 "2024-12-21T14:41:10Z")

</div>

What is it you are trying to achieve? What is the overall goal?

It may be you simply need something like node-red contrib-Cron-plus to emit a message when it is sunset or dusk?

Or you could send a message with coordinates to the cron plus node and it will tell you the phase of the Sun and whether it is day or night.

Note this would be 100% local. No need for calls to external web services.

---

<div class="post-metadata">

### Author: ![pcborges](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@pcborges](https://discourse.nodered.org/u/pcborges)
#### Post date: [21 December 2024 15:05 UTC](https://discourse.nodered.org/t/node-red-contrib-nighttime-need-to-provide-gps-day-or-night-node-via-json/94078/3 "2024-12-21T15:05:28Z")

</div>

I don't know of node-red contrib-Cron-plus.  
But the objetive is simple, to switch on lights of some lamps when it darkens in my region, switch some when it is 22:00hs and some when the sun comes up in the morning.  
So far it works well typing my GPS coordinates in this Day\_or\_Night node but I want it to be autonomous but the Day\_or\_Night node has no input and it says as explained above that it can get these coordinates from this "location service" that sounds like something I have to setup in my Raspberry Pi system.  
I have GPS coordinates in JSON format from the internet to provide to this "location service" I just have no idea how to do it.  
Day\_or\_Night is simple and outputs true for night and false for day, that all I need.  
Thanks

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [21 December 2024 15:07 UTC](https://discourse.nodered.org/t/node-red-contrib-nighttime-need-to-provide-gps-day-or-night-node-via-json/94078/4 "2024-12-21T15:07:20Z")

</div>

It is over six years since it has been updated.

It uses the suncalc library. Which you could use yourself in a function node instead. Using a public coordinates lookup API to get a rough position. If you want an exact position, GPS sensors exist that could work with a Pi or an ESP/Arduino device.

Personally, I use node-red-contrib-suncalc - not sure but I think you can feed it coordinates.

---

<div class="post-metadata">

### Author: ![pcborges](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@pcborges](https://discourse.nodered.org/u/pcborges)
#### Post date: [21 December 2024 15:11 UTC](https://discourse.nodered.org/t/node-red-contrib-nighttime-need-to-provide-gps-day-or-night-node-via-json/94078/5 "2024-12-21T15:11:10Z")

</div>

> [@Steve-Mcl](#):
>
> node-red contrib-Cron-plus

Just had a look.  
It seems it can do the job.  
Will try.  
Thanks a lot.

---

<div class="post-metadata">

### Author: ![pcborges](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@pcborges](https://discourse.nodered.org/u/pcborges)
#### Post date: [21 December 2024 20:38 UTC](https://discourse.nodered.org/t/node-red-contrib-nighttime-need-to-provide-gps-day-or-night-node-via-json/94078/7 "2024-12-21T20:38:00Z")

</div>

I need to feed LAT/LONG dinamicaly.  
Thanks

---

<div class="post-metadata">

### Author: ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)
#### Post date: [21 December 2024 21:06 UTC](https://discourse.nodered.org/t/node-red-contrib-nighttime-need-to-provide-gps-day-or-night-node-via-json/94078/8 "2024-12-21T21:06:04Z")

</div>

> [@pcborges](#):
>
> I need to feed LAT/LONG dinamicaly.

Why? Are you doing something similar to a location tracking phone app?

---

<div class="post-metadata">

### Author: ![pcborges](https://avatars.discourse-cdn.com/v4/letter/p/8edcca/32.png) [@pcborges](https://discourse.nodered.org/u/pcborges)
#### Post date: [21 December 2024 21:11 UTC](https://discourse.nodered.org/t/node-red-contrib-nighttime-need-to-provide-gps-day-or-night-node-via-json/94078/9 "2024-12-21T21:11:15Z")

</div>

No, but I intend to ship the device to places for testing and would like to avoid people entering GPS coodinates.

---

<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: [21 March 2025 21:11 UTC](https://discourse.nodered.org/t/node-red-contrib-nighttime-need-to-provide-gps-day-or-night-node-via-json/94078/10 "2025-03-21T21:11:16Z")

</div>

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