Skip to content

Chef iQ CQ60: mask not-measured probe sentinels as None#1538

Open
ITSpecialist111 wants to merge 1 commit intocustom-components:masterfrom
ITSpecialist111:chefiq-cq60-battery-and-sentinel-fix
Open

Chef iQ CQ60: mask not-measured probe sentinels as None#1538
ITSpecialist111 wants to merge 1 commit intocustom-components:masterfrom
ITSpecialist111:chefiq-cq60-battery-and-sentinel-fix

Conversation

@ITSpecialist111
Copy link
Copy Markdown

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:

Field Type Sentinel
meat / tip / probe 1 / probe 2 / ambient H (uint16, °C × 10) 0x7FFB (and any value >= 0x7FF0)
probe 3 B (uint8, °C) 0xFE / 0xFF

The current parser divides those through unchanged, which surfaces in Home Assistant as 3276.3 °C on the affected entities. That:

  • trips the temperature device-class sanity limits and pollutes recorder/statistics graphs,
  • fires any user automations with a numeric_state: above: 60 trigger the moment the device wakes,
  • makes a "doneness" template entity flip into "well done" before any food is even on the probe.

I observed this on a real CQ60 (manufacturer ID 0x05CD, MAC D9:38:36:2E:33:73) — every wake cycle where only the meat probe was inserted produced meat = 20.1, tip = 20.1, probe_1 = probe_2 = ambient = 3276.3.

Change

Add a tiny _decode_temp(raw) helper plus a TEMP_SENTINEL_MIN = 0x7FF0 constant, and route every H-encoded ring temperature through it. The 8-bit probe_3 is masked separately (< 0xFE). Any sentinel becomes None, so the resulting HA entity reports as unavailable instead of an absurd value.

Battery scaling is deliberately unchanged in this PR — the existing test asserts battery == 99 from a raw 0x63 byte, 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 emits 0xCC / 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

  • The existing test_chefiq_cq60 is unchanged and still passes — the sample packet has no sentinel values.
  • A new test_chefiq_cq60_sentinels case feeds an otherwise-identical packet with every ring temperature set to its sentinel and asserts that all six temperature fields decode to None while 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 temperature sensor would have rejected (or graphed as a 3,000 °C spike) anyway.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant