Skip to content

vNext: Accept a scan reply without cid - #547

Merged
RobHofmann merged 1 commit into
RobHofmann:5.0-devfrom
Twintop:fix-scan-without-cid
Oct 9, 2026
Merged

RobHofmann merged 1 commit into
RobHofmann:5.0-devfrom
Twintop:fix-scan-without-cid

Conversation

@Twintop

@Twintop Twintop commented Oct 9, 2026

Copy link
Copy Markdown

Context

This is a bug fix in preparation for Gree zone controller support. I found it while porting the changes I made for my own zone controller (Gree LE60-13/GH) to this project. The zone controller support itself will come in a later PR. Background and the full plan: https://github.com/Twintop/ha-gree-zone-controller/blob/main/upstream/README.md

Symptom

A Gree LE60-13/GH zone controller (WiFi module ME31-00/C13, firmware 362001062617+U-W05SAV1.27.bin) cannot be discovered at all. Discovery of its IP fails with:

pydantic_core._pydantic_core.ValidationError: 1 validation error for DeviceScanInfoResponse
cid
  Field required [type=missing, input_value={'t': 'dev', ...}, input_type=dict]

Cause

The unit answers the scan with a dev pack that has no cid:

{"t":"dev","bc":"gree","catalog":"gree","mid":"50","lock":0,"model":"gree","name":"GR-ZCntrlr_5000_02_ffee_EC","series":"gree","vender":"2","ver":"V1.2.1","brand":"gree","mac":"9424b8c0ffee","subCnt":5}

DeviceScanInfoResponse requires cid, so _process_local_scan_response() raises before anything else runs. Nothing in the integration reads cid.

Change

  • cid is optional in DeviceScanInfoResponse.
  • New test test_a_scan_reply_without_cid_is_accepted, with a fake device whose scan reply has no cid. It fails with the error above without this change.
  • One line in docs/protocol.md.

Testing

  • pytest: 255 passed (the 254 before, plus the new test).
  • Ruff passes. Mypy and Pylint show nothing new compared with 5.0-dev. I ran them without Home Assistant installed, so I compared the findings with the base branch.
  • Real device, LE60-13/GH zone controller: before the change, discovery of its IP raised the error above. With the change, discovery returns the 5 sub-units behind it.

Some devices answer the scan with a dev pack that has no cid. A Gree
LE60-13/GH zone controller does that. DeviceScanInfoResponse required the
field, so validation failed and the device could not be discovered at all.

Nothing reads cid, so it is now optional. A test covers a scan reply
without it.
@Twintop Twintop changed the title Accept a scan reply without cid vNext: Accept a scan reply without cid Oct 9, 2026

@RobHofmann RobHofmann left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is a clean fix.

  • Confirmed nothing reads cid from the scan reply; _process_local_scan_response only uses mac, name and the optional fields.
  • The new test fails on 5.0-dev with the exact ValidationError and passes with the change. Full suite: 255 passed.
  • Ran it on my dev instance against my own unit (which does send cid): binds and polls normally, no errors. I could not test the zone controller path myself.

The Ruff failure is unrelated: CI picked up Ruff 0.17.0 today, which flags the existing import in const.py. The last 5.0-dev run used 0.16.10 and passed. I will fix that separately.

@RobHofmann
RobHofmann merged commit eeb96f4 into RobHofmann:5.0-dev Oct 9, 2026
3 of 4 checks passed
RobHofmann added a commit that referenced this pull request Oct 9, 2026
Lint installed ruff>=0.16.3, so CI picked up Ruff 0.17.0 the day it came
out. 0.17 sorts an import with a trailing pragma comment differently, and
const.py failed I001 on every push and PR since #547. None of #547, #548
or #549 touched const.py.

0.16.10 and 0.17.0 want opposite forms of that import, so no code passes
both. Pin Ruff to an exact version in lint.yml and requirements_dev.txt
so a new release cannot break CI again, and apply the 0.17 fix.
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.

2 participants