Reduce number of followup commands for area on/off events. #42
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.
Hopefully this will also reduce the probability of triggering dropped commands.
Only fetch the history if it is empty.
This is not 100% correct, because it is possible that though the initial load didn't happen because the panel was armed, some history were delivered via the subscription. However, it seems we already don't handle that, because the inserted history event will cause last_event_id to be current.
Drop load_faults on area on/off.
Thinking about this more, it is not actually necessary. Even if the history could not be fetched at startup, the faults should've been. If there were any history events since, those would already have been followed up.
Delay the history fetch.
Sleeps are gross, but it does seem that the panels are somehow more prone to losing commands immediately after disarm.