Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Scheduling scenes. The missing %% time trigger...


jgab
 Share

Recommended Posts

Hello jcab,

i use your work since many months. It work's very well.
Now, at first january at the new year, the scene is restarting at midnight and hangs up.
After stop and run command the function ist for the day without issues.

I use the version 2.3 B2 10.10.2019.

Any other with the same effect?

Link to comment
Share on other sites

  • Topic Author
  • 1 hour ago, Speedo67 said:

    Hello jcab,

    i use your work since many months. It work's very well.
    Now, at first january at the new year, the scene is restarting at midnight and hangs up.
    After stop and run command the function ist for the day without issues.

    I use the version 2.3 B2 10.10.2019.

    Any other with the same effect?

    I'm currently not running it as I have moved to HC3. However, it can have been something to do with timers spanning the year... If it works now, let's hope it works another year :-)

    Link to comment
    Share on other sites

    Hello Jgab,

    thank you for your answer.

    It runs for a couple of days, and then the same issue (restart at midnight).

    I'm not a newbee, but also not a professional. If you have a idea from where the error may cam - it will be great.

    Thank you in advance. 

    Link to comment
    Share on other sites

    • 4 months later...

    Hei Jgab,  i have been following your posts for a few years now and would like to thank you for all of your contributions and invaluable help with all things fibaro and lua.

    I wonder if you could point me in the right direction with my question.

    I have a scene running (LUAScheduler for HC2 v1.1.5) that schedules actions for all of my outside lights. The problem is when we now enter summertime and sunset time is changing daily.

    Basically the set up is this:

    All outside lights come on at sunset:

    Some outside lights dimm to 50% one hour after sunset:

    Some outside lights dimm to 30% two hours after sunset:

    Some outside lights (kids rooms) turn off at 21.30:

    Outside lights for paths turn off 22.30 - or 23.00 on weekends:

    Outside lights garage turn off 23.00- or 23.30 on weekends.

     

    Obviously this works fine during the winter, when sunset time was 14.00- 15.00.

    The problem is when sunset time changes during the summer months.

     

    I am trying to figure out how to "map" these settings to adjust to new sunset time, and drop some dimming times and turn off some outside lights irrespective of sunset time.

    Yesterday sunset time was 22.15 and my scene missed the timing and left several lights on.

    Could you recommend a scene that might help me with this problem? Not sure if %%time is the way to go ?

     I really appreciated any assistance.

    Thanking you in advance.

     


     

    Link to comment
    Share on other sites

  • Topic Author
  • Posted (edited)
    1 hour ago, MARCUSP.I.L said:

    I am trying to figure out how to "map" these settings to adjust to new sunset time, and drop some dimming times and turn off some outside lights irrespective of sunset time.

    Yesterday sunset time was 22.15 and my scene missed the timing and left several lights on.

    Could you recommend a scene that might help me with this problem? Not sure if %%time is the way to go ?

     I really appreciated any assistance.

    Thanking you in advance.

     


     

    %% time is probably not the right tool.

     

    I would recommend (of course. :-) ) my own framework EventRunner.

    I moved on the the HC3 but the version for HC2 still works and is used by people.

    Note that EventRunner3 is for HC2 and EventRunner4 is for HC3.

    The rules for you would look something like below.

    I'm a bit unsure what the 'some lights that are being dimmed' are, so I made my own interpretation.

    I guess your problem is that you dim lights 2 hours after they turn on even if the turn off rule has turned them off at 22:30 or so.

    In the rule below we only dim the lights off they are on.

    Please login or register to see this code.

    I include the complete scene with rules also.

    Please login or register to see this attachment.

    You can also run this in an emulator on your PC to test the rules (run faster then realtime to see that they fire at the right hours, etc)

     

    Edited by jgab
    Link to comment
    Share on other sites

    Så bra!. Thanking you for your quick reply , and for taking time to assist.

    You have understood my problem exactly. I will start with your suggestions today and can give you a quick nod when i have it up and running. Fantastic.

    I have followed your post on event runner but was never sure if i needed it. I will no doubt learn alot and make other changes to my set up. Thank you again for taking time to reply to my query.

    Mvh

    Link to comment
    Share on other sites

    @MARCUSP.I.L, You will not regret!

    I am using ER3 and ER4 and since than I am a happy camper?

    Succes,

    //Sjakie

     

    Link to comment
    Share on other sites

  • Topic Author
  • 5 minutes ago, MARCUSP.I.L said:

    Så bra!. Thanking you for your quick reply , and for taking time to assist.

    You have understood my problem exactly. I will start with your suggestions today and can give you a quick nod when i have it up and running. Fantastic.

    I have followed your post on event runner but was never sure if i needed it. I will no doubt learn alot and make other changes to my set up. Thank you again for taking time to reply to my query.

    Mvh

    So the eventrunner. scene consists of a lot of code. (ER3 ~2500 lines of code).

    However,  the philosophy is that the rules should be simple to express in a compact, declarative fashion.

    There are a lot more features to create more powerful rules so let me know if you can think of more use cases,.

    Ex. triggering on sensors etc are easy to express, as is to do something if a conditions has been true for a specific time. 

    Link to comment
    Share on other sites

    Thank you jgab - sjakie, working on this now. have been following your discussions about eventrunner 3  here on the forum in 2020.  I look forward to improving my setup and increasing response times etc. thanks again, will get back to you after i have experimented. takker

    Link to comment
    Share on other sites

    Posted (edited)

    Working with eventrunner 3 now and am having a hard time coming to grips with this new approach. 

     

     

    I am starting from 0 so please excuse my lack of experience.

     

    * Do i use day or wday?

    * How do i change a global variable?

    * Can i use jHomeTable , fex (jT["Kjøkken"]["StikkontaktKjøkken"]) ?

     

    I have installed zbs and followed your previous instructions, all working.

     

    I have started with a very basic scene that triggers lights depending on sunset + various timers after sunset and wish to change a global variable that stops my outside lights from turning on during the day. Not working, so i tried a very simple turn on at certain time. Only works if i use wday, not day. 

    Please dont despair when you see this scene, i really am staring from 0 :)

    I have entered some rules that are not used in the scene, i wish to use later after i have more experience.

    When i run the scene i get ok in debug so i assume the format in text is correct ? 

    I wonder if you might point me in the right direction , if you find the time ? 

     

    I am thankful for any assistance and hope to slowly work my way into this.

     

    Please login or register to see this spoiler.

     

    Edited by MARCUSP.I.L
    Link to comment
    Share on other sites

  • Topic Author
  • On 5/27/2021 at 11:44 PM, MARCUSP.I.L said:

    Working with eventrunner 3 now and am having a hard time coming to grips with this new approach. 

     

     

    I am starting from 0 so please excuse my lack of experience.

     

    * Do i use day or wday?

    day() is a function that tests day number. Besides day number it can also use 'last' that is the last date in the current month and lastw that is the last-6 days.

    rule("@sunset & day('1') => log('Sunset first day of month')")

    rule("@sunset & day('1-7') =>  log('Sunset first week of month')")

    rule("@sunset & day('last') => log(Sunset last day of month')")

    rule("@sunset & day('lastw') => log('Sunset first day of last week of month')")
    rule("@sunset & day('lastw-last') => log('Sunset last week of month')")

     

    wday() is similar but with days of week instead

    rule("@sunseet & day('mon-fri') => log('Working day!')")

    rule("@sunseet & day('sat-sun') => log('Weekend!')")

     

    On 5/27/2021 at 11:44 PM, MARCUSP.I.L said:

    * How do i change a global variable?

    Global variables are referred to using a '$' sign as a prefix of their name.

    If you have a fibaro global named 'TimeOfDay' you can

    rule("sensor:breached & $TimeOfDay == 'Night' => log('Alarm')")

    rule("@sunset => $TimeOfDay = 'Evening'; log('Setting ToD to evening')")

     

    On 5/27/2021 at 11:44 PM, MARCUSP.I.L said:

    * Can i use jHomeTable , fex (jT["Kjøkken"]["StikkontaktKjøkken"]) ?

     

    Yes,

      Util.defvars(jT)
      Util.reverseMapDef(jT)

     

    rule("@sunset => Kjøkken.StikkontaktKjøkken:off")

     

    On 5/27/2021 at 11:44 PM, MARCUSP.I.L said:

     

    I have installed zbs and followed your previous instructions, all working.

     

    I have started with a very basic scene that triggers lights depending on sunset + various timers after sunset and wish to change a global variable that stops my outside lights from turning on during the day. Not working, so i tried a very simple turn on at certain time. Only works if i use wday, not day. 

    Please dont despair when you see this scene, i really am staring from 0 :)

    I have entered some rules that are not used in the scene, i wish to use later after i have more experience.

    When i run the scene i get ok in debug so i assume the format in text is correct ? 

    I wonder if you might point me in the right direction , if you find the time ? 

     

    I am thankful for any assistance and hope to slowly work my way into this.

     

    Please login or register to see this spoiler.

     

    Yes, assignment to Utelys should use '='

    If you have a sensor that triggers the lights to go on you can do

    rule("sensor:breached & $Utelys==1 => uterus:on")

     

    The wday() is for day names as you have used. Note that wday('mon','tue','wed','sun') can be written wday('mon-wed,sun')

    so sequences of days can be defined with '-'.

     

     

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

    Just saw your reply now. Thank you for taking the time to answer my query and for explaining  in great detail the various functions applicable to each rule. 

    I understand the set up much better now and am learning a lot just experimenting. I have been reading your thread on ev3 and really am amazed at the finesse involved in your program, i look forward  to making major changes on my previous scenes. What do you recommend for scene management, i mean, how many scenes should one have on average? One for lights, one for alarms etc etc..?

    I thank you once again for your invaluable assistance and for your brilliant Eventrunner 3. 

    Link to comment
    Share on other sites

  • Topic Author
  • 6 hours ago, MARCUSP.I.L said:

    Just saw your reply now. Thank you for taking the time to answer my query and for explaining  in great detail the various functions applicable to each rule. 

    I understand the set up much better now and am learning a lot just experimenting. I have been reading your thread on ev3 and really am amazed at the finesse involved in your program, i look forward  to making major changes on my previous scenes. What do you recommend for scene management, i mean, how many scenes should one have on average? One for lights, one for alarms etc etc..?

    I thank you once again for your invaluable assistance and for your brilliant Eventrunner 3. 

    I have 2 now. One for the lightning and one for other stuff like presence (simpel alarm) etc.

    I also have 1 for testing/experiments.

    Scenes can easily communicate by sending events between them. 

    Link to comment
    Share on other sites

    Thank you for your reply, i will work with various ideas in the coming days and read more of your thread. Thanking you for your advice and experience.

    Link to comment
    Share on other sites

  • Topic Author
  • 2 hours ago, MARCUSP.I.L said:

    Thank you for your reply, i will work with various ideas in the coming days and read more of your thread. Thanking you for your advice and experience.

    You are welcome. And lets continue the discussion in the ER thread, as other ER users can learn from your questions. 👍

     

     

    Link to comment
    Share on other sites

    • 2 months later...

    I'm using the 2.3B version for quite some time now, and now i'm struggling to get something going.

     

    What i want to do is run a function on the even (00,02,04,06 etc) minutes between 15.00 and 21.00 hours, and a another function on the uneven minutes (01,03,05,07 etc.)

     

    So i thought this would work:

     

    +00:02 alldays 15:00..21:00  electrolyse_check_uit
    +00:02 alldays 15:01..21:00  zandfilterpomp_uit

     

    The first function wil start op 15.00 hours and run every two minutes (00,02,04,06 etc.)

    And the second function wil start a minut later on 15.01 and wil also run every two minutes, hoping it would run on every uneven minute in the hour (01,03,05,07 etc)

     

    The reason for this, is because i have an electrolyses unit for the swimming pool, but it won't work if the pump is shut of, and will beep to let me know it there is now water flow. So thats why i have a two functions with a minute in between them.

    First function is to check if the unit is drawing power and if not, power it off. And the second function will turn off the pump if the electrolyses unit is also turned off.

     

    But i was trying this, but i noticed it wasn't working.

     

    On 15.00 hours the first function starts, but after the interval has passed, no scene trigger occurs. The second function is never triggered.

     

    So i removed the second function trigger from the scene and the first trigger was starting working, and also with intervals.

    I then put back the second trigger and it stopped working again after the first trigger, and not intervals after that.

     

    I then configure both triggers on the same starting time:

     

    +00:02 alldays 15:00..21:00  electrolyse_check_uit
    +00:02 alldays 15:00..21:00  zandfilterpomp_uit

     

    But now nothing is triggered, both functions are not triggered.

     

    What am i doing wrong ?

     

    Has this maybe something to do with with version 4.620 ?

     

    Kind regards!

     

    Link to comment
    Share on other sites

  • Topic Author
  • 9 hours ago, Circumflex_sigma said:

    What i want to do is run a function on the even (00,02,04,06 etc) minutes between 15.00 and 21.00 hours, and a another function on the uneven minutes (01,03,05,07 etc.)

     

    So i thought this would work:

     

    +00:02 alldays 15:00..21:00  electrolyse_check_uit
    +00:02 alldays 15:01..21:00  zandfilterpomp_uit

     

    The first function wil start op 15.00 hours and run every two minutes (00,02,04,06 etc.)

    And the second function wil start a minut later on 15.01 and wil also run every two minutes, hoping it would run on every uneven minute in the hour (01,03,05,07 etc)

     

    Unfortunately, +00:02 will run on every even minute. The 15:01..21:00 is just a filter that will let through 15:02 as the first value.

    Unfortunately, there is no way to select an odd start minute.

    What I would do is to keep the first timer (on even minutes) and in that action schedule something to do one minute later.

    Ex.

    function electrolyse_check_uit() -- action called from first timer

       ....

       setTimeout(function() zandfilterpomp_uit() end,1000*60) -- run zandfilterpomp_uit action one minute later

    end

     

    function zandfilterpomp_uit()

      ....

    end

    Link to comment
    Share on other sites

    8 hours ago, jgab said:

     

    Unfortunately, +00:02 will run on every even minute. The 15:01..21:00 is just a filter that will let through 15:02 as the first value.

    Unfortunately, there is no way to select an odd start minute.

    What I would do is to keep the first timer (on even minutes) and in that action schedule something to do one minute later.

    Ex.

    function electrolyse_check_uit() -- action called from first timer

       ....

       setTimeout(function() zandfilterpomp_uit() end,1000*60) -- run zandfilterpomp_uit action one minute later

    end

     

    function zandfilterpomp_uit()

      ....

    end

     

    Ah that's clear then. Your suggestion works perfectly and solves my issue :) thanks again!

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

     Share

    ×
    ×
    • Create New...