Skip to content

Race condition during status update? #7

@sgruby

Description

@sgruby

I'm using your component in Home Assistant with a DSC security system and generally it is working well. However, last night I had an issue where closing a door showed up as closed in HA, but then immediately showed up as open and then within maybe 30 seconds went back to closed. This, of course, is problematic as opening the door turns on the light and the open causes it to turn on again after I turned it off.

I believe that there may be a race condition whereby you query for a zone dump, are waiting for a response, get the status change and then when the zone dump comes in, it overwrites the status change. I've changed my zone dump interval to 86400 to reduce this possibility and my testing has not encountered this issue again.

While I'm not sure the logic to handle this (maybe if there is a status update, cancel the zone update and wait for the next zone update), how about adding an option for 0 for the zone dump interval? Looking through the code, I think that passing a 0 to asyncio.sleep for the delay will cause no delay.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions