system variables recalculate on command?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
uxhamby
Normal user
Posts: 132
Joined: 29 Dec 2016, 18:13
Location: Toronto Canada

system variables recalculate on command?

#1 Post by uxhamby » 07 Jul 2021, 23:46

I have a situation where several esp's are on a network that has no Internet access. It eventually will, but for the foreseeable future there is no connection. Meanwhile, after a power outage, I set all of their local time and dates manually using Datetime[,YYYY-MM-DD[,hh:mm:ss]] which worked fine. Or so it seemed, till things continued to happen at random times.

Trouble is that the internal %sunrise% & %sunset% system variables don't seem to recalculate, after a manual Datetime reset.

Is there a way to have the system variables recalculate on command?

Thanks,

Brian H.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: system variables recalculate on command?

#2 Post by TD-er » 08 Jul 2021, 00:05

You can call DateTime
See: https://espeasy.readthedocs.io/en/lates ... l-commands

Is that usable?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: system variables recalculate on command?

#3 Post by TD-er » 08 Jul 2021, 00:06

Or you could add a GPS unit to one of the ESPs.

User avatar
ThomasB
Normal user
Posts: 1064
Joined: 17 Jun 2018, 20:41
Location: USA

Re: system variables recalculate on command?

#4 Post by ThomasB » 08 Jul 2021, 03:17

Trouble is that the internal %sunrise% & %sunset% system variables don't seem to recalculate, after a manual Datetime reset.
I'd say this is a bug. BTW, I found that tools->adv->localization settings have a similar problem too.

Edit: I briefly looked at the source code. My best guess: Seems to me that time_zone.applyTimeZone() should be called after the user manually enters the time or changes localization settings. I expect that would update the %sunrise% & %sunset% system vars.
Is there a way to have the system variables recalculate on command?
A workaround is to set the Datetime, then issue the reboot command. The %sunrise% & %sunset% system vars will now report the correct values.

- Thomas

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests