How do I count sensor trips to increment a new variable ?

No screen shot needed. You are on the right track. Each of the groups you have created can have activities that Reactor runs when the group goes true or false. You want your Friday group to do something? Go to the Activities tab, and in the “Friday is TRUE” activity, add your actions: turn on a light, change the thermostat, change the house mode, arm a sensor, etc. Whatever you need to do.

Activities

By the way, unless you need the HWM group for something, you don’t usually need a group to wrap just one condition. So if you don’t have a reason for that group being there, get rid of it, just drag the Device State condition into the “Friday” group above or below the Weekday condition.

rigpapa
remember I am looking for a counter not do turn on anything but to count how many times motion sensor is activated in a given period. Nothing more nothing less. So how does Reactor accomplish this ?
Yes the first 2 statements are the easiest but what to really do with activities ?
How do I tell Reactor to count and increment each time sensor is activated
Thanks

set up a conditon to trip every time your sensor value is 1.
then in it’s activity use run lua to update your counter variable.

OK. Go to your Expressions tab, and create a variable called “count”, but leave the expression field blank.

Then go to the Activities tab, and in the “Friday is TRUE” activity, add a “Set Variable” activity, choose the “count” variable (it will be the only choice), and in the expression field enter { ( count or 0 ) + 1 }

The question I have for you is, what do you intend to do with this counter? You just want a number? To do what with?

I thought about an expression, but wondered how atomic the count would be, would it survive a reload or a reactor reset/disable?

you are right I have to know how many times a day week month the traffic trips my 6 motion sensors so I can tell the most active traffic path

It would survive a reload. Restart of the RS would zero the counter, but that should be a rare operation. I myself never do it.

@NCDude Nice application. OK, so for that purpose, you would want to remove the “repeats” option you put on, since that’s a different think. The expression given previously with the Set Variable action is all you need, and the “repeats” option will actually get in the way.

Thanks I was going to do that but now you understand why I need just a counter scenario and nothing more
Thanks for all your help we finally got on the same page.


Code does not work need something in expression, activities is not doing what we want.

Sorry. That’s using a feature you don’t have yet–my bad.

OK. In the Activity, set the “Set Variable” expression to just {count + 1}.

Then go back to the Expressions tab, and supply 0 (zero) as the expression for count, and hit Save. Then go to the Status tab, and confirm that count is 0. Then go back to the Expressions tab and remove the expression for count, once again leaving it blank. Hit Save. It will be fine from there.

Thanks be glad to test your next update, by the way there are several issues I heave had with this version that perhaps you can look into.
1st when choosing a predefined object in the choose device when I select let’s say for a motion sensor “tripped whether armed or disarmed” the cursor jumps out of the “conditions” window back to mail Vera window then when I re-enter the Reactor window it tell me to save the change or cancel the change and this happens more often then not, wish I could give you a screen shot but it happens way to fast to capture.

What browser are you using? And actually, I’m confused by the whole “window” thing… everything happens in one page, so…

Yes if in Reactor screen it will drop out of Reactor screen and close reactor screen and drop back into Vera Screen, then I must re-open reactor screen and either save or cancel changes
bu the way the expression still does not work here is screen shot

In the activity, in the “Set Variable” action, you have a leading space before the {. Remove that. Sorry, hard to see in your screen shot with my bad eyes… actually, you have an open parenthesis but an ending curly brace. It should be curly brace to start and finish, like this: { count + 1 }


I will try to capture a small video of the condition I an referring to so you can see it in action.
Made change to expression like you said but still no luck

On the Expressions tab, you need to set the expression to just a zero for any all, then Save. Go back to the Status tab. You will see all the values are then 0. Then go back to the Expressions tab, and remove the zeroes, leaving the expression fields blank, and hit Save again. Go back to the Status tab, and it will say “(no expression)”, but the values should all be zeroes.

Tried that same result I have video of Condition I was talking about may interest you but I can not send video on this site

Here are images of results of just 1 motion sensor ater it is tripped also did as you suggested

in last post

Looks like you didn’t set CountHWSat to 0. You have to initialize ALL the expression variables to 0.

Also your Device State condition in the HW Sun group is different from the one in the HW Sat group–is that intentional?

I did and then activated HW motion sensor and that was the result and thanks I fixed the Sun expression and set it to 1 not 0 in conditions

Oh, shoot… I just noticed… you changed the name of the variable(s) from count to CountHWSat and CountHWSun. So that’s what has to be in the Set Variables as well: { CountHWSat + 1 } and { CountHWSun + 1 } respectively. And you will need to reset CountHWSat to 0 again to clear that null.

1 Like