10 hours ago10 hr After nearly a decade, I finally had a flash of insight about what is causing a program set of mine to fail. But now that I know, I have no idea what I can do about it.I have a set of backyard lights (one circuit) slaved programmatically to a motion detector. The lights stay 30% dim from sunset to about 11 PM. When motion is detected in the backyard during nighttime hours (even after 11), they come on slowly, stay lit until one minute beyond the last motion detected, then dim slowly to the rest state appropriate to the hour.Anytime after dark, manually controlling these lights stops their automatic behavior, by setting a state variable. If I set them on (for an evening cookout), they stay on. If I set them off (for a meteor shower pool party), they stay off, even if motion is detected. The lights can be returned to automatic program behavior by issuing a fast-off, which resets the state variable.Or that's the goal.The problem is that sometimes this behavior would work, and sometimes it wouldn't. Specifically, the automatic behavior would not shut off despite having manually controlled the lights. Sometimes it would work fine, but sometimes it simply wouldn't.I went nuts diddling my programs, assuming it was some sort of timing race with another program (possibly the motion-detected program), yet could never beat this behavior fully. But a couple nights ago, I finally figured it out.The code I use to reset the state variable looks like this:If'Pool Lanterns Switch' is switched Fast off Or 'Nook - D Pool Lanterns' is switched Fast off Or 'Portable - Pool Post Lamps' is switched Fast offThen$Manual_Pool_Lamps_sw = 0 ...The code used to set it is similar, except that this triplet is repeated for every action OTHER than fast-off.It finally dawned on me that the failure case always occurred when I used the admin console or my iPhone app (I use MobiLinc Pro) to manually control those lights... whereas it always succeeded if I used any of the physical switches enumerated in the code to control the lights. Even if I told the admin console or MobiLinc Pro to send the command to the hardwired "pool lanterns switch" instead of just the related scene, it still didn't "count" for the purposes of the program as seeing "pool lanterns switch switched."The program environment doesn't seem to allow me to select for such control inputs coming from the admin console or the app. It doesn't seem to allow me any handle by which I could intercept controls going to the scene, or be triggered by those controls going to the scene. It doesn't seem to allow for a scene itself to set a state variable.How do I do what I want to do? Edited 10 hours ago10 hr by lhranch
9 hours ago9 hr First thing that comes to mind …Create programs that turn them off or on and sets the required variables at the same time. Put the program as favorite in UD mobile in a group called back yard lights. if you use Alexa, you could expose the programs for spoken commands. Edited 9 hours ago9 hr by hart2hart
9 hours ago9 hr You could also leverage a Keypadlinc button to also trigger your programs with an ‘Or’ keypadlinc button A is On/Off.I’ve also used the virtual device plugin to create virtual switches and then turn those on / off as a favorite. Again put those as Or clause in existing programs to trigger them. Edited 9 hours ago9 hr by hart2hart
6 hours ago6 hr 3 hours ago, hart2hart said:I’ve also used the virtual device plugin to create virtual switches and then turn those on / off as a favorite.This has become my favorite approach for when I want to control a scene from UDMobile or the admin panel...create a virtual switch, include it in the scene as controller, then use the virtual switch in UDMobile. It acts as an indicator for the scene status, and can trigger programs when they are part of the condition. I expect that approach would work great here, but the virtual switch would have to be included as a fourth line in your program condition.
Create an account or sign in to comment