IF-THEN-ELSE

Forum to ask for any help
Post Reply
rrehart
Posts: 44
Joined: Thu Sep 06, 2012 12:08 am

IF-THEN-ELSE

Post by rrehart » Tue Dec 31, 2013 10:28 pm

Is it possible to setup up an "IF-THEN-ELSE" Statement in DemoPad?

For instance, I want to check the condition [LIGHT] and set a flag:

IF [LIGHT] is > "0", THEN Set a Flag [LIGHTSWITCH] ON ELSE Set a Flag [LIGHTSWITCH] OFF

Or, is there a way around a straight statement?

Thanks.

starwarsmike
Posts: 146
Joined: Mon May 13, 2013 12:48 pm

Re: IF-THEN-ELSE

Post by starwarsmike » Wed Jan 01, 2014 4:21 pm

Presume you talking about an action, say when page loads, which sends a status command request. If so, In feedback just set "Feedback Matches Specific Data"

So....If your feedback is Lights0 (which is off), set a action, your off flag in action type, from drop down menu.

Then do the same for the rest of your light levels...eg Lights1, set a action, your on flag in action type.

If you have a 2 buttons off/on, with flags. The above the will show if your lights are on or off.

There is various ways but all depends on your feedback pattern.

rrehart
Posts: 44
Joined: Thu Sep 06, 2012 12:08 am

Re: IF-THEN-ELSE

Post by rrehart » Thu Jan 02, 2014 5:27 pm

I'm actually talking more about an ongoing action, rather than a page load action. Here's the scenario:

I have two way feedback working to my ISY. I should be able to 'see' when someone turns on a light switch in any room by setting up the statement "ST.*<action>(.*)</action><node>xx xx xx 1</node>". I then send that to a number (for example: [EntryLights]. See pictures below). [EntryLights], in turn, has two possibilities On/Off (0/255). I have the action for "0" to set the [EntryLightStatus] flag to "OFF" and "255" to "ON". Finally, I have the highlight for the Entry Lights button set to the [EnteryLightStatus] flag. In theory, that should set the highlight to "ON" when the light is on (255) and off when it is off (0). But that isn't happening. I know two-way feedback is working because I can send on/off to any device and my guages for the dimmers (setup in the same way) update when I set them outside of the program.
2-way feedback.jpg
Number actions.jpg
Highlight.jpg
What should be happening is upon opening Demopad, it should check the status of all of the lights/dimmers/sensors/etc... I have programmed and set the flag for each on to either ON or OFF. Then, when the program is active, it should constantly be checking/updating status of everything and updating the flags as appropriate. Seems that is not the case. Any thoughts on what I may be missing here?
You do not have the required permissions to view the files attached to this post.

rrehart
Posts: 44
Joined: Thu Sep 06, 2012 12:08 am

Re: IF-THEN-ELSE

Post by rrehart » Thu Jan 02, 2014 10:31 pm

Ok. I got this working by reversing my thinking. Now, I have the status update a Label. Then, I have the corresponding number updated with the label value. Once that happens I can turn a flag Off/On based on the number being either "0" or "1-255". Works like a charm.

DEMOPAD: Consider this a feature request: I would LOVE the ability to add in IF-THEN-ELSE statements directly - Much like the Admin interface of the ISY. It would make programming things a WHOLE LOT easier. Thanks.

User avatar
DemoPad
Site Admin
Posts: 770
Joined: Thu Jun 14, 2012 10:46 am
Contact:

Re: IF-THEN-ELSE

Post by DemoPad » Sat Jan 11, 2014 11:21 am

2 things here:

1. When using feedback which is assigned to a number, custom number actions don't fire. See our post at http://www.demopad.com/forum/viewtopic. ... 222&p=5588 for the workaround.

2. For if then else, can you not just use a dependent flag, and 2 actions? ie:

Perform action 1 if Flag is ON
Perform action 2 if Flag is OFF

Only 1 of those actions will fire, depending on the condition of the Flag.

Post Reply