NTP Call from node red

1,415 views
Skip to first unread message

uzair...@jintech.com

unread,
Aug 28, 2017, 8:35:11 AM8/28/17
to Node-RED
I want to get NTP server time from my node red to ensure accurate time before my time dependent tasks? How can i do it?

Colin Law

unread,
Aug 28, 2017, 8:48:45 AM8/28/17
to node...@googlegroups.com
Usually you would rely on the operating system to maintain an accurate
time for you. Is there some reason you cannot do that in this case?

On 28 August 2017 at 13:35, <uzair...@jintech.com> wrote:
> I want to get NTP server time from my node red to ensure accurate time
> before my time dependent tasks? How can i do it?
>
> --
> http://nodered.org
>
> Join us on Slack to continue the conversation: http://nodered.org/slack
> ---
> You received this message because you are subscribed to the Google Groups
> "Node-RED" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to node-red+u...@googlegroups.com.
> To post to this group, send email to node...@googlegroups.com.
> Visit this group at https://groups.google.com/group/node-red.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/node-red/f746a230-1fb1-40fb-944b-17b096903007%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

uzair...@jintech.com

unread,
Aug 28, 2017, 8:56:37 AM8/28/17
to Node-RED
Pi that is running node red is not under my control whole time and i want to ensure it in my node red that time is set valid. It has caused some issue to me in last few days due to time sync issue on Pi.

Colin Law

unread,
Aug 28, 2017, 9:06:53 AM8/28/17
to node...@googlegroups.com
Possibly you could use an exec node to force an ntp sync and check the
response from that.

Colin
> https://groups.google.com/d/msgid/node-red/60b76cd2-83bf-4bf0-9158-28b1ecf074eb%40googlegroups.com.

Dave C-J

unread,
Aug 28, 2017, 10:57:12 AM8/28/17
to node...@googlegroups.com
Probably only if you are running Node-RED as root. And if you were then you would have control over ntp anyway 
--
Sent from phone.

Colin Law

unread,
Aug 28, 2017, 11:29:55 AM8/28/17
to node...@googlegroups.com
Rather than run as root use visudo to allow the node red user to run
ntpdate without requiring a password. Then the exec node should be
able to run
sudo ntpdate ....

Colin
> --
> http://nodered.org
>
> Join us on Slack to continue the conversation: http://nodered.org/slack
> ---
> You received this message because you are subscribed to the Google Groups
> "Node-RED" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to node-red+u...@googlegroups.com.
> To post to this group, send email to node...@googlegroups.com.
> Visit this group at https://groups.google.com/group/node-red.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/node-red/CACXWFw%2BCDrJz_Bo3i8nVFVtge6OBY8m6PskR-gCF3PrnMVs0nA%40mail.gmail.com.

Julian Knight

unread,
Sep 6, 2017, 4:20:41 PM9/6/17
to Node-RED
As a potentially simpler alternative - simply use a web time API and check against the current device time - if too far out alert the user to fix it before allowing the flow to run :)
Reply all
Reply to author
Forward
0 new messages