Chef iQ CQ60: mask not-measured probe sentinels as None#1538
Open
ITSpecialist111 wants to merge 1 commit intocustom-components:masterfrom
Open
Chef iQ CQ60: mask not-measured probe sentinels as None#1538ITSpecialist111 wants to merge 1 commit intocustom-components:masterfrom
ITSpecialist111 wants to merge 1 commit intocustom-components:masterfrom
Conversation
When a CQ60 ring sensor has nothing in contact with it (probe partially inserted, broken probe wire, ring exposed to air) the firmware emits 0x7FFB on the H temperature fields and 0xFE/0xFF on the 8-bit probe-3 byte. The current parser passes those through as ~3,276 C, which trips Home Assistant's temperature device-class limits and shows nonsense values on graphs and triggers spurious alerts. Mask any uint16 reading >= 0x7FF0, and any probe-3 byte >= 0xFE, to None so the resulting HA entity becomes 'unavailable' instead. Existing valid-data test continues to pass; a new test_chefiq_cq60_sentinels case exercises the masking path.
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.
Summary
When a Chef iQ CQ60 ring sensor has nothing touching it (probe only partially inserted, exposed to ambient air, or a broken internal wire) the firmware emits a "not-measured" sentinel rather than a real reading:
H(uint16, °C × 10)0x7FFB(and any value>= 0x7FF0)B(uint8, °C)0xFE/0xFFThe current parser divides those through unchanged, which surfaces in Home Assistant as
3276.3 °Con the affected entities. That:temperaturedevice-class sanity limits and pollutes recorder/statistics graphs,numeric_state: above: 60trigger the moment the device wakes,I observed this on a real CQ60 (manufacturer ID
0x05CD, MACD9:38:36:2E:33:73) — every wake cycle where only the meat probe was inserted producedmeat = 20.1,tip = 20.1,probe_1 = probe_2 = ambient = 3276.3.Change
Add a tiny
_decode_temp(raw)helper plus aTEMP_SENTINEL_MIN = 0x7FF0constant, and route everyH-encoded ring temperature through it. The 8-bitprobe_3is masked separately (< 0xFE). Any sentinel becomesNone, so the resulting HA entity reports asunavailableinstead of an absurd value.Battery scaling is deliberately unchanged in this PR — the existing test asserts
battery == 99from a raw0x63byte, and I haven't been able to confirm from public docs whether the firmware reports a 0–100 percentage or a raw 0–255 byte (my device emits0xCC/ 204 when freshly charged, which would suggest the latter). Happy to follow up in a separate PR with a scaling change once that's nailed down — I didn't want to entangle it with the (clearer) sentinel correctness fix.Tests
test_chefiq_cq60is unchanged and still passes — the sample packet has no sentinel values.test_chefiq_cq60_sentinelscase feeds an otherwise-identical packet with every ring temperature set to its sentinel and asserts that all six temperature fields decode toNonewhile battery / MAC / type still populate normally.Risk
Zero behaviour change for any payload that doesn't contain a sentinel. The masking only affects values that the receiving HA
temperaturesensor would have rejected (or graphed as a 3,000 °C spike) anyway.