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

Add support for ring counter #468

Open
spacemanspiff2007 opened this issue Dec 16, 2024 · 0 comments
Open

Add support for ring counter #468

spacemanspiff2007 opened this issue Dec 16, 2024 · 0 comments
Assignees
Labels
feature request New feature

Comments

@spacemanspiff2007
Copy link
Owner

Shelly blue messages contain a counter which goes from 0 .. 255 and then starts again at 0.
Create an implementation that allows ignoring already processed messages.
Something like that:

        skip_last = 10
        min_nr = self.last_packet - skip_last

        if min_nr <= packet <= self.last_packet:
            return None
        if min_nr < 0 and packet >= 255 + min_nr:
            return None
        self.last_packet = packet
@spacemanspiff2007 spacemanspiff2007 self-assigned this Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature
Projects
None yet
Development

No branches or pull requests

1 participant