This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

different value throughout the day
#1
Is it possible to send diffrent values from a 1bit signal compared to the time of day? 
Reply
#2
Hi,

Yes that is possible, but can you describe your task in more detail?

BR,

Erwin
Reply
#3
(10.06.2018, 20:13)Erwin van der Zwart Wrote: Hi,

Yes that is possible, but can you describe your task in more detail?

BR,

Erwin


Event based script that sends a value between for example 08-13 another value between 13-14 and so on.


Also needs a script that does the same automatically, but that I can start/stop via a bit value or a scene value.
Reply
#4
Hi,

Try this:
Code:
now = os.date('*t')
if now.hour >= 8 and now.hour < 13 then
   grp.write('1/1/1', true)
elseif now.hour >= 13 and now.hour < 14 then
   grp.write('1/1/1', false)
end
For enable/disable script above from 1 bit use this: (sample is assuming event script script above is called 'timebasedevent')
Code:
if event.getvalue() == true then
  script.enable('timebasedevent')
else
  script.disable('timebasedevent')
end
BR,

Erwin
Reply
#5
(11.06.2018, 21:59)Erwin van der Zwart Wrote: Hi,

Try this:
Code:
now = os.date('*t')
if now.hour >= 8 and now.hour < 13 then
   grp.write('1/1/1', true)
elseif now.hour >= 13 and now.hour < 14 then
   grp.write('1/1/1', false)
end
For enable/disable script above from 1 bit use this: (sample is assuming event script script above is called 'timebasedevent')
Code:
if event.getvalue() == true then
  script.enable('timebasedevent')
else
  script.disable('timebasedevent')
end
BR,

Erwin

Thank you .
Reply
#6
(11.06.2018, 21:59)Erwin van der Zwart Wrote: Hi,

Try this:
Code:
now = os.date('*t')
if now.hour >= 8 and now.hour < 13 then
   grp.write('1/1/1', true)
elseif now.hour >= 13 and now.hour < 14 then
   grp.write('1/1/1', false)
end
For enable/disable script above from 1 bit use this: (sample is assuming event script script above is called 'timebasedevent')
Code:
if event.getvalue() == true then
  script.enable('timebasedevent')
else
  script.disable('timebasedevent')
end
BR,

Erwin
The first code. Can we do different things with a true value and a false value?
Reply
#7
Hi,

We can do whatever you like to do with script, but can you specify your question better?

BR,

Erwin
Reply
#8
(17.06.2018, 10:59)Erwin van der Zwart Wrote: Hi,

We can do whatever you like to do with script, but can you specify your question better?

BR,

Erwin

Sounds good.
Event based script that sends a value between for example 08-13 another value between 13-14 and so on.
Sends different values with a 1bit true/false
Reply
#9
Hi,

That is already in the sample i gave you (:

BR,

Erwin
Reply
#10
(18.06.2018, 09:54)Erwin van der Zwart Wrote: Hi,

That is already in the sample i gave you (:

BR,

Erwin

Sorry my fault.
Reply
#11
I want almost do the same.

I want just active the light, only between 5.30 am and 10 am.
my question is, is it also possible to do it with hours and minutes?
i m sure it is, but im just a beginner, who will convert my Gira Homeserver to the LM.
Reply
#12
(05.04.2021, 10:03)Dré Wrote: I want almost do the same.

I want just active the light, only between 5.30 am and 10 am.
my question is, is it also possible to do it with hours and minutes?
i m sure it is, but im just a beginner, who will convert my Gira Homeserver to the LM.

did you try the schedule?
Best Regards,
Reply
#13
(05.04.2021, 14:00)khalil Wrote:
(05.04.2021, 10:03)Dré Wrote: I want almost do the same.

I want just active the light, only between 5.30 am and 10 am.
my question is, is it also possible to do it with hours and minutes?
i m sure it is, but im just a beginner, who will convert my Gira Homeserver to the LM.

did you try the schedule?

I hope not to use the schedule this time, i want to use the script, for making it happened.
Reply
#14
You can convert current time to a number of minutes passed since 0:00 and use it in your calculations. Use this example to check if current time is between 5:30 and 10:00
Code:
function tominutes(h, m)
  return h * 60 + m
end

now = os.date('*t')
mins = tominutes(now.hour, now.min)

if mins >= tominutes(5, 30) and mins <= tominutes(10, 0) then
  -- do something here
end
Reply
#15
Thank you admin, i wasn't able to try it, but it works fine so far.
Reply
#16
(16.06.2018, 17:57)benthoma Wrote:
(11.06.2018, 21:59)Erwin van der Zwart Wrote: Hi,

Try this:
Code:
now = os.date('*t')
if now.hour >= 8 and now.hour < 13 then
   grp.write('1/1/1', true)
elseif now.hour >= 13 and now.hour < 14 then
   grp.write('1/1/1', false)
end
For enable/disable script above from 1 bit use this: (sample is assuming event script script above is called 'timebasedevent')
Code:
if event.getvalue() == true then
  script.enable('timebasedevent')
else
  script.disable('timebasedevent')
end
BR,

Erwin
The first code. Can we do different things with a true value and a false value?


Hi ! i tried the first script, saved and enabled but it seem the object value given not changing. Tried to change value as hours follow the current timing, object value also no changed. Do i have to set the script run and check everytime (this wat i read throught out the search regard scripting)


this what in my script

now = os.date('*t')
if now.hour >= 8 and now.hour < 13 then
   grp.write('0/0/100', true)
elseif now.hour >= 13 and now.hour < 14 then
   grp.write('0/0/100', false)
end
Reply
#17
What script type are you using for this? Have you considered using schedulers instead?
Reply
#18
(12.06.2021, 07:51)admin Wrote: What script type are you using for this? Have you considered using schedulers instead?

Hi ! Thank you for your advise. I also found the schedule app is more convenient to set on off for the object.  Smile. I got it going
Reply
#19
Hi all, I see this is an older tread, but i will give it a shot.

I would like to put my light at some places from the motion sensor at day full light and night dimmed. At the motion sensor ( Basalte aura ) i can chose there control day = 1 and night is 0

I tried the script and schedulers as mentioned above, but non of them will change my status. I'm a bit new in to KNX and scripting.

now = os.date('*t')
if now.hour >= 7 and now.hour < 22 then
grp.write('10/0/3', true)
elseif now.hour >= 22 and now.hour < 7 then
grp.write('10/0/3', false)
end
Reply
#20
elseif now.hour >= 22 and now.hour < 7 then…

This is impossible, a value can never be greater as 22 AND at the same time lower as 7 (:

Use: elseif now.hour >= 22 or now.hour < 7 then
Reply


Forum Jump: