Open
Conversation
tahnok
reviewed
Aug 15, 2025
Owner
tahnok
left a comment
There was a problem hiding this comment.
Thank you! I'm going to give this a spin on my ring, but overall it looks good and I appreciate the tests
| SleepType type; | ||
| uint8_t minutes; | ||
| } | ||
| enum SleepType : uint8_t { |
Owner
There was a problem hiding this comment.
Can you pull this into IntEnum like https://github.com/tahnok/colmi_r02_client/blob/firehose/colmi_r02_client/real_time.py#L16 ? I much prefer REM to 4 when looking through stuff
| logger.warning("Invalid BigData sleep packet") | ||
| return None | ||
| data_len = int.from_bytes(packet[2:4], 'little') | ||
| crc16 = int.from_bytes(packet[4:6], 'little') |
Owner
There was a problem hiding this comment.
This works fine, no need to change, but have you seen struct ?
|
|
||
| UART_SERVICE_V2_UUID = "DE5BF728-D711-4E47-AF26-65E3012A5DC7" | ||
| UART_RX_CHAR_V2_UUID = "DE5BF72A-D711-4E47-AF26-65E3012A5DC7" | ||
| UART_TX_CHAR_V2_UUID = "DE5BF729-D711-4E47-AF26-65E3012A5DC7" |
Owner
There was a problem hiding this comment.
Gonna have to think about this, it's a bit more complex then I like
Owner
|
Tested last night and it recorded some sleep! |
tahnok
pushed a commit
that referenced
this pull request
Dec 25, 2025
Converts the SleepType enum from comment-based documentation to a proper Python IntEnum for better code readability and type safety. Changes: - Add SleepType IntEnum with values: NODATA(0), ERROR(1), LIGHT(2), DEEP(3), REM(4), AWAKE(5) - Update SleepPeriod.type field to use SleepType instead of int - Update parse_bigdata_sleep_response to convert packet bytes to SleepType enum values - Update all tests to use SleepType enum instead of magic numbers - Update docstring to reference SleepType enum This makes debugging easier as logs will show "REM" instead of "4", improving code maintainability per PR #52 feedback.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add support for handling and storing sleep data from "Big Data" packets.
Resolves #20