fix(nedis_pilldispenser): correct dp 102 masks, add alarm status sensors - #6082
Draft
MartinNuc wants to merge 1 commit into
Draft
fix(nedis_pilldispenser): correct dp 102 masks, add alarm status sensors#6082MartinNuc wants to merge 1 commit into
MartinNuc wants to merge 1 commit into
Conversation
The dp 102 masks were aligned to the wrong end of the payload. The real payload is 30 bytes, so masks of 32 bytes made every field decode from the alarm status bytes (B21-B29) instead of B0-B7, and all of them read 0 or off. Masks are now the same width as the payload, with each byte in its documented position. Verified against real hardware (Nedis WIFIPD10WT): total compartments now reads 28, loaded 8, and battery percent, plug and lid all match the physical device. Adds sensors for the per-alarm status bytes (B21-B29). These are the only local source of "medication taken" on this device, as dp 103 and dp 135 are never sent over the LAN and are not answered when requested explicitly. Also fixes the battery binary_sensor constraint, which compared integers against battery_state's mapped string values, so it never matched and the entity stayed unknown. Refs make-all#3357 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
I have this device (Nedis WIFIPD10WT) and tested all of this against it.
The dp 102 masks are the wrong width. The payload is 30 bytes but the masks are 32, so every field was read from the alarm-status bytes at the end of the payload instead of the status bytes at the start — everything decoded as 0 or off.
Real dp 102 payload from my device:
00002b001c0805030000b302000000000000000000070000000000000000I also added sensors for the per-alarm status bytes (B21–B29). On my device dp 103 and dp 120 never arrive over the LAN, and are not answered when requested explicitly, so these bytes are the only local way to see whether a dose was taken. Confirmed live: alarm 2 went
waiting→missed→taken_after_missingacross a real dose.Finally, the battery binary_sensor: its constraint compares integers (
2,[0, 1, 3]) againstbattery_state, but that dp maps its values to strings first, so nothing ever matched and the entity stayedunknown. It now compares the mapped names, and readsoffwithbattery_state: fullon my device.The config was originally created from the cloud data model in #3357 without hardware to test against, which is presumably why the mask alignment was never caught.