![]() |
|
If/Then Programming example - Printable Version +- Comfort Automation/ Security System Forums (https://www.comfortforums.com) +-- Forum: Support (https://www.comfortforums.com/forum-2.html) +--- Forum: Questions on Programming Comfort (https://www.comfortforums.com/forum-83.html) +--- Thread: If/Then Programming example (/thread-590.html) |
- ident - 05-05-2007 This example shows how to do X from 6 AM to 11 PM and do Y at other times If Hours < 6 Then Do Y [Y] Else If Hours < 23 Then Do X [X] Else Do Y [Y] End If End If It needs to be programmed this way because Comfigurator is not able to do the following IF (condition 1) AND (condition 2) THEN or IF (condition 1) OR (condition 2) THEN - BMagalhaes - 03-31-2008 Hi, So does it mean that a response such as follows will not work? If Flag ILcozinhaFrt <> 0 Then If Input SC_LUZ_CZ_FRENTE = 0 Then Do ILcozinhaFrt_On [] Do ILcozinhaFrt_Off [] After 300 Seconds Using IL_COZINHA_Frt Else Do ILcozinhaFrt_Off [] After 300 Seconds Using IL_COZINHA_Frt End If End If Tks, Bruno - admin - 03-31-2008 It will work. Any valid programming statement done with Response wizard will work My point is that the OR statement is not possible current;y, if so it would make things simpler - HenleyBranch - 09-15-2011 Hi, I am wondering if anyond can help me with an if/then query? I would like to turn on lights in hallway house once my comfort is disarmed. However I would only like it to do this at night, or more precisely I would like it to do this 60 minutes before sunset until 60 minutes after sunrise. I am a newbie and am getting the hang of programming, I have set the sunrise and sunset for my location using Comfigurator, I have found the night time parameter, but am not sure how to go the next step - is there a way? Many thanks for any help. - wexfordman - 09-16-2011 My 2c worth, is create a number of different responses, rather than try and do it all in one response:- First, create flags:- 1) Hall Light Flag 2) Sunset Flag And timer, Hall Light Timer (if you want the light to turn off after a period) Second, create responses:- 1) Hall Light on response does the following:- If hall light flag is off Turn Hall light flag on Set hall light flag to on Starts timer (hall light timer if you want to turn the light off after a while) Else: Start timer hall light The above response is if you want the light to also turn off after a certain period. If the hall light is already on (flag is on), then all it does is reset the countdown timer, but if the flag is off, it turns on the light and starts the timer. A second response is then needed to trun off the hall light as follows:- 2) Hall Light Off hall light off response Turns hall ligh off Sets hall light flag to off 3) For the timer you set up, have it run the Hall light off response when the timer expires Now for the activation on security off if its nighttime Create a response called \"Home time\" for example as follows:- If flag sunset is on Then:- Do response Hall light on End Last step then is to have the security off response point to your \"home time\" response. The advantage of doing it this way, is that as you start wanting the house to do more on arriving home, al you need to do is create the responses, and then add them to the \"Home time\" response. Hope this makes some level of sense, this is how I have my comfort system operating my x10 lights. If you want I can copy the repsonses from my fonfig file and paste them later when I get home! - HenleyBranch - 09-16-2011 Thank you for such a comprehensive response. Really very helpful. I am going to give that a go. Good suggestions, all my lights are X10. If you could paste your code that would be marvellous. I haven\'t made any flags as yet so this will be an interesting lesson. I am presuming that I can code the flag to be either side of the actual sunset sunrise - I am trying to overcome the issue of twilight. Thank you - wexfordman - 09-16-2011 I would suggest starting off creating a flag and a timer for every element you have, so every x10 device etc should have a flag and a timer! - ident - 09-17-2011 There is also an action Sunrise/Sunset Time Offset which can offset the sunrise or sunset time by a number of minutes This wil change the time at which sunrise or sunset Responses are activated so you can for example cause lights to be turned on before sunset and to be turned of after sunrise However the automatic Night Time flag which is turned on between sunrise and sunset time is unchanged. You can test the Night Time Flag in an If condition without having to set or clear a flag manually - HenleyBranch - 10-06-2011 Thanks Is the sunrise / sunset offset set within the individual response, or is it a global setting? I don\'t suppose you can refer me to any example code featuring this offset could you? I am still picking this up. Wexfordman - I have made all my timers and flags and am having fun! - slychiu - 10-07-2011 The sunrise and sunset offset action causes the sunrise or sunset times to be offset by -128 to + 127 minutes from the programmed value. This allows you to, for example, turn on lights 30 minutes before sunset and/or 10 minutes after sunrise ![]() ![]() In the above example the sunrise time has been offset by + 30 minutes, which means the Sunrise Response will be activated at Sunrise + 30 minutes Offset Sunset time is done the same way You create a Response with the action to offset the sunrise and/or sunset times. Then you need to activate the Response using an event for example in Time programs. This action remains in place until changed again by another sunrise/sunset offset action or until Comfort is reset Note that this does not change the Night Time Flag which is automatically set between sunrise and sunset. It only changes the activation time of Sunrise or Sunset Responses |