Exten Posted August 16, 2012 Posted August 16, 2012 My thinking is hosed and I don't know where, and I'm very new to programming on Mister ISY. I have my coffeepot plugged into an ApplianceLinc Outdoor 2456S3E. 5111 Rev 2.1 if it matters. It is 3 days old, it's brand new. When I turn on the coffeepot via MobiLinc I do get an email so that part works well. But I want an email as long as the coffeepot remains on. I want a reminder when I am at work if I accidentally left the coffeepot on. So do I need to place the program in a scene...or a folder...or what is the strategy to get a continual notification? Is there a link to a how-to? Gimme the boot in the right direction! After I get the continual notification part working I'll lock it down with a condition something like.... If it's betweem 8Am and 10AM Mon-Fri. then send the emails every minute. Thx gurus
Michel Kohanim Posted August 16, 2012 Posted August 16, 2012 Hello Exten, The main hint for you is that Wait and Repeat can be interrupted. This means that if you have a Wait statement and if the condition turns to false, then the Wait is interrupted and the program exists. So, you might want something like this: If [Your time condition] And Status Coffee Pot is not Off Then Repeat Every Minute Send Notification to xx content yy With kind regards, Michel
Exten Posted August 16, 2012 Author Posted August 16, 2012 Hi Michel...very kool...much much better than my half baked thinking. Well, how about this... Seems like it's best to assume that a power outage will occur when I have left the coffeepot on and I am already at work when the outage happens. Of course, all the insteon devices as well as Mr. ISY994 will lose power. Will the logic in your example not get fooled? If I'm reading it right it looks like your logic won't get fooled by a power outage. Any other tips about which logic conditions to shy away from? Seems like I should not use any logic that depends on power being present. Should I always test for NOT a condition as opposed to explicitly testing FOR a condition?
Brian H Posted August 16, 2012 Posted August 16, 2012 One thing to remember. That may effect what you are wanting to do. After a power loss and power restoration. The 2456S3E defaults to Off even if it was On when the power was lost. The latest 2456S ApplianceLinc also default to Off after a power loss. Also in the Configuration Tab. A Query at power up can be turned On. Mine does.
oberkc Posted August 16, 2012 Posted August 16, 2012 Should I always test for NOT a condition as opposed to explicitly testing FOR a condition? Testing for a "NOT OFF" condition is a nice trick when one is using dimmers, where you want to test for a condition where the device can be at any level greater than zero. For relays such as appliancelincs, where there are only two conditions ON and OFF, I would expect that you could use: and status of coffee pot is on
Exten Posted August 16, 2012 Author Posted August 16, 2012 One thing to remember. That may effect what you are wanting to do. After a power loss and power restoration. The 2456S3E defaults to Off even if it was On when the power was lost. The latest 2456S ApplianceLinc also default to Off after a power loss. Also in the Configuration Tab. A Query at power up can be turned On. Mine does. Good...it errs on the side of caution, in this case. Are state vars persistent across reboots of the isy ? There could be something that I would want to return to whatever state it was in b4 the power outage. Can I write a variable to the SD card or some other way to detect state before the power outage? Can I write anything at all to the SD card? I haven't seen any mention of write commands so I'm thinking not.
Exten Posted August 16, 2012 Author Posted August 16, 2012 Should I always test for NOT a condition as opposed to explicitly testing FOR a condition? Testing for a "NOT OFF" condition is a nice trick when one is using dimmers, where you want to test for a condition where the device can be at any level greater than zero. For relays such as appliancelincs, where there are only two conditions ON and OFF, I would expect that you could use: and status of coffee pot is on Okay, got it, thx.
Xathros Posted August 16, 2012 Posted August 16, 2012 Are state vars persistent across reboots of the isy ? There could be something that I would want to return to whatever state it was in b4 the power outage. Can I write a variable to the SD card or some other way to detect state before the power outage? Can I write anything at all to the SD card? I haven't seen any mention of write commands so I'm thinking not. No. Nether State or Integer variables will survive a reboot but, you can fix that easily as follows: If Then $s.MyVariable = 1 $s.Myvariable Init To $s.MyVariable Else Setting the init value to the current value ensures that the variable will still contain this value after reboot. Just remember to set the init everytime you change the value. -Xathros
Exten Posted August 17, 2012 Author Posted August 17, 2012 Thx Xanthros. I'll be reusing this program and it's logic for many things it looks like. This is what I've got..... If the coffeepot is on.... Then set the var to 1. Init the var to 1. (setting status of a var does not also init the var? initialization doesn't happen when you put something into a var?) Just let this program stand alone and $hadJuice will always contain the state of AC power to the coffeepot? Then as a test procedure....unplug the coffeepot....plug it back in and the coffeepot should turn back on...right?
Exten Posted August 17, 2012 Author Posted August 17, 2012 I think my logic is faulty. I need to actually test for the coffeepot being turned off instead of assuming that if it's not on, then it must be off. Is that a better way to go? After all, the coffeepot could be simply not reachable for any reason, yet still be turned on or off.
Xathros Posted August 23, 2012 Posted August 23, 2012 Exten- While your program is valid, I'm not sure what it's use case would be. You can simply query the current status of the coffee pot to tell if its on or off. All the var will tell you is if it was on or off before a system reboot. Useful for turning it back on after a power failure if it was on before but thats about it as far as I can see. The init value of a variable is the value it will initially be on startup. Changing the value of the var after that point will NOT change the init value unless you specifically change the the init as well. On a dimmer device, testing for Not On or Not Off makes sense since it can be somewhere in between. So "Not Off" means somewhere between 1 and 100% and "Not On" means somewhere between 0 and 99%. A relay device is either on or off with no in between and a not responding device is neither On nor Off. -Xathros
Recommended Posts