Rocketron Posted November 25, 2019 Posted November 25, 2019 At first blush I thought this would be an easy install and program but once I began attempting it I've hit a roadblock. The plan was to install a temperature sensor on the hot water pipe leading to the shower. From this input it would trigger the bathroom fan to start and stop. I got the hardware installed and working then began to think about how to program this. I've not found when searching the forum anything similar. The original idea was to trigger the fan on when the temp rose to above 25`C. It seems the temperature rises to a little over 50`C once all the system is hot. Then have the fan shutoff when the temp falls under 45`C. A simple program fails as the fan starts when above 25` then shuts down right away as it's below the 45`. My solution has been to have it start at 45` and shutdown under 45`. This works like a charm but does delay the fan starting for what seems like 1.5 minutes while the piping heats up. Suggestions for improvement to get the fan running sooner? What had come to my mind was having the ISY react to a temperature increase within a time period. Say a 5` increase within 10 seconds, keep the fan running until it detected a 5` decrease without any time delay. Sounds good but I've no idea how to program something such as this. Hoping someone can see the obvious thing I don't see.
larryllix Posted November 25, 2019 Posted November 25, 2019 11 minutes ago, Rocketron said: At first blush I thought this would be an easy install and program but once I began attempting it I've hit a roadblock. The plan was to install a temperature sensor on the hot water pipe leading to the shower. From this input it would trigger the bathroom fan to start and stop. I got the hardware installed and working then began to think about how to program this. I've not found when searching the forum anything similar. The original idea was to trigger the fan on when the temp rose to above 25`C. It seems the temperature rises to a little over 50`C once all the system is hot. Then have the fan shutoff when the temp falls under 45`C. A simple program fails as the fan starts when above 25` then shuts down right away as it's below the 45`. My solution has been to have it start at 45` and shutdown under 45`. This works like a charm but does delay the fan starting for what seems like 1.5 minutes while the piping heats up. Suggestions for improvement to get the fan running sooner? What had come to my mind was having the ISY react to a temperature increase within a time period. Say a 5` increase within 10 seconds, keep the fan running until it detected a 5` decrease without any time delay. Sounds good but I've no idea how to program something such as this. Hoping someone can see the obvious thing I don't see. What are you sensing the temperature with? Copy your program(s) to clipboard, and paste them here to see what you have attempted so far.
mwester Posted November 25, 2019 Posted November 25, 2019 Excellent use-case that illustrates the challenges of programming something that humans would find so easy to do! A human being given a thermometer and the task to turn the fan on and off as you describe would have no troubles with understanding what to do, and handling the exceptions (e.g. the water warms up to 30, and never gets any hotter, nor colder -- eventually the human would turn off the fan and go figure out what happened... but alas, you'll have to sort out that (and other) failure cases on your own with the IS). So, first thing to note is that as you've already described, the obvious choice (a range of temps to trigger the on/off) isn't going to work. So, start by re-thinking that a bit. What *really* triggers the on and the off, if it's not the absolute temperature? I'd investigate the idea that it's the *direction* of the change in temperature as it crosses those select absolute temperatures that might be useful: if the temp now is greater than 25, and 30 seconds ago it was less than 25, then we're on the way up, and the fan should be turned on... opposite for turning off. Next, I'd strongly suggest adding some timeouts just in case. How long is long enough for the fan? And perhaps an alarm -- if you have a spare button on a KPL, one might illuminate that if the fan has been running too long. As for implementation, there is some dissension on the forum... some might favor writing this in as few programs as possible, maybe using folder conditions to do so. I find that becomes inscrutable and difficult to debug, so I would simply create a folder for "Bathroom Auto Fan" or something like that, and add a bunch of programs to that. I'm sure that you'll have plenty of folks offering detailed programs, so I'll refrain from doing so... mine are a bit complex, since they include auto-off timers, alarm states, and the like (I use this technique for the roof-deicing cables, door entry/exit alarms, bird-bath heater control, sump pump monitor, etc.)
lilyoyo1 Posted November 25, 2019 Posted November 25, 2019 I'd separate this into 2 programs. 1 to turn on and 1 to turn off. The first to turn on is simply if water is => then set fan on The second would be to turn off. If temp is < than x degrees then wait 5 minutes set fan off. This will give the water time to heat up before the isy turns the fan off
apostolakisl Posted November 25, 2019 Posted November 25, 2019 (edited) You have to have your shut down program become active after the temp exceeds 45. In fact, you would want some hysteresis in there. Something like over 47. You would also need to disable the program that turns the fan on at 25. pgm 1) If temp above 25 then turn fan on disable pgm 1 pgm 2) If temp above 48 then enable pgm 3 pgm 3) If temp below 45 then turn fan off disable pgm 3 pgm 4) If temp below 23 then enable pgm 1 pgm 5) (added in to fix things if your temp goes above 25 but never makes it up to the other temps, like you turn the shower on then the phone rings?) If status fan on Then wait 30 minutes (or whatever) turn fan off EDIT: Though this set of programs won't work right if you don't let the shower get all the way up to temp. Edited November 25, 2019 by apostolakisl
Rocketron Posted November 25, 2019 Author Posted November 25, 2019 Yes, what you've shown apostolakisl is where I was heading when thinking about the problem. Mwester, you say about the "Direction" of change in a set time period, this is where I would have liked to go but have no idea how to get there. I'm going to see what I can figure out in this direction first. I wasn't sure if I should be going into the path of using variables. I've never stepped in that direction. If someone can show I'd be better off doing that I'd certainly give it a go. I don't wish to disparage in anyway the ISY's ability to program but it is limited in someways. Of course sometimes you need to think it through to get where you are going. What is maybe causing me difficulty is my background in power engineering. Accomplishing this in an industrial setting seems so easy. Something heats up in so many seconds, something else can be programmed to react to this instantly. Thanks for the replies. Just as I was hoping it's got my brain working in a direction that is more clear. Larryllix... This is what I'm using to gather the temp data. As for the program I have, there is no use in showing that as it was just something to get me started. It's showing me how well the temp probe is picking up the data.
larryllix Posted November 25, 2019 Posted November 25, 2019 (edited) @apostolakisl has basically got it about as simple as it is going to get, unfortunately. However I can see combining some logic together into one program idea IF you have ISY v5. If temp > 48 Then Repeat while temp > 45 wait 1 minute Repeat 1 time set fan off. Else ----- Drops a few program enables/ disables, simplifying the looks of the logic. There could be more. I use program enable/disables for similar logic, but find them a little obscure making program comprehension two years from now, harder. Too bad we couldn't disable program triggers within the same program and keep going instead of stalling the program. Edited November 25, 2019 by larryllix
apostolakisl Posted November 25, 2019 Posted November 25, 2019 (edited) 1 hour ago, Rocketron said: Yes, what you've shown apostolakisl is where I was heading when thinking about the problem. Mwester, you say about the "Direction" of change in a set time period, this is where I would have liked to go but have no idea how to get there. I'm going to see what I can figure out in this direction first. I wasn't sure if I should be going into the path of using variables. I've never stepped in that direction. If someone can show I'd be better off doing that I'd certainly give it a go. I don't wish to disparage in anyway the ISY's ability to program but it is limited in someways. Of course sometimes you need to think it through to get where you are going. What is maybe causing me difficulty is my background in power engineering. Accomplishing this in an industrial setting seems so easy. Something heats up in so many seconds, something else can be programmed to react to this instantly. Thanks for the replies. Just as I was hoping it's got my brain working in a direction that is more clear. Larryllix... This is what I'm using to gather the temp data. As for the program I have, there is no use in showing that as it was just something to get me started. It's showing me how well the temp probe is picking up the data. You are basically catching temp going up or down by testing for one temp, disabling, then testing for a higher or lower temp with a different program. It is crude, but for this application it is sufficient. ISY doesn't do calculus. Larryllix makes a point about some features of v5. Though the specific example isn't what you wanted since it only runs then fan after the pipe hits 48. I'd have to think about it for a while to see if turning the fan on at 25 and keeping it on until it hits 48 then drops to 45 can be done in fewer steps using v5. Maybe using a couple of "repeat while" consecutively. Below is an idea, I haven't really fully thought it through. 1) pgm 1 if -blank then set fan on repeat while temp < 48 wait 1 second repeat while temp > 45 wait 1 second repeat 1 time set fan off repeat while temp >25 wait 1 second repeat 1 time enable pgm 2 2) pgm 2 If temp >25 Then run then pgm 1 disable pgm 2 Not sure the above is simpler, but it is fewer programs. Edited November 26, 2019 by apostolakisl
Rocketron Posted November 26, 2019 Author Posted November 26, 2019 It appears to me that Variables are required to make this work... So this pgm creates a state variable. Not sure that is required but did it like this. You might correct me in any of this if it makes more sense to do it another way. If 'ZW 125.8 Multilevel Sensor' Responding is True Then $State_1 = 'ZW 125.8 Multilevel Sensor' Temperature °C Repeat Every 5 seconds Else - No Actions - (To add one, press 'Action') This would be the pgm (2) in the example given above. Fan waiting - [ID 005C][Parent 005A] If $State_1 > 25 Then Enable Program 'Fan on off' Disable Program 'Fan waiting' Else - No Actions - (To add one, press 'Action') Finally what starts and stops the fan pgm (1) Fan on off - [ID 005B][Parent 005A] If - No Conditions - (To add one, press 'Schedule' or 'Condition') Then Set 'Ensuite fan' On Repeat While $State_1 < 48 Wait 1 second Repeat While $State_1 > 45 Wait 1 second Repeat 1 times Set 'Ensuite fan' Off Repeat While $State_1 > 25 Wait 1 second Repeat 1 times Enable Program 'Fan waiting' Else - No Actions - (To add one, press 'Action') I've gone with this method mostly because it challenges me a little (no a lot...) Repeats and waits are a totally foreign to me, and variables almost the same. I'm going to have to contemplate the waits and repeats to figure out why those are important. I suspect that since I live alone this will work in my application. If the temp doesn't fall below 25 will the fan restart? In situations where a second shower follows closely it might prove annoying. I'll run it and see what happens, of course it's slow to cool that last little bit to 25 so it'll take a while to see if it works each time I make a change.
Rocketron Posted November 26, 2019 Author Posted November 26, 2019 (edited) Ahhh the no joy in the first run. The variable isn't updating. hummmmm...... OK figured that out..... updating now. Ahh Haa! better now... Thanks ! Variable int - [ID 0059][Parent 005A] If 'ZW 125.8 Multilevel Sensor' Temperature > 24.0°C Then Repeat Every 10 seconds $State_1 = 'ZW 125.8 Multilevel Sensor' Temperature °C Else - No Actions - (To add one, press 'Action') Edited November 26, 2019 by Rocketron
apostolakisl Posted November 26, 2019 Posted November 26, 2019 (edited) 21 minutes ago, Rocketron said: Ahhh the no joy in the first run. The variable isn't updating. hummmmm...... Do it the way I did it the first time. No need for variables. The "repeat while" only works with variables. Just copy my first set of programs. But FYI, the reason your variable never updates is because "responding" is not a trigger. That program will never run. Also, the "repeat" repeats what is under it, not above it. And finally, you have a "enable fan on/off" line in your program that should be a "run then". If you want to keep your current programs you need to 1) Fix the "enable .. . " to "run then. . ." 2) Change the "if" clause of your first program from " . .. responding..." to if 'ZW 125.8 Multilevel Sensor' is >0 Then $State_1 = 'ZW 125.8 Multilevel Sensor' Temperature °C The above program will trigger every single time the temp changes Edited November 26, 2019 by apostolakisl
Rocketron Posted November 26, 2019 Author Posted November 26, 2019 (edited) Worked like a charm once the corrections made. However I do see the downside at work now. Before the fan can restart, the temp will have to drop below 25 to reset everything. As I said not a problem for me at the moment. Yes, I see where removing the variable would reduce the chances of error. I'll probably do that in a little. What I'm thinking of now is I need a variable that I would call "ascending" and another called "descending". If you took the variable for the temperature and compared it to time is it possible to create the ascending/descending variable? ie: variable x, wait time (say 10 seconds) variable y = ascending or descending temperature? Is this something the ISY has the possibility to do? I'm too weak in using variables to know if this is possible. My head is hurting, time to walk away for a little. Can someone point me to a thread which shows how to subtract variables to get a sum? I've got two variables now from the temperature separated by time. If I can do a calculation I should get either a positive or negative number. If positive I can infer that the temperature is rising, if negative it's dropping. Probably can use that information to start or stop the fan. Edited November 26, 2019 by Rocketron
apostolakisl Posted November 26, 2019 Posted November 26, 2019 (edited) 4 hours ago, Rocketron said: Worked like a charm once the corrections made. However I do see the downside at work now. Before the fan can restart, the temp will have to drop below 25 to reset everything. As I said not a problem for me at the moment. Yes, I see where removing the variable would reduce the chances of error. I'll probably do that in a little. What I'm thinking of now is I need a variable that I would call "ascending" and another called "descending". If you took the variable for the temperature and compared it to time is it possible to create the ascending/descending variable? ie: variable x, wait time (say 10 seconds) variable y = ascending or descending temperature? Is this something the ISY has the possibility to do? I'm too weak in using variables to know if this is possible. My head is hurting, time to walk away for a little. Can someone point me to a thread which shows how to subtract variables to get a sum? I've got two variables now from the temperature separated by time. If I can do a calculation I should get either a positive or negative number. If positive I can infer that the temperature is rising, if negative it's dropping. Probably can use that information to start or stop the fan. 1) PGM 1 (this is a modification to your first program you already have) If 'ZW 125.8 Multilevel Sensor temp' > 0 Then $State_old = $State_1 $State_1 = 'ZW 125.8 Multilevel Sensor' Temperature °C run 'if' PGM Temp Up vs Down Else - No Actions - (To add one, press 'Action') 2) PGM Temp Up vs Down (set this program as disabled) IF $State_old < $State_1 Then blank Else blank The above program 1 is a tweak to your program you already have. Program 2 will be "true" if temp is going up, false if it is going down. Also, you should add the below program in case you start the shower and don't let it get to full temp IF status fan on Then wait 30 minutes (or whatever) set fan off stop program 'fan on off' EDIT: Also, if you don't like having to drop below 25 to reset things, just change it. You can make it higher, just remember you will also need to make the "click on" temp a couple degrees higher than the reset temp. Like maybe the fan clicks on at 35 and the reset happens at 33. Edited November 27, 2019 by apostolakisl
TrojanHorse Posted November 27, 2019 Posted November 27, 2019 Just wondering if you have a light in the shower that you could use a trigger instead? Sent from my iPhone using Tapatalk
Rocketron Posted November 27, 2019 Author Posted November 27, 2019 Ok, it might be flawed logic but I've come up with this.... Variable quick - [ID 0059][Parent 005A] If 'ZW 125.8 Multilevel Sensor' Temperature > 15.3°C Then Repeat Every 10 seconds $State_Ensuitewatertemp = 'ZW 125.8 Multilevel Sensor' Temperature °C Else - No Actions - (To add one, press 'Action') Variable slow - [ID 005D][Parent 005A] If 'ZW 125.8 Multilevel Sensor' Temperature > 10.0°C Then Repeat Every 2 minutes Wait 40 seconds $Int_4_ensuite_shwtemp_slow = 'ZW 125.8 Multilevel Sensor' Temperature °C Else - No Actions - (To add one, press 'Action') The first program captures the temp frequently the second more slowly. Sometimes they are equal but the first variable is always ahead or equal. Both on the way up or down in temp. Took me quite awhile to get the delay to function semi reasonably. I'm still scratching my head how it works... Fan on - [ID 005F][Parent 005A] If $State_Ensuitewatertemp > $Int_4_ensuite_shwtemp_slow Then Set 'Ensuite fan' On Else - No Actions - (To add one, press 'Action') Fan off - [ID 0010][Parent 005A] If $Int_4_ensuite_shwtemp_slow > $State_Ensuitewatertemp Then Set 'Ensuite fan' Off Else - No Actions - (To add one, press 'Action') I'll live with this for a few days and see how long the fan runs after the water goes off. Then revisit it if needed. Works like I originally envisioned it. Thanks for all the suggestions and help, it really gave me other ways of seeing how to get here. Appreciate it!
Rocketron Posted November 27, 2019 Author Posted November 27, 2019 2 minutes ago, TrojanHorse said: Just wondering if you have a light in the shower that you could use a trigger instead? Sent from my iPhone using Tapatalk Oh gosh yes ? I've got a motion sensor too! I'm a hardware junkie and I love the challenge of getting the hardware working. Wish I was more programming aware, then all the hardware I've got would work better!
TrojanHorse Posted November 27, 2019 Posted November 27, 2019 Oh gosh yes I've got a motion sensor too! I'm a hardware junkie and I love the challenge of getting the hardware working. Wish I was more programming aware, then all the hardware I've got would work better! I hear you. I’m planning to add a clamp type current sensor to my steam shower power wires to know when it’s on and do a different fan program. While simple can be less fun, perhaps your programs ultimately use the light on as a trigger to start the fan? Then just stop the fan after the pipes cool? Note that hot pipes is just a proxy for humidity... Use the sensor as well to turn on the fan. If you always use the shower light when showering this could be a good belt and suspenders approach.
Rocketron Posted November 27, 2019 Author Posted November 27, 2019 2 minutes ago, TrojanHorse said: I hear you. I’m planning to add a clamp type current sensor to my steam shower power wires to know when it’s on and do a different fan program. While simple can be less fun, perhaps your programs ultimately use the light on as a trigger to start the fan? Then just stop the fan after the pipes cool? Noting that hot pipes is just a proxy for humidity... Use the sensor as well to turn on the fan. If you always use the shower light when showering this could be a good belt and suspenders approach. The ensuite bathroom has a skylight so the light isn't always needed when showering. The light works off of an ambient light sensor as well as the motion detector. I was thinking of working the lights with the shower temperature. I'm tall enough so the motion sensor works when I'm showering when it's darker. Not so good if the lights go out when someone shorter is it it! I'm actually lucky that I live alone, I can tinker with everything and cope with it well when it screws up. Visitors just kind of except the idiocy of it.
larryllix Posted November 27, 2019 Posted November 27, 2019 Perhaps the hysteresis has been overrated in your logic and something really simple, similar to a lamp retriggerable timer could be used. This will just keep retriggering the timer until the temperature drop below the setpoint and then run for 15 minutes more. If Temp > 25 Then set Fan On wait 15 minutes set Fan Off Else ---- 1
apostolakisl Posted November 27, 2019 Posted November 27, 2019 (edited) 7 hours ago, Rocketron said: Ok, it might be flawed logic but I've come up with this.... Variable quick - [ID 0059][Parent 005A] If 'ZW 125.8 Multilevel Sensor' Temperature > 15.3°C Then Repeat Every 10 seconds $State_Ensuitewatertemp = 'ZW 125.8 Multilevel Sensor' Temperature °C Else - No Actions - (To add one, press 'Action') Variable slow - [ID 005D][Parent 005A] If 'ZW 125.8 Multilevel Sensor' Temperature > 10.0°C Then Repeat Every 2 minutes Wait 40 seconds $Int_4_ensuite_shwtemp_slow = 'ZW 125.8 Multilevel Sensor' Temperature °C Else - No Actions - (To add one, press 'Action') The first program captures the temp frequently the second more slowly. Sometimes they are equal but the first variable is always ahead or equal. Both on the way up or down in temp. Took me quite awhile to get the delay to function semi reasonably. I'm still scratching my head how it works... Fan on - [ID 005F][Parent 005A] If $State_Ensuitewatertemp > $Int_4_ensuite_shwtemp_slow Then Set 'Ensuite fan' On Else - No Actions - (To add one, press 'Action') Fan off - [ID 0010][Parent 005A] If $Int_4_ensuite_shwtemp_slow > $State_Ensuitewatertemp Then Set 'Ensuite fan' Off Else - No Actions - (To add one, press 'Action') I'll live with this for a few days and see how long the fan runs after the water goes off. Then revisit it if needed. Works like I originally envisioned it. Thanks for all the suggestions and help, it really gave me other ways of seeing how to get here. Appreciate it! This won't work. Every time temp changes your first program will re-trigger and the wait/repeats will reset. The program I wrote is how to do that. If you want it posted to a variable then use the then/else clause to set a variable. But there should be no need for that as you can reference program state the same as variable state. Edited November 27, 2019 by apostolakisl
apostolakisl Posted November 27, 2019 Posted November 27, 2019 4 hours ago, larryllix said: Perhaps the hysteresis has been overrated in your logic and something really simple, similar to a lamp retriggerable timer could be used. This will just keep retriggering the timer until the temperature drop below the setpoint and then run for 15 minutes more. If Temp > 25 Then set Fan On wait 15 minutes set Fan Off Else ---- This will never shut the fan off unless the temp is both above 25 and steady for 15 minutes. If it drops below 25, it will trigger false, and assuming it didn't first sit at 26 for 15 minute straight, the fan would not turn off. It also would turn the fan off if say you took a 16 minute shower where the pipe temp hit its max and stayed constant for 15 minutes. That would also be counter to your desires since you would want the fan to keep running.
Rocketron Posted November 27, 2019 Author Posted November 27, 2019 6 hours ago, apostolakisl said: This won't work. Every time temp changes your first program will re-trigger and the wait/repeats will reset. The program I wrote is how to do that. If you want it posted to a variable then use the then/else clause to set a variable. But there should be no need for that as you can reference program state the same as variable state. I totally admit it's a bit of a hack but it tested fine this morning. Fan started shortly after hot water began issuing from the shower head. Maybe 15 second delay at most. Shutdown was too quick so I'm going to add a <45 to the Fan off program. I'll re-read your suggested program but I'm such a novice at most of this I'm honestly missing a lot of the logic. As I said the delay I put into my program is still a mystery to myself.
apostolakisl Posted November 27, 2019 Posted November 27, 2019 16 minutes ago, Rocketron said: I totally admit it's a bit of a hack but it tested fine this morning. Fan started shortly after hot water began issuing from the shower head. Maybe 15 second delay at most. Shutdown was too quick so I'm going to add a <45 to the Fan off program. I'll re-read your suggested program but I'm such a novice at most of this I'm honestly missing a lot of the logic. As I said the delay I put into my program is still a mystery to myself. I don't know what worked, but this: If 'ZW 125.8 Multilevel Sensor' Temperature > 10.0°C Then Repeat Every 2 minutes Wait 40 seconds $Int_4_ensuite_shwtemp_slow = 'ZW 125.8 Multilevel Sensor' Temperature °C Else - No Actions - (To add one, press 'Action') won't work. Temperature change is a trigger. So every time the temp changes by (I assume .5 is the increment), the program will cancel out and start over. Your repeats and waits will not execute in any predictable fashion.
Rocketron Posted November 29, 2019 Author Posted November 29, 2019 Just a guess/suggestion for the reason it works. The temp is updated every 30 seconds. Because of that, the increase can be quite large in that space of time. Added the extra line in the Fan off program to have the temp drop to 45 and it shut off just about when I hoped it would.
apostolakisl Posted November 29, 2019 Posted November 29, 2019 14 minutes ago, Rocketron said: Just a guess/suggestion for the reason it works. The temp is updated every 30 seconds. Because of that, the increase can be quite large in that space of time. Added the extra line in the Fan off program to have the temp drop to 45 and it shut off just about when I hoped it would. The program I quoted above would do absolutely nothing if the temp updated in 30 seconds. I think you need to take a closer look at what is happening.
Recommended Posts