markarmer Posted December 12, 2012 Posted December 12, 2012 Hello, I have several automatic animal feeders around my little farm which are controlled by my isy99 & a mix of Outletlincs & Appliancelincs. I created simple programs to feed my animals on a schedule however I need to take things a little further and need help. Here is an example of what I currently use: === IF Time is 9:00am THEN Set 'Feeders / Dog Feeder in Garage' Query Wait 10 seconds Set 'Feeders / Dog Feeder in Garage' On Wait 20 seconds Set 'Feeders / Dog Feeder in Garage' Off == This works great for turning the feeders on and I have a seperate program which alerts me if the Isy can't communicate with the Outletlincs so I know if a feeder has not run on any schedule. The problem is, particularly in bad weather we have a slight glitch in power or interference on our lines which prevent the Off signal being received. If the feeders don't turn on it isn't a major problem as I can manually feed the animals, the issue is when they don't turn off it wastes a lot of moneys worth of food, and if the feeder runs empty as a result the animals will not be fed on the next few cycles before they are checked. What I need to do is have a program running in addition to the ones which actually feeds the animals and goes something like this: == IF Status 'Feeders / Dog Feeder in Garage' is On "FOR MORE THAN 30 SECONDS" THEN Send Notification to Mark... Set 'Feeders / Dog Feeder in Garage' Off == After doing this it would also be great if it is possible to then query the Outletlinc in question and send me a notification to verify that it is indeed Off. Thank You very much in advance if anyone is able to help with this - I'm sure it is simple for some of you, but I just can't figure out how to add the 'If X is on for more than Y" part to a program anywhere. Mark
Xathros Posted December 12, 2012 Posted December 12, 2012 Mark- How about something like the following: Program: Check Feeders IF Time is 9:01:35 am THEN Run Program Check Dog Feeder IF Path Run Program Check Llama feeder IF Path Program: Check Dog Feeder (Disabled) If Status DogFeeder is On Then Set DogFeeder Off Wait 5 seconds Run Program Check Dog Feeder If Path Else Notify Mark: Dog Feeder Off - Succeeded. This won't notify on failure but will retry the off every 5 seconds Until success.
markarmer Posted December 12, 2012 Author Posted December 12, 2012 Thank You - In theory that may work, however, the glitch is that I have over 20 feeders, some run at fixed times, others run based on sunrise/sunset, some rune once a day, others run up to 6 times a day and the real awkward part is that when we have new animals born the feeder may run twice a day for the first few weeks, then up to 6 times a day while they grow, then change again to an adult feeding schedule. Depending on whether we are dealing with chickens or pigs these changes can literally all happen within the space of 8 weeks or be over the course of 6 months. Trying to keep up with all the changes on all those feeders and manually adjusting the 'check' program based on real time would be almost impossible, that is why I am hoping to find a way that allows for action based on how long a device has been in the 'On' state. Thank You Mark
Xathros Posted December 12, 2012 Posted December 12, 2012 Mark- I don't think there is a method for testing how long an Insteon device has been in a given state. I don't think it ill be very difficult to deal with this by modifying your original programs just a little and adding a check program and notify program for each feeder. Define some state vars - 1 for each feeder: s.DogFeederOffTest IF Time is 9:00am THEN s.DogFeederOffTest=0 Set 'Feeders / Dog Feeder in Garage' On Wait 20 seconds Do program Check Dog Feeder IF Path (this will turn off the feeder and keep trying until it succeeds) I removed the Query as it served no function that I could see. Program: CheckDogFeeder If Status DogFeeder is On Then Set DogFeeder Off s.DogFeederOffTest = +1 Wait 5 seconds Run Program DogFeederFailNotify Run Program Check Dog Feeder If Path Else Program: DogFeederFailNotify IF s.DogFeederOffCount = 5 or s.DogFeederOffCount = 15 or s.DogFeederOffCount = 25 THEN Notify Mark: DogFeeder OFF Failed! So simply duplicate the CheckDogFeeder program and DogFeederFailNotify program for the other feeders and call the check programs in place of just setting the feeders off. This way they will retry until off. You will be notified if OFF fails after 5, 15 and 25 attempts. Your schedule is still managed the same way it is now with your first program. You can expand on this for the Feeder On portion if you wanted to ensure that nobody goes hungry as well. Thoughts ? -Xathros
TJF1960 Posted December 12, 2012 Posted December 12, 2012 Maybe something like this? If Status 'Feeders / Dog Feeder in Garage' is On Then Wait 2 seconds Set 'Feeders / Dog Feeder in Garage' Query Wait 30 seconds Set 'Feeders / Dog Feeder in Garage' Off Send Notification to Mark Set 'Feeders / Dog Feeder in Garage' Query Else Send Notification to Mark As long as the ISY knows the status of the device is On this program will run. If the status is actually Off the program will stop and turn False. If the status is indeed On then the program will wait 30 seconds during which if the status changes to False the program will stop. Otherwise it will turn Off the feeder, send a notification then run a final query to verify the status is Off. Question, is the ISY on a backup battery or UPS or generator? Or when the power goes out so does the ISY? The reason I ask is that if the ISY is not on backup power and the power goes out, the program may not run when power is back on even if the device status is On. The reason is once the ISY reboots all programs are set either true or false based on the conditions. While this program may be set to true depending on the conditions it may not run because there was not an event to trigger it after reboot. If this is the case there is a work around.
markarmer Posted December 13, 2012 Author Posted December 13, 2012 Thank You Xathros, I just re-wrote my programs to try your suggestions (having never used variables, or understood their use I would never have come up with that). I won't really know until the next storm how well it works but I am very happy to have things in place that SHOULD take care of my problem. TJF1960, thank you also for your eply - My isy is not on backup power so please explain the work around which would allow me to tigger programs to run after a reboot. That could be very useful to me not just with the feeders but also in ensuring irrigation valves are turned off after a power outage if they were on at the time. Thank You all again VERY much.
Xathros Posted December 13, 2012 Posted December 13, 2012 Mark- To recover after a power failure, create a program as follows to run each of the CheckFeeder programs and put a check in the Run At Startup box for this program: IF THEN Run Program CheckDogFeeder IF Path Run Program CheckHorseFeeder IF Path Run Program Check LlamaFeeder IF Path ELSE Also, Not sure about the outletlincs but most of the appliancelinc modules I have used will default to OFF after a power failure. I highly suspect the outletlincs are the same way but can't say without having tested any. I suspect your fail to turn off problem is more a comm failure due to noise or distance than power loss. Might need to look at filtering noisy equipment or adding some access points to extend/repeat the messages. -Xathros
markarmer Posted December 13, 2012 Author Posted December 13, 2012 Thank You - I just created the program as described but can't see any option to 'Run at startup', the only check box i have is 'Enabled' - Where would I find this?
Xathros Posted December 13, 2012 Posted December 13, 2012 Thank You - I just created the program as described but can't see any option to 'Run at startup', the only check box i have is 'Enabled' - Where would I find this? Sorry, Find the program in the list on the summary tab, right click the program name and select Enable run at Startup. Dunno why this option is so buried. -Xathros
TJF1960 Posted December 13, 2012 Posted December 13, 2012 Xathros, do you think the OP benefit from initializing the variable values in your examples in the event of a power failure and in the event the outletlincs for some reason stay on after power is restored?
markarmer Posted December 13, 2012 Author Posted December 13, 2012 Xathros, I'm curious as to what you said about expanding the program you suggested to run when the feeders turn on to ensure the animals get fed - As some of the feeders only run for 10 seconds or so, wouldn't the program have already sent the feeder off command by the time a second program had checked to see if the devive was actually on? Also, if it is possible to do this, would the check be able to complete in time for the feeder to shut off that quickly if the device had indeed turned on at first attempt when it was supposed to? Thank You
Xathros Posted December 13, 2012 Posted December 13, 2012 Hi Tim- While I don't think its absolutely necessary since we force a test on startup, for cleanliness sake, you have a good point. Mark- Edit the Check programs as follows: Program: CheckDogFeeder If Status DogFeeder is On Then Set DogFeeder Off s.DogFeederOffTest = +1 s.DogFeederOffTest InitTo s.DogFeederOffTest <---Add Wait 5 seconds Run Program DogFeederFailNotify Run Program Check Dog Feeder If Path Else s.DogFeederOffTest = 0 <---Add s.DogFeederOffTest InitTo 0 <---Add This way if the power does fail during a feeder off attempt, the system will resume where it left off in the attempt/notify cycle. -Xathros
Xathros Posted December 13, 2012 Posted December 13, 2012 Xathros, I'm curious as to what you said about expanding the program you suggested to run when the feeders turn on to ensure the animals get fed - As some of the feeders only run for 10 seconds or so, wouldn't the program have already sent the feeder off command by the time a second program had checked to see if the devive was actually on? Also, if it is possible to do this, would the check be able to complete in time for the feeder to shut off that quickly if the device had indeed turned on at first attempt when it was supposed to? Thank You I don't think the timing will be effected very much. ASSUMING good Insteon communications, we are looking at maybe a 1-2 second delay between On command and test to verify that feeder did turn on. Program: DogFeederSchedule IF Time is 9:00 am OR Time is 6:00 pm <------Added to show multiple feeding time usage THEN Run Program DogFeederOn THEN Path Program: DogFeederOn (Disabled) IF Status DogFeeder is Off THEN Set DogFeeder On Set DogFeeder Query Run Program DogFeederOn IF Path ELSE Wait 19 Seconds Run Program CheckDogFeeder THEN Path I dropped the delay from 20 to 19 seconds to account for the test time - Adjust as necessary. This does not notify on failures but we could add a counter variable and notify program as we did with the Off programs. -Xathros
markarmer Posted December 17, 2012 Author Posted December 17, 2012 Thank You all very much for your assistance - I spent the weekend re-writing all of my programs for feeders, irrigation & heatlamps to incorporate the new code you taught me how to use. It could be weeks or months before I know for sure it works as designed but I really appreciate your efforts in getting me all setup with programs to ensure everything works as well as possible. Mark
Recommended Posts