Ranger Home Automation
Expert
Expert
Posts: 652
Joined: Tue Jun 26, 2007 11:31 pm
Location: Temple, central Texas
Contact: Send private message

Conditionals, need some basics

Sun Sep 30, 2007 3:11 pm

While am preparing for the new HAI plug in, I am ramping up my mls skills. The issue is conditionals. I have looked wiki but its not detailed enough, right now anyways given my skill set.

I have done something similar before but I already forget! LOL. I have created a floor plan. Put a lightbulb button everywhere there is an ALC light fixture. What want to do is have the floor plan show me what light is on or off automatically. Then of course be able to touch any light button and turn it on or off. I believe I have to use conditionals? Also set up cyclestates? Is there something in wiki that details the whole process?

I have a bulb button thats pretty dim. I want that to show if its off, then when i touch it and the light comes on, the button changes to a glowing, different button.

what do i start with?

i searched for 20 minutes thru my previous posts as we touched on this subject before.

Ranger Home Automation
Expert
Expert
Posts: 652
Joined: Tue Jun 26, 2007 11:31 pm
Location: Temple, central Texas
Contact: Send private message

Sun Sep 30, 2007 4:07 pm

Basically, I have a bulb. I want to touch it and have it change to a different button, a big glow one. And have the light turn on, of course. I am playing with cyclestates, not sure if i need conditionals? Thinking I can just cycle thru off and on. but might need conditionals to get the button to change. still tinkering.

User avatar
DavidL
Founder
Founder
Posts: 11528
Joined: Sat Feb 08, 2003 9:39 am
Location: Metamora, Michigan
Contact: Send private message Website

Sun Sep 30, 2007 8:29 pm

http://www.cinemaronlineforums.com/wiki ... 2006_prior

See release notes for 2.18 Search for Toggle Graphic.

Maybe this is what you are trying to do?

Ranger Home Automation
Expert
Expert
Posts: 652
Joined: Tue Jun 26, 2007 11:31 pm
Location: Temple, central Texas
Contact: Send private message

Sun Sep 30, 2007 10:01 pm

smooth. super! thanks i learned something i didnt know. I can use that feature.

However, I dont want just touching the button to change the button, i want the button to change as it reflects whether the light is really on or off. toggling wont do that. right?

do i set conditionals? whereby the button will update on its own depending on the status of the light?

everytime i get sent to wiki, i learn more. I really need to figure out more how to properly use wiki. i search mlconditional, i found the plugin page but not sure its what i am looking for. maybe cycles. not sure, yet.

ricks
Is there life beyond myServer?
Is there life beyond myServer?
Posts: 1133
Joined: Wed Oct 27, 2004 8:01 pm
Location: Latham, Massachusetts
Contact: Send private message

Mon Oct 01, 2007 12:13 am

The variable in the label field has to be the variable that reflects the light's status, not one set by SetVariable. In other words, whatever protocol (X10, UPB, Insteon, Zwave, etc) you're using to control the lights needs to be two-way. When that device changes state, it updates a variable in your mls variable list. That's the variable that needs to be in the label field.

I don't use MLS to control lighting so I can't offer a real example. But say you had an X10 light at C5, then your variable might be Lighting_C5 with a value of On or Off. You would put {{Lighting_C5}} in the label field.

Once you put that variable in the label field, then check the Hide Value box so you won't see the words On or Off in your button.

Then click the States button (lower left) and set the On/Off states of the button. You could use a white light bulb for off and tint it yellow for on. Or you could swap buttons by setting one of their states to 0 alpha - invisible. When the variable changes value, whether by flipping the switch or a button in ML, the state of the button will change.

In the MLServeCmd box place whatever command you use to turn the light on or off. If your protocol allows for a toggle, then you're all set. If not, you could use MLCycleStates which would probably be a little cleaner then using MLConditonal.

If you plan to add dimmer control, then all that changes :D

Ranger Home Automation
Expert
Expert
Posts: 652
Joined: Tue Jun 26, 2007 11:31 pm
Location: Temple, central Texas
Contact: Send private message

Mon Oct 01, 2007 9:39 am

ricks, ah!! Now that I understand and it can get me on the right path.

Example:

For simplicity, my zone one is a motion sensor. I put this in the label:

{{mlhai_event_zone 1_status}}

So i can see what is happening, I change the color of the font to bright green. Now, when my motion goes off, the button says ON, when the motion is still it says OFF. progress!

Unfortunately this reminds me of the issues with the HAI plug in. The status of the motion on the labeled button doesnt change status for several seconds. But bummed I am not, why might you ask? As we speak the hai plug in is being re-worked! Alas, this issue WILL go away, or thats the plan anyways. Its a beautiful thing isnt it? Its actually the reason for me figuring out my lighting in ML to prepare for the new plug in, likely beta first. Method behind the madness. This will be so GREAT once the haiplug is fixed and can be as powerful with mainlobby as it is responsive with homeseer. Life will be good!!

Ok, back to the layout. Now that I understand getting the status to show up, let me figure out in the same button properties how to get it to change the button as well. If light status is off "A" button displays, if light status is on "B" button displays. Let me play with it this morning. I will be sure to hollar if I get stumped but I think I can get this. wow this is cool, fun stuff. can you imagine when the haiplug in gets done? botta bing!

Ranger Home Automation
Expert
Expert
Posts: 652
Joined: Tue Jun 26, 2007 11:31 pm
Location: Temple, central Texas
Contact: Send private message

Mon Oct 01, 2007 9:46 am

UT OH! Just thought of something.

Event status command in hai plugin is:

MLHAI_Event_Zone 1_Status

However, my lights are not zones, they are ALC. Is it set up for this to work?

MLHAI_Event_ALC 1_Status

Surely there is a way to get the status of lights, right? I didnt see the above command in wiki. Is my thinking right that the above command will work? (i am rewiring my demo unit so cant test right now).

Status of lights (ALC 1) works sames as zones (Zone 1) ??

Ranger Home Automation
Expert
Expert
Posts: 652
Joined: Tue Jun 26, 2007 11:31 pm
Location: Temple, central Texas
Contact: Send private message

Mon Oct 01, 2007 10:09 am

Well, I failed, LOL, sorta.

I got the status to show up automatically. If ZONE is OFF it says OFF, if its ON it says ON.

I can toggle the button as well. If its a bulb and I touch it, it goes to a glow button.

The issue is, the button doesnt really reflect the status of the zone. lets say in ML i turn a zone ON. The command is sent, the zone turns ON physically and on ML screen and the button toggles from the dim bulb to a bright glow. Beautiful right? Then I turn the zone off outside of ml. The status will change in ml but button remains glowing. This is where I get lost on what programming needs done. Am I back to my orginal thoughts of some sort of conditionals?

I understand the variable label {{mlhai_event_zone 1_status}} but its not the label I want to show the status, its the actual button I want to change to reflect the status. Make sense?

edit, remember I am testing not on an alc but just a zone. on/off. Will figure out ALC when previous post is answered about {{mlhai_event_ALC 1_status}}

User avatar
DavidL
Founder
Founder
Posts: 11528
Joined: Sat Feb 08, 2003 9:39 am
Location: Metamora, Michigan
Contact: Send private message Website

Mon Oct 01, 2007 10:32 am

Info on button states:

http://www.cinemaronlineforums.com/wiki ... NT_BUTTONS

Not exactly sure what issue you are running into.

If the plugin / or device (HAI) is slow to respond, you can always manually (via a Macro|SetVariable) the device value as you send the plugin the request to change. This will then provide instant user interface update, waiting for the hardware to respond back with the confirmation of the change. This technique is commonly used with Sliders for Dim control so the slider bat handle doesn't bounce around when setting it. Your button's states is set the same way.

Ranger Home Automation
Expert
Expert
Posts: 652
Joined: Tue Jun 26, 2007 11:31 pm
Location: Temple, central Texas
Contact: Send private message

Mon Oct 01, 2007 12:40 pm

smooth, SUPER! We are on the right track. Now, my button changes from a red dim glow to a bright yellow glow automatically based on the status of the zone.

Thanks for reminding me the STATES. works like a champ.

But what I really want to do is have the actual graphic of the button change.

example. When the status of the zone is off, show a dim bulb button. when the status of the light autochanges to ON, show a big glowing button.

Right now, using states, i can have my "glow" change states. is there anyway to have two different graphic buttons show based on status of a zone? I went into ML Command line, chose toggle for the MLcmd. but thats not getting what i want.

If i cant have one buttons show for OFF then another show for ON, no big deal as I can settle for the STATES to show me two differnt COLORS of the same button.

am I making sense?

User avatar
DavidL
Founder
Founder
Posts: 11528
Joined: Sat Feb 08, 2003 9:39 am
Location: Metamora, Michigan
Contact: Send private message Website

Mon Oct 01, 2007 3:35 pm

Have two graphics, each with similar programming but different graphic. Use States in each, but to light up with opposite tint - one 100% when the device is On, the other 0% under same circumstancs. And opposite for both when device is Off. Layer the buttons using Z-Order.

So, one goes invisible and the other visible when device = On.

Ranger Home Automation
Expert
Expert
Posts: 652
Joined: Tue Jun 26, 2007 11:31 pm
Location: Temple, central Texas
Contact: Send private message

Mon Oct 01, 2007 6:34 pm

smooth, thats what i did my friend. good work around. thought of it as I saw the states could go to invisible.

very nice!

Return to “MLHAI”

Who is online

Users browsing this forum: No registered users and 1 guest