Rule for "becomes"

Tips and Techniques for using MLServer's Automation Rules
sonypoolplr
Is there life beyond Cinemar?
Is there life beyond Cinemar?
Posts: 1490
Joined: Fri Mar 26, 2004 8:48 am
Location: New Jersey
Contact:

Re: Rule for "becomes"

Postby sonypoolplr » Thu Oct 23, 2014 4:51 pm

Does the variable you are referring to have a value as well as On or Off? Where you would have variable_value = something? Where maybe On equals 100 and off equals 0? I don't have a Vera so I don't know how the variables are listed, but maybe you could use the value part instead of just On/Off.

User avatar
CinemarDave
Site Admin
Site Admin
Posts: 10535
Joined: Fri Feb 07, 2003 8:56 am
Location: Planet Earth
Contact:

Re: Rule for "becomes"

Postby CinemarDave » Thu Oct 23, 2014 6:20 pm

There has to be something else in play too.
There is only one SetVariable routine in MLServer and every app, driver, plugin etc. calls that one routine.
I have a Vera and I have automation rules monitoring Vera variable changes and they only fire when they should.

Can you log both Vera and MLServer verbose events to a file and email me both files once you see this oddness happening?

Art Dustman
Expert
Expert
Posts: 576
Joined: Fri Nov 10, 2006 3:22 pm
Location: NJ
Contact:

Re: Rule for "becomes"

Postby Art Dustman » Thu Oct 23, 2014 7:53 pm

Sent. I manually fired a change variable from "Off" to "Off", and also went to the Vera console and clicked "Off" and bunch of times. I think part of one issue is the changeover from "Off" to "0" and the randomness may be that you interpreted "0" from the Vera as an "OFF", and when I manually set it to "Off" it's different that your translated "OFF" (CAPS) ??

So I changed my rule to look at zero "0" and noticed SetVariable|lighting_69_status~0 doesn't fire the rule engine every time, but at some point it does

Look at 8:46:19 in the logs when the rule fires, it fires when the Vera updates lighting 69.

Perhaps one is an integer and the other is a string in the comparison somehow?

tmcgowan
Senior Member
Senior Member
Posts: 201
Joined: Fri Nov 25, 2005 1:27 pm
Location: Grosse Ile, MI
Contact:

Re: Rule for "becomes"

Postby tmcgowan » Thu Oct 23, 2014 11:23 pm

Dave,

Thanks for creating the "becomes" rule! I have a noisy Insteon switch that's connected to our mail box. When there's a lot of key bounce due to the sensor used, I used to get a lot of voice announcements stating that the "Mail has arrived"! It was driving the family crazy!! Now that the new rule has been created it eliminates all the multiple voice announcements!

Great job!

-Todd

ffneil
New Member
New Member
Posts: 41
Joined: Fri Feb 26, 2010 10:03 pm
Location: Middletown, PA
Contact:

Re: Rule for "becomes"

Postby ffneil » Sun Nov 16, 2014 8:06 pm

I am trying to use the "becomes" rule. Shouldn't it only fire once when a value changes? Rule 111 continues to fire constantly. Rule 112 only fires once.
You do not have the required permissions to view the files attached to this post.

User avatar
CinemarDave
Site Admin
Site Admin
Posts: 10535
Joined: Fri Feb 07, 2003 8:56 am
Location: Planet Earth
Contact:

Re: Rule for "becomes"

Postby CinemarDave » Mon Nov 17, 2014 10:16 am

No that rule will fire every time the variable blml2hs_garagedoor changes and the value equals open. Why? Because both conditions are met. The variable changed value and its value is open. What is changing its value so quickly? There must be a quick close/open sequence going on?

The better rule would be

Whenever blml2hs_garagedoor equals open
then Macro|...

That rule will only fire when the variable goes from closed to open.

Art Dustman
Expert
Expert
Posts: 576
Joined: Fri Nov 10, 2006 3:22 pm
Location: NJ
Contact:

Re: Rule for "becomes"

Postby Art Dustman » Mon Nov 17, 2014 12:07 pm

What is driving the variable? Vera, global cache, etc?
I'm still battling with this myself.

ffneil
New Member
New Member
Posts: 41
Joined: Fri Feb 26, 2010 10:03 pm
Location: Middletown, PA
Contact:

Re: Rule for "becomes"

Postby ffneil » Mon Nov 17, 2014 10:42 pm

I am just using a magnetic switch via Napco alarm. I created a test variable and I change it to Open it continues to fire. I removed the currentdate condition and it worked as expected. I tried the equals Open and I got the same continuous fire.

Art Dustman
Expert
Expert
Posts: 576
Joined: Fri Nov 10, 2006 3:22 pm
Location: NJ
Contact:

Re: Rule for "becomes"

Postby Art Dustman » Tue Nov 18, 2014 8:41 am

I'm at odds with the logic here. This should be no different than the old PLC ladder logic I used to use. Here is how I understood that:

Equals: If x equals 1, then masterswitch turns on (for as long as x = 1, the masterswitch turns on, on every evaluation loop, if x =1 turn on masterswitch) I would expect a continuous loop here

Becomes: if x becomes 1, then masterswitch turns on (Here, the becomes option should only test true only the first time that the state changes to on as opposed to already being 1 according to the internal memory table that the engine maintains) This way when you manually change 1 to 1, or a polling event updates a variable to 1, etc, it will never fire again until it changes to something else first.

in ffneil's rule 112 that he said fires only once, logic wise I would agree and disagree. Yes, obviously the rule is firing when Dave says it shouldn't - i've witnessed that myself. It's all in the interpretation of your method "changes value" - is a changes value simply meant to be that it gets updated, regardless of value? Or is "changes value" defining a process where the stored value changes from what it is to something else? The better term may be when it "gets updated" since that implies nothing about the value itself. Then you can use "becomes" to show a transition of the value.

Sorry to pick on your rule engine Dave... I just don't think it's doing what we all think it's doing.
In ffneil's example; like my problem; we have an external device on a poll or unsolicited response updating values in the db which I still feel the engine is seeing as a change.

User avatar
CinemarDave
Site Admin
Site Admin
Posts: 10535
Joined: Fri Feb 07, 2003 8:56 am
Location: Planet Earth
Contact:

Re: Rule for "becomes"

Postby CinemarDave » Tue Nov 18, 2014 10:53 am

I've got a dozen different rules all based on the examples in these posts running here without any issues. I will have to remote into your system today and see how yours are different than mine. I cannot discount a logic issue but if there is one it has to be pretty obscure.


Return to “Automation Rules”

Who is online

Users browsing this forum: No registered users and 1 guest