fix(occupancy): fix groups geting created for all areas #73
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #71
This feels like a major hack, but it's at least a start to get some ideas going on what the correct fix is for this. Currently, as described in #71, occupancy groups are created for all areas. This is undesirable behavior as not all areas are required to have one of more Lutron PIRs.
In this fix, I chose to look at each
OccupancyGroup
to see if there are is anyAction
defined to determine if an OccupancyGroup should be created for each area.Below you can see a few examples of what an
OccupancyGroup
looks like from my Lutron config. This assumption may be naive, but it's the best I could come up with based on my config. If we cannot find theAction
key under anOccupanyGroup
, then wereturn None
from_parse_occupancy_group
as my assumption would be that there is no actual PIR in that area.Group with an empty
Actions
element - nothing actually happens (from a Lutron perspective) when this PIR is violated:Group with no
Actions
Group with
Actions
: