SpaceLogic KNX Forum
Schneider Electric SpaceLogic KNX forum to get support and share knowledge including selection, installation and troubleshooting for spaceLYnk, Wiser for KNX, eConfigure KNX, SpaceLogic KNX Hybrid module and other topics.
Link copied. Please paste this link to share this article on your social media post.
Dear all,
Here I am again with question. I tried to reach the answer in documentation but no success.
The use case is the following. A house with quite fixed schedules for Heating. But when leaving out complete day Schedulers should have no effect and Standby mode should be selected until user is back.
There are several ways to do it and I have one way already done and working but.... The cleaner one for me would be to disable schedulers with a KNX telegram at the door push button. Is it possible that way?
Thanks for answers!
Link copied. Please paste this link to share this article on your social media post.
As same as you can enable/disable a script..
script.enable('My own script')
script.disable('My own script')
It would be nice ...
scheduler.enable('My scheduler')
Link copied. Please paste this link to share this article on your social media post.
Hi Jorge,
You can disable and enable the scheduler with a little script by read/write directly to the DB.
Try this:
-- Function Enable Schedular (can be added to common functions and removed from this script)
function scheduler_enable(scheduler_name)
query = 'SELECT id, name, active FROM schedulers'
for _, scheduler in ipairs(db:getall(query)) do
if scheduler.name == scheduler_name then
db:update('schedulers', { active = 1 }, { id = scheduler.id })
end
end
end
-- Function Disable Schedular (can be added to common functions and removed from this script)
function scheduler_disable(scheduler_name)
query = 'SELECT id, name, active FROM schedulers'
for _, scheduler in ipairs(db:getall(query)) do
if scheduler.name == scheduler_name then
db:update('schedulers', { active = 0 }, { id = scheduler.id })
end
end
end
-- Action to change scheduler (event based)
eventvalue = event.getvalue()
if eventvalue == true then
scheduler_enable('My scheduler')
else
scheduler_disable('My scheduler')
end
Best regards,
Erwin
Link copied. Please paste this link to share this article on your social media post.
It works perfectly. I would ask colleagues to add it as common function (same as sunset/sunrise).
I have a second question. As soon as schedulers are enabled, is it possible to force them to send the value that corresponds to the time is it?
Use case:
I leave home so all RTC goes to Standby and schedulers are disabled.
I arrive home at 13:00, so I activate schedulers, and because it is lunch time, kitchen is intended to be in Comfort.
If I arrive home at 20:00 then the room and living room should be in Comfort.
So the status when I come back should follow the schedulers.
Thanks a lot!
Link copied. Please paste this link to share this article on your social media post.
-- sunrise / sunset / elevation / azimut calculation
function rscalc(latitude, longitude, when)
local pi = math.pi
local doublepi = pi * 2
local rads = pi / 180.0
local graus= 180.0 /pi
local TZ = function(when)
local ts = os.time(when)
local utcdate, localdate = os.date('!*t', ts), os.date('*t', ts)
localdate.isdst = false
diff = os.time(localdate) - os.time(utcdate)
dif=math.floor(diff/3600)
return math.floor(diff / 3600)
end
local ts = os.time(when)
local utcdate, localdate = os.date('!*t', ts), os.date('*t', ts)
localdate.isdst = false
local diff = os.time(localdate) - os.time(utcdate)
local dif=math.floor(diff/3600)
local hora = tonumber (os.date('%H'))
local minut = tonumber (os.date('%M'))
local minut_d= (minut/60)
local hora_solar = hora - dif + minut_d
local range = function(x)
local a = x / doublepi
local b = doublepi * (a - math.floor(a))
return b < 0 and (doublepi + b) or b
end
when = when or os.date('*t')
local y2k = { year = 2000, month = 1, day = 1 }
local y2kdays = os.time(when) - os.time(y2k)
y2kdays = math.ceil(y2kdays / 86400)
local meanlongitude = range(280.461 * rads + 0.9856474 * rads * y2kdays)
local meananomaly = range(357.528 * rads + 0.9856003 * rads * y2kdays)
local lambda = range(meanlongitude + 1.915 * rads * math.sin(meananomaly) + rads / 50 * math.sin(2 * meananomaly))
local lambda_g = lambda *graus
local obliq = (23.439 * rads) - (y2kdays * rads / 2500000)
obliq_g = obliq * graus
local alpha = math.atan2(math.cos(obliq) * math.sin(lambda), math.cos(lambda))
alpha_g = alpha * graus
local declination = math.asin(math.sin(obliq) * math.sin(lambda))
declination_g = declination *graus
local LL = meanlongitude - alpha
if meanlongitude < pi then
LL = LL + doublepi
end
local dfo = pi / 216.45
if latitude < 0 then
dfo = -dfo
end
local fo = math.min(math.tan(declination + dfo) * math.tan(latitude * rads), 1)
local ha = 12 * math.asin(fo) / pi + 6
local timezone = TZ(when)
local equation = 12 + timezone + 24 * (1 - LL / doublepi) - longitude / 15
local sunrise, sunset = equation - ha, equation + ha
if sunrise > 24 then
sunrise = sunrise - 24
end
if sunset > 24 then
sunset = sunset - 24
end
-- calculo de la elevacion
local omega=(hora_solar-12)*15 --graus
local zenit= math.acos( ((math.cos(latitude*rads))*(math.cos(declination))*(math.cos(omega*rads))) + ((math.sin(latitude*rads))*(math.sin(declination))) )
local zenit_g=zenit*graus
local elevacion=(90-zenit_g)
-- calculo de azimut
az=math.acos((((math.cos(latitude*rads))*(math.sin(declination)))-((math.cos(omega*rads))*(math.sin(latitude*rads))*(math.cos(declination))))/((math.cos(elevacion*rads))))
if omega>0 then
azimut=360-(az*graus)
else
azimut=az*graus
end
return math.floor(sunrise*60), math.ceil(sunset*60),elevacion,azimut
end
Link copied. Please paste this link to share this article on your social media post.
HI Esteve,
I know sunset/sunrise is by default included.
What I wanted to say is that Scheduler-enable could be also by default included.
Link copied. Please paste this link to share this article on your social media post.
I know. I added the azimut and sun elevation to this function 6 moths ago and working fine for testing. If officially someone wants to revise the modification and include to common functions it would be nice. This is an added value to our controller to do building blind controler position depending on sun positon.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.