gurumitts / pylutron-caseta

Apache License 2.0
153 stars 97 forks source link

Add occupancy sensor support for RA3 processors #107

Closed danaues closed 2 years ago

danaues commented 2 years ago

This PR adds support for occupancy sensors for RA3 processors

The RA3 processor does not allow us to query the /occupancygroup URL like we can with Caseta.

I can query all the devices and filter by DeviceType "RPSOccupancySensor" to discover the sensors, and then extract the associated areas. We can also query /area/status , but the processor returns areas that do not have sensors, so we end up with occupancy groups that will never have a status other than Unknown. The DeviceType method ensures we are only exposing areas that have a sensor.

Subscribing to /area/status allows us to retrieve occupancy updates from the processor.

Tested on RA3 Processor, and Caseta Pro bridge. I only have 1 occupancy sensor, but I've simulated multiple sensors, including 2 sharing an area in the tests.

danaues commented 2 years ago

Thx!