DouweM / homebridge-unifi-occupancy

Homebridge plugin that adds HomeKit occupancy sensors for selected devices (and people) on your UniFi network to the iOS Home app: quickly see who's where and automate accordingly.
Apache License 2.0
42 stars 1 forks source link

Plugin removes device specific sensors when router (Dream machine pro) reboots #25

Open ArneLibbrecht opened 8 months ago

ArneLibbrecht commented 8 months ago

Describe The Bug: When rebooting the unifi network all device specific occupancy sensors are removed. After the reboot they are recreated as new accessories, which means that they need to be assigned again to the correct room in homekit and that any automation with the sensor needs to be recreated.

To Reproduce: Start from a configuration with sensors assigned to rooms and renamed in homekit and applied in an automation. Reboot the unifi network.

Expected behavior: I expect the plugin to never remove occupancy sensors automatically or have an option to disable this behavior.

Logs:

No logs of the event since homebridge has been restarted after.

Plugin Config:

{
    "unifi": {
        "controller": ****
        "username": ****,
        "password": ****,
        "site": "default",
        "secure": false,
        "unifios": true
    },
    "interval": 10,
    "showAsOwner": "smart_watch",
    "deviceType": {
        "smartphone": {
            "enabled": true,
            "homeAccessory": false,
            "roomCatchallAccessory": true,
            "homeCatchallAccessory": false,
            "lazy": true
        },
        "smart_watch": {
            "enabled": false,
            "homeAccessory": false,
            "roomCatchallAccessory": false,
            "homeCatchallAccessory": false,
            "lazy": false
        },
        "laptop": {
            "enabled": false,
            "homeAccessory": false,
            "roomCatchallAccessory": false,
            "homeCatchallAccessory": false,
            "lazy": false
        },
        "tablet": {
            "enabled": false,
            "homeAccessory": false,
            "roomCatchallAccessory": false,
            "homeCatchallAccessory": false,
            "lazy": false
        },
        "ereader": {
            "enabled": false,
            "homeAccessory": false,
            "roomCatchallAccessory": false,
            "homeCatchallAccessory": false,
            "lazy": false
        },
        "game_console": {
            "enabled": false,
            "homeAccessory": false,
            "roomCatchallAccessory": false,
            "homeCatchallAccessory": false,
            "lazy": false
        },
        "handheld": {
            "enabled": false,
            "homeAccessory": false,
            "roomCatchallAccessory": false,
            "homeCatchallAccessory": false,
            "lazy": false
        },
        "other": {
            "enabled": false,
            "homeAccessory": false,
            "lazy": false
        },
        "wired": {
            "enabled": false
        }
    },
    "clientRules": [
        {
            "roomAccessory": true,
            "homeAccessory": false,
            "roomCatchallAccessory": false,
            "homeCatchallAccessory": false,
            "lazy": true
        }
    ],
    "accessPointAliases": [
        {
            "accessPoint": "***",
            "alias": "***"
        },
        {
            "accessPoint": "***",
            "alias": "***"
        }
    ],
    "server": {
        "enabled": false,
        "port": 8582
    },
    "platform": "UnifiOccupancy"
}

Screenshots: Not applicable

Environment: