dlibby00 Posted February 6, 2016 Posted February 6, 2016 I've just installed a bunch of GE Z-Wave dimmers on all my exterior lights: http://www.amazon.com/gp/product/B0035YRCR2?keywords=z%20wave&qid=1454727730&ref_=sr_1_1&sr=8-1&srs=13584212011 What I would like to do is have them come on in a series of say 60 steps between 30 minutes before and 30 minutes after sunset. Similarly I'd like to have them turn off in a series of say 60 steps between 30 minutes before and 30 minutes after sunrise.Now of course I could do this by implementing 60 programs that trigger between -30 and +30 minutes of sunrise and sunset, but that's obviously gross.Thankfully, I just discovered today that there exist a couple of pyhton APIs: ISY Python LIbrary PyISY This leads to a couple of questions: 1) Does there exist something in the "native" ISY console that would make this task less gross than what I've described? 2) What is the status of these python libraries? Are they actively developed? Are they roughly equivalent in features? 3) Should I develop something like the progressive dim i proposed, would it be possible to get that triggered (using the sunrise\sunset variables) from the "native" ISY development environment?Thanks!
jerlands Posted February 6, 2016 Posted February 6, 2016 Here's a program that performs a gradual light change... I got the idea and code from larryllix's post on this thread.. It uses the new "While" command found in 5.0.2 and I'm uncertain if available in the new 4.4.3 or not.. Gradual Light Change - [ID 0010][Parent 00CC][Not Enabled] If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Set 'Light Master Bathroom Vanity' Fast Off $s.DayLightHours = 1 Repeat While $s.DayLightHours <= 30 Set 'Light Master Bathroom Vanity' On '$s.DayLightHours %' Wait 1 second $s.DayLightHours += 1 Repeat 1 times Repeat While $s.DayLightHours <= 100 Set 'Light Master Bathroom Vanity' On '$s.DayLightHours %' Wait 1 second $s.DayLightHours += 3 Repeat 1 times Else - No Actions - (To add one, press 'Action') Jon...
larryllix01 Posted February 6, 2016 Posted February 6, 2016 (edited) You should be able to do the same thing without the v5 repeat while construct. In X10 I did it by calling itself with a recursive program that detects the level hitting 100% or 0% and then aborts. I am not sure how you would do this with ISY as I am not close to one right now. I am also not sure what ISY would do if you overrun the subroutine return stack. Edited February 6, 2016 by larryllix01
jerlands Posted February 6, 2016 Posted February 6, 2016 You should be able to do the same thing without the v5 repeat while construct. In X10 I did it by calling itself with a recursive program that detects the level hitting 100% or 0% and then aborts. I am not sure how you would do this with ISY as I am not close to one right now. I am also not sure what ISY would do if you overrun the subroutine return stack. That disguise won't work.. will the real larryllix please stand up Jon...
larryllix01 Posted February 6, 2016 Posted February 6, 2016 Yeah. I just noticed that and I can't figure out why or how that could happen.
larryllix Posted February 6, 2016 Posted February 6, 2016 Just signed out and back in to Tapatalk. Let's see but I don't know how i could sign in to a user account that was never created.
dlibby00 Posted February 6, 2016 Author Posted February 6, 2016 Here's a program that performs a gradual light change... I got the idea and code from larryllix's post on this thread.. It uses the new "While" command found in 5.0.2 and I'm uncertain if available in the new 4.4.3 or not.. Gradual Light Change - [ID 0010][Parent 00CC][Not Enabled] If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Set 'Light Master Bathroom Vanity' Fast Off $s.DayLightHours = 1 Repeat While $s.DayLightHours <= 30 Set 'Light Master Bathroom Vanity' On '$s.DayLightHours %' Wait 1 second $s.DayLightHours += 1 Repeat 1 times Repeat While $s.DayLightHours <= 100 Set 'Light Master Bathroom Vanity' On '$s.DayLightHours %' Wait 1 second $s.DayLightHours += 3 Repeat 1 times Else - No Actions - (To add one, press 'Action') Jon... Thanks for the code! I'll look into that approach. Though I still find the idea of just writing Python code intriguing. The problem with 5.02 (if the while command is only available there) is that its beta software?
larryllix Posted February 6, 2016 Posted February 6, 2016 Yes. Very stable but lots of gui stuff incomplete.
jerlands Posted February 6, 2016 Posted February 6, 2016 Just signed out and back in to Tapatalk. Let's see but I don't know how i could sign in to a user account that was never created. Much better Jon... Thanks for the code! I'll look into that approach. Though I still find the idea of just writing Python code intriguing. The problem with 5.02 (if the while command is only available there) is that its beta software? Keep your eyes open.. 5.0.3 should be out shortly. Jon...
KeviNH Posted February 6, 2016 Posted February 6, 2016 (edited) Keep your eyes open.. 5.0.3 should be out shortly. That's what i'm waiting for to even consider making the jump to V5. Considering that my ISY does things like keep pets fed, I generally don't run beta code. I've just installed a bunch of GE Z-Wave dimmers on all my exterior lights: http://www.amazon.com/gp/product/B0035YRCR2?keywords=z%20wave&qid=1454727730&ref_=sr_1_1&sr=8-1&srs=13584212011 What I would like to do is have them come on in a series of say 60 steps between 30 minutes before and 30 minutes after sunset. Similarly I'd like to have them turn off in a series of say 60 steps between 30 minutes before and 30 minutes after sunrise. If you just want them to end up full-on or full-off, why get fancy? Almost Sunset If Time Is Sunset - 30 minutes Then Run Program 'Fade Up Exterior' (Then Path) Fade Up Exterior If (NO CONDITION) Then Set 'ZwaveExteriorDimmer' 1% Repeat 50 times Set 'ZwaveExteriorDimmer' Brighten Wait 36 seconds, The above is primitive, works in 4.x.x , and compatible with just about any dimmer, Insteon or Zwave, as long as "Brighten" just steps up 1 level. Many of these Z-Wave dimmers have built-in fade-up and fade-down functionality, you just need to set the appropriate parameters. I think the slowest supported fade would be P7=99 and P8=255, taking about 5 minutes to execute. Edited February 6, 2016 by KeviNH
larryllix Posted February 6, 2016 Posted February 6, 2016 That's what i'm waiting for to even consider making the jump to V5. Considering that my ISY does things like keep pets fed, I generally don't run beta code. If you just want them to end up full-on or full-off, why get fancy? Almost Sunset If Time Is Sunset - 30 minutes Then Run Program 'Fade Up Exterior' (Then Path) Fade Up Exterior If (NO CONDITION) Then Set 'ZwaveExteriorDimmer' 1% Repeat 50 times Set 'ZwaveExteriorDimmer' Brighten Wait 36 seconds, The above is primitive, works in 4.x.x , and compatible with just about any dimmer, Insteon or Zwave, as long as "Brighten" just steps up 1 level. Many of these Z-Wave dimmers have built-in fade-up and fade-down functionality, you just need to set the appropriate parameters. I think the slowest supported fade would be P7=99 and P8=255, taking about 5 minutes to execute. 5.0.3 will be beta also. There will be a long road before a RC version will be out. OTOH after running v5.0.1 and v5.0.2 I would have no problem relying on either version for serious applications. Any problems I have seen were just gui and very minor.
dlibby00 Posted February 9, 2016 Author Posted February 9, 2016 That's what i'm waiting for to even consider making the jump to V5. Considering that my ISY does things like keep pets fed, I generally don't run beta code. If you just want them to end up full-on or full-off, why get fancy? Almost Sunset If Time Is Sunset - 30 minutes Then Run Program 'Fade Up Exterior' (Then Path) Fade Up Exterior If (NO CONDITION) Then Set 'ZwaveExteriorDimmer' 1% Repeat 50 times Set 'ZwaveExteriorDimmer' Brighten Wait 36 seconds, The above is primitive, works in 4.x.x , and compatible with just about any dimmer, Insteon or Zwave, as long as "Brighten" just steps up 1 level. Many of these Z-Wave dimmers have built-in fade-up and fade-down functionality, you just need to set the appropriate parameters. I think the slowest supported fade would be P7=99 and P8=255, taking about 5 minutes to execute. I was thinking of something like this, thanks. Unfortunately brighten on my dimmer brightens not by one, but by 6%. So, if I wanted to brighten in 1% increments I assume I will need to use a variable. What are the advantages (if any) of defining 'Fade Up Exterior' as its own program and not just define the commands directly in the 'Almost Sunset' then block? Also, what is the threading model of the ISY? If I'm in the middle of running Fade Up Exterior will other triggers continue to be evaluated and executed?
larryllix Posted February 9, 2016 Posted February 9, 2016 I was thinking of something like this, thanks. Unfortunately brighten on my dimmer brightens not by one, but by 6%. So, if I wanted to brighten in 1% increments I assume I will need to use a variable. What are the advantages (if any) of defining 'Fade Up Exterior' as its own program and not just define the commands directly in the 'Almost Sunset' then block? Also, what is the threading model of the ISY? If I'm in the middle of running Fade Up Exterior will other triggers continue to be evaluated and executed? Yup. Just as long as you have a Wait or Repeat line in there it hands the control back to the ISY engine to be productive while the time is being not-wasted.
dlibby00 Posted February 9, 2016 Author Posted February 9, 2016 One more dumb question. I've set up an OutsideDimmerValue variable. However I can't find any way in the GUI (4.3.26) to set the value of my dimmer to the value of OutsideDimmerValue.To be honest I think I'd rather just enter these programs free form. Is that a possibility?
larryllix Posted February 9, 2016 Posted February 9, 2016 (edited) One more dumb question. I've set up an OutsideDimmerValue variable. However I can't find any way in the GUI (4.3.26) to set the value of my dimmer to the value of OutsideDimmerValue. To be honest I think I'd rather just enter these programs free form. Is that a possibility? Not sure what "free-form" means but from my guess the answer is "No". ISY only accepts menu edited/written code. This is pretty standard for small controllers without debuggers or syntax checkers for interpreted code. If a syntax error was found who would it tell? Would you want your ISY to just stop/hang until you checked it next weekend? I don't believe 4.2.x supports setting to a variable based level. You will need v5.0.2. When v5.0.3 comes out it will be a drop in without much hassle. I have run v5.0.2 since it came out (a few months) and I doubt you will find a bug in it for the first 4-5 months of usage. If you can write free-form code then you can handle v5.0.2 with it's few GUI things not completed. Set your bulb ramp at 8 minutes and use the 3% jumps. You will never see it. Edited February 9, 2016 by larryllix
KeviNH Posted February 10, 2016 Posted February 10, 2016 What are the advantages (if any) of defining 'Fade Up Exterior' as its own program and not just define the commands directly in the 'Almost Sunset' then block? There are advantages to defining a separate program with no conditions, and calling it using "RunThen" from another program. For one, a program with "Wait" statements inside results in the "If" conditions being re-evaluated after every wait ends; if the "If" statement is false when re-evaluated, the program terminates early. This is one of the little idiosyncrasies of ISY programming that takes a while to learn and get used to working around. As a programmer, it helps to think of the ISY as sort of a big state machine.
larryllix Posted February 10, 2016 Posted February 10, 2016 ..... What are the advantages (if any) of defining 'Fade Up Exterior' as its own program and not just define the commands directly in the 'Almost Sunset' then block? .... In this case (below)....none. Almost Sunset If Time Is Sunset - 30 minutes Then Run Program 'Fade Up Exterior' (Then Path) Fade Up Exterior If (NO CONDITION) Then Set 'ZwaveExteriorDimmer' 1% Repeat 50 times Set 'ZwaveExteriorDimmer' Brighten Wait 36 seconds, Else ----- However, -if there are conditions in the second program that are not wanted as triggers -if there are multiple conditions that result in more than two code path options. -if the first trigger could become false and it not be desirable to stop running the True block Almost Sunset If From Sunset - 30 minutes To Sunrise+30 minutes (next day) <------this will run else and stop Then Block Then Run Program 'Fade Up Exterior' (If) <---more decisions to be made Else Sunrise code here <---- sunrise+30 stops Then block, Fade Up Exterior insulated Fade Up Exterior [disabled] <----triggers can't happen If Door is closed <----door opening cannot stop code running, decision is made once Then Set 'ZwaveExteriorDimmer' 1% Repeat 50 times Set 'ZwaveExteriorDimmer' Brighten Wait 36 seconds, Else Door is open code lines
dlibby00 Posted February 11, 2016 Author Posted February 11, 2016 Almost Sunset If Time Is Sunset - 30 minutes Then Run Program 'Fade Up Exterior' (Then Path) So once the 'Time Is Sunset - 30 minutes' trigger becomes true, there is no way for it to become false again say for example when time becomes not 'Sunset - 30 minutes' but 'Sunset - 29 minutes'?
dlibby00 Posted February 11, 2016 Author Posted February 11, 2016 Thanks for all the help.I'm not running anything mission critical here (just my exterior lights), so in order to get to the 1% increment solution (it's become a bit of a white whale for me) I'll probably just upgrade to 5.02.
jerlands Posted February 12, 2016 Posted February 12, 2016 Thanks for all the help. I'm not running anything mission critical here (just my exterior lights), so in order to get to the 1% increment solution (it's become a bit of a white whale for me) I'll probably just upgrade to 5.02. Depending on your version I might hold off on that till 5.0.3 is released. I think 4.x is more stable and 4.4.3 is the only version supporting the free version of network resources. Jon...
larryllix Posted February 12, 2016 Posted February 12, 2016 So once the 'Time Is Sunset - 30 minutes' trigger becomes true, there is no way for it to become false again say for example when time becomes not 'Sunset - 30 minutes' but 'Sunset - 29 minutes'? No. It can never trigger false. I look at triggers at though they are instigating something not really being true or false as an attention getter for the PLC engine. If they are true or false it is only for their own purposes. Nothing else can test the trigger and find it true, ever. However, If SwitchLinc is NOT switched 'On' ...will run the Else block when an On command is received.
dlibby00 Posted February 13, 2016 Author Posted February 13, 2016 Depending on your version I might hold off on that till 5.0.3 is released. I think 4.x is more stable and 4.4.3 is the only version supporting the free version of network resources. Jon... Is there an ETA on 5.03? Is it likely to be more stable than 5.02? So I ended up going with the "Repeat 20 Brighten" which mostly works fine. However occasionally one or more of my lights will end up at 99% and not 100% or 1% and not 0%. Is it possible that the brighten and dim functions on my dimmers: http://www.amazon.com/dp/B006LQFHN2/ref=twister_B017SOX4L2?_encoding=UTF8&psc=1 is non deterministic? That is to say is it completely random whether a dim executed by ZWave command actually dims by 2% or 3% for example?
larryllix Posted February 13, 2016 Posted February 13, 2016 Is there an ETA on 5.03? Is it likely to be more stable than 5.02? So I ended up going with the "Repeat 20 Brighten" which mostly works fine. However occasionally one or more of my lights will end up at 99% and not 100% or 1% and not 0%. Is it possible that the brighten and dim functions on my dimmers: http://www.amazon.com/dp/B006LQFHN2/ref=twister_B017SOX4L2?_encoding=UTF8&psc=1 is non deterministic? That is to say is it completely random whether a dim executed by ZWave command actually dims by 2% or 3% for example? V5.0.2 is absolutely stable as is all ISY firmware releases I have experienced or heard of. There are just some unfinished gui items and other minor things not completely working yet.
Recommended Posts