Logic Machine Forum
Sunrise sunset - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: General (https://forum.logicmachine.net/forumdisplay.php?fid=2)
+--- Thread: Sunrise sunset (/showthread.php?tid=2322)

Pages: 1 2


Sunrise sunset - benanderson_475 - 05.11.2019

Is a lan connection required to use scheduled sunrise/sunset? And dose this function run if there is no internet connection?


RE: Sunrise sunset - admin - 05.11.2019

It's calculated internally based on current date and configured coordinates. Internet connection is not required.


RE: Sunrise sunset - Erwin van der Zwart - 05.11.2019

Hi,

I don’t fully agree with that, without internet you don’t have NTP so you risk a wrong time after power outage, I would add a KNX time DCF77 and a script to keep the controller on time...

BR,

Erwin


RE: Sunrise sunset - Joep - 05.11.2019

(05.11.2019, 09:05)admin Wrote: It's calculated internally based on current date and configured coordinates. Internet connection is not required.
 Is it possible to improve the internall clock so that it will stay on time even if it's no longer connected to the internet?


RE: Sunrise sunset - benanderson_475 - 05.11.2019

(05.11.2019, 14:59)Joep Wrote:
(05.11.2019, 09:05)admin Wrote: It's calculated internally based on current date and configured coordinates. Internet connection is not required.
 Is it possible to improve the internall clock so that it will stay on time even if it's no longer connected to the internet?
 is there some way to have the user enter the correct time from Visu If power were to fail?


RE: Sunrise sunset - Erwin van der Zwart - 05.11.2019

Hi,

Yes, you can add a knx time and date object to the visu and a TAG to it and add this as a event based script to it that is triggered by the TAG:

Code:
if event.sender == 'us' then -- Only execute when action comes from visu
   date = grp.getvalue('1/1/1')
   time = grp.getvalue('1/1/2')
   cmd = string.format("date -s '%d-%d-%d %d:%d:%d'", date.year, date.month, date.day, time.hour, time.minute, time.second)
   os.execute(cmd)
end
When the user updates the KNX objects from the visu the script will update the controller time and date 

To keep the objects in the visu up to date with the system time you can add this script as resident at 60 seconds:
Code:
-- get current data as table
now = os.date('*t')

-- system week day starts from sunday, convert it to knx format
wday = now.wday == 1 and 7 or now.wday - 1

-- time table
time = {
day = wday,
hour = now.hour,
minute = now.min,
second = now.sec,
}

-- date table
date = {
day = now.day,
month = now.month,
year = now.year,
}

-- write to bus
grp.write('1/1/2', time, dt.time)
grp.write('1/1/1', date, dt.date)
BR,

Erwin


RE: Sunrise sunset - admin - 06.11.2019

You can also use USB-GPS if antenna can be placed somewhere where GPS reception is possible.


RE: Sunrise sunset - Kai-Roger - 06.11.2019

(06.11.2019, 08:37)admin Wrote: You can also use USB-GPS if antenna can be placed somewhere where GPS reception is possible.

And altso a KNX clock with a built-in battery can be used. But these of course need a little adjusting of the time along the year. GPS is better.


RE: Sunrise sunset - admin - 06.11.2019

LM has built-in real-time clock and there's a super capacitor instead of battery which will keep the clock going during a short power outage.


RE: Sunrise sunset - Kai-Roger - 06.11.2019

(06.11.2019, 09:05)admin Wrote: LM has built-in real-time clock and there's a super capacitor instead of battery which will keep the clock going during a short power outage.

That was new to me. Clever! It's very rare that there is a long term outage in my area. But i know places nearby where there is power outage for several days almost every time there is a big autumn storm. Will the super capacitor last several days, or are we talking about hours?


RE: Sunrise sunset - admin - 06.11.2019

Only several hours. You should install a UPS if long outages happen often.


RE: Sunrise sunset - Erwin van der Zwart - 06.11.2019

(06.11.2019, 08:58)Kai-Roger Wrote: And altso a KNX clock with a built-in battery can be used. But these of course need a little adjusting of the time along the year. GPS is better.

Hi,

Always a nice discussion, in my opinion you should connect a IoT device to a network that supports IoT features (: If you don't you will lose functionality..

If you use our time sender MTN677290 you can connect a DCF77 antenna and set in the parameters the daylight saving time period so you don't need to change along the year. But i agree that a USB GPS probably would be a cheaper solution.

@Admin: Does it work native or do we need a script to set the time from the USB GPS fetched data?

BR,

Erwin


RE: Sunrise sunset - admin - 06.11.2019

There's no ready-made script but NMEA protocol is fairly simple (ASCII-based). You need to read lines from serial port and split them into chunks separated by ",". Then extract time/date from field values. There are also GPS receivers with RS232. These need an extra power supply but can have longer cables compared to USB.


RE: Sunrise sunset - Erwin van der Zwart - 06.11.2019

(06.11.2019, 09:49)admin Wrote: There's no ready-made script but NMEA protocol is fairly simple (ASCII-based). You need to read lines from serial port and split them into chunks separated by ",". Then extract time/date from field values. There are also GPS receivers with RS232. These need an extra power supply but can have longer cables compared to USB.

Hi,

I will figure that out when needed, no problem, just was curious if it was native, but was expecting this answer already (:

BR,

Erwin


RE: Sunrise sunset - lenze90 - 28.11.2019

Hello, everybody,

I have seen that I can specify date, time and latitude and longitude in the settings of the logic machine.

I want the outdoor lighting to turn on at sunset.
What is the easiest way to query this sunset condition?

Thank you very much and best regards
Chris


RE: Sunrise sunset - Erwin van der Zwart - 28.11.2019

Hi,

The easiest way is to create a scheduler with sunset/sunrise events and attach it to your outdoor light object.

BR,

Erwin


RE: Sunrise sunset - lenze90 - 29.11.2019

Sorry, I need a little more help. Where do I find the option to choose Sunset? Where can I do that? I can't find anything. Do I do this by code?


RE: Sunrise sunset - admin - 29.11.2019

Which firmware version are you using?


RE: Sunrise sunset - lenze90 - 29.11.2019

HW: LM5 Lite + Ext (i.MX6)
SW: 20180822


RE: Sunrise sunset - admin - 29.11.2019