Jump to content

Toggle a variable value


thebroz

Recommended Posts

I've got a program that sets a variable to 1 during two separate time spans. A couple other programs use this variable to determine what to do. If Variable = 1 than do something, if not, then do something else.

This all works just fine.

 

What I want to do is toggle the variable to 1 or 0 by either pressing a button on my inseton mini remote or by running a program from my MobiLinc app.

 

This seems like it should be dirt simple, but I am stumped. Programs run as event loops, right? So, I can't just run once and done.

 

Two problems with my scenario.

1: the time span part will override my variable value, setting it back to 1 no matter what I do during that time span.

2: if $var == 1

$var = 0

else

$var = 1

is an infinite loop.

 

Can someone straighten me out? Is it possible to toggle a variable value with a button click or a tap on my MobiLinc app?

Thanks in advance

Link to comment

If you disable that program and call it from another program (Run If Path) then you will get the result that you want. Disabling a program prevents it from self triggering but it does not prevent it being run from another program.

 

Hope this helps.

 

-Xathros

Link to comment

Wow, thanks for the quick reply.

 

Your solution solves a big part of the problem.

 

Now I want a way to determine if that variable is set to 1 or 0 on my MobiLinc dashboard.

 

I'm trying to set up a security system. The variable == 1 when the system is "armed". I get text messages from my doors, windows, and motion detector if the system is "armed." That all works now.

 

I just needed a method to toggle the value of the variable (solved by you THANK YOU) and a way to easily see whether it's set.

 

I know I can drill down in the MobiLinc app and find the variable value. My wife won't want to do that.

 

I truly appreciate the help!

Link to comment
Wow, thanks for the quick reply.

 

Your solution solves a big part of the problem.

 

Now I want a way to determine if that variable is set to 1 or 0 on my MobiLinc dashboard.

 

I'm trying to set up a security system. The variable == 1 when the system is "armed". I get text messages from my doors, windows, and motion detector if the system is "armed." That all works now.

 

I just needed a method to toggle the value of the variable (solved by you THANK YOU) and a way to easily see whether it's set.

 

I know I can drill down in the MobiLinc app and find the variable value. My wife won't want to do that.

 

I truly appreciate the help!

No Problem. As always, happy to help.

 

Make the toggle program a ML favorite. Edit the custom status labels to say 1 for true and 0 for false (or vice versa depending on how your toggle is coded) Make the Favorite action a RunIf that way you can actually toggle by pressing the favorite as well. You could also name the true/false labels based on what the variable does for you. I do this with a number of toggles in my system: Pellet Stove Enable/Disabe, Netfilter Enable/Disable, Home/Away etc.

 

-Xathros

Link to comment
  • 1 month later...
I know I can drill down in the MobiLinc app and find the variable value. My wife won't want to do that.

I have the X10 module and have defined a phoney unit called "Vacation Mode" which I turn On and Off from inside the ISY.

 

Mobilinc can see it as a device in My Favourites.

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...