Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(occupancy): fix groups geting created for all areas #73

Closed
wants to merge 1 commit into from

Conversation

JonGilmore
Copy link
Collaborator

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 any Action 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 the Action key under an OccupanyGroup, then we return 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:

        <OccupancyGroup UUID="3022" OccupancyGroupNumber="3022" ButtonType="DualAction" PrimaryActionType="3" SceneSaver="false" CycleDim="false" AllowDoubleTap="true" StopIfMoving="false" ProgrammingModelID="3085">
            <Actions />
        </OccupancyGroup>

Group with no Actions

        <OccupancyGroup UUID="3033" OccupancyGroupNumber="3033" />

Group with Actions:

        <OccupancyGroup UUID="3090" OccupancyGroupNumber="3090" ButtonType="DualAction" PrimaryActionType="3" SceneSaver="false" CycleDim="false" AllowDoubleTap="true" StopIfMoving="false" ProgrammingModelID="3117">
            <Actions>
                <Action Name="Press" ActionType="3">
                    <Presets>
                        <Preset Name="Occupied" UUID="3118">
                            <PresetAssignments>
                                <PresetAssignment UUID="3212" AssignmentName="GOTO_LEVEL" AssignmentType="2">
                                    <Delay>00:00:00.00</Delay>
                                    <Fade>00:00:00.00</Fade>
                                    <Level>100.00</Level>
                                    <IntegrationID>10</IntegrationID>
                                </PresetAssignment>
                            </PresetAssignments>
                        </Preset>
                    </Presets>
                </Action>
                <Action Name="Release" ActionType="4">
                    <Presets>
                        <Preset Name="Unoccupied" UUID="3119">
                            <PresetAssignments>
                                <PresetAssignment UUID="3213" AssignmentName="GOTO_LEVEL" AssignmentType="2">
                                    <Delay>00:00:00.00</Delay>
                                    <Fade>00:00:00.00</Fade>
                                    <Level>0.00</Level>
                                    <IntegrationID>10</IntegrationID>
                                </PresetAssignment>
                            </PresetAssignments>
                        </Preset>
                    </Presets>
                </Action>
            </Actions>
        </OccupancyGroup>

@JonGilmore
Copy link
Collaborator Author

@cdheiser would appreciate it if you took a look at this PR as you showed up on the git blame from the work you did with #56

@rzulian rzulian mentioned this pull request May 16, 2024
@JonGilmore JonGilmore closed this May 16, 2024
@JonGilmore JonGilmore deleted the fix71 branch May 16, 2024 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Occupancy for everything?
1 participant