Tracking Open Windows

2 Likes

I was able to create WHF device groups for the rooms that have doors just fine with the updated app, @FriedCheese2006. But I'm having difficulty trying to figure out how to get them added together with RM. I figured I could do it with RM and a global variable, adding the device attribute "TotalOpen" of each of the window groupings together... But that doesn't seem to be an option in RM like I was hoping...
You can set the variable to be equal to a device attribute. You can add a number to a variable. You can add 2 variables together. But, it doesn't seem like you can set a variable to device A attribute + device B attribute + device C attribute, etc. You also can't add more than 2 variables together - otherwise I could have several rules to set several variables equal to the different rooms' "TotalOpen" and then add the various variables up... Not ideal, but could work.
@danabw - how were you planning on using the TotalOpen data for controlling your Whole House Fan?
@bravenel - am I missing something? Do you know a way how to add up several global variables or add up several device attributes to equal a global variable that can then be used in RM?

This is the part I was getting at with being able to get you most of the way to your end goal.

You'll have to set a local variable for each TotalOpen attribute.
Then have multiple actions to add them together into a "Total" variable.

Unless someone else can think of something. I could write another child app as an "overwatch" of sorts but that's getting a little sidetracked from my original intent with SensorGroups+.

I hadn't gotten there yet, busy w/silly stuff my wife calls "important" :wink: so haven't been thinking about it in detail yet. But the issues you raise do seem to complicate things more than I expected. I should note that I don't even have sensors on the internal doors yet, so putting those sensors on in a way that my wife is happy about (or not too unhappy about) will be the first hurdle before the next steps.

Ahh, I see... You can use the Variable Math option and then just have to keep referencing the variable and adding to it for each line of the RM rule...

Interesting approach. I guess it works, albeit a bit clunky. It would be nice if you could just select from the list of variables to add them together under the "add number" option or an additional option to "Add variables".

And yes, @FriedCheese2006, I agree, an additional "overwatch" portion to your SG+ app doesn't really fit the purpose of that app, which is why I was saying earlier that it'd work better as a standalone app specific for window counting for a whole house fan.

It seems like it's doable to piece together with what you've already put together and the different variables + RM logic, but I imagine a dedicated app would be better suited for this purpose.

It would, but being that SG+ was the first app I've ever written, I was trying to focus on getting it to where I wanted; mostly to figure out mistakes along the way.

For example, I realized I could've just had a single device driver that covers all the app capabilities. Now, I'm trying to figure out the best way to flip to a single device type. At this point, it looks like I'd have to get users to manually switch existing devices. Stuff like that is mostly immaterial for front end users, but it would make maintenance a heck of a lot easier on the dev side.

There's other things on the backside I'm still figuring out. Like HPM. The docs for devs are pretty bare bones so it's a lot of trial and error.

3 Likes

Happy hunting. Removed tags.

Well, I'm trying not to bother folks every time I run into a hurdle. I don't mind the work of try, test, try again...

1 Like

OK, I get what you mean, investigation can be fun, and solving things rewarding. I'll un-tag them.

1 Like

It just has to be done with serial actions, each adding a one variable to another, keeping a growing sum. Or, you could write a small Groovy app to do this.

@nathaniel.knautz @danabw

"Window Tracker" has been released to HPM. There's a child app for monitoring the windows and doors and a second child app to aggregate stats.

2 Likes

Exciting! I'm looking forward to testing it out. Thanks @FriedCheese2006!

Wow...I don't know who hired you, but that person deserves a raise! :wink: :smiley:

Thanks for all the stuff you're sharing.

If my basic math skills still hold, it looks good to me!

Aggregate:
2022-09-24 16_06_42-Chrome Main

First Child:
2022-09-24 16_07_03-Chrome Main

Second Child:
2022-09-24 16_07_24-Chrome Main

1 Like

I managed to get it installed and all the rooms setup, and it works great! I like that I can just use the virtual group devices from SG+ for rooms that don't have a door restricting access so I don't need to set them up in this app too, and it still includes those open windows in the count. Truly excellent work. I'm envious of your skills! Thanks again for putting it together, especially so quickly!

1 Like

You can still use window tracker for rooms without doors. The door listing is optional and can just left blank, but either way should work since the code overlaps quite a bit. The only caveat is that a future update to SG+ could end up breaking the count totals.

I did see that is an option, but since I'm using SG+ and wanting to include the number of open windows in each room on a dashboard, I already had them setup with SG+, so it worked nicely to pull them into this app too.

1 Like

Can you give a brief description on the usage? When do I use the aggregate child?

@jlv Sure thing.

The aggregate is only necessary if you want to exclude windows if a door is shut. The tracker child has an option to add a "door" sensor. If that sensor is closed, the sensors under the "window" list will be ignored. If you don't have a use case like this, then you can just put all the windows sensors into a single tracker child instance.

  1. Add tracker child app for each room you want to monitor. You can optionally set a sensor for a door if you don't want to count the windows if the door is closed.
    image
    If either doors-0 or doors-1 is closed, then windows0-3 will be ignored and the virtual device will be set to closed.

  2. Add an aggregate app and select the device for each child app. This will create a new child device that shows the combined total open/closed.


2 Likes
4 Likes