Conversation
|
Hey there @dmulcahey, @Adminiuga, mind taking a look at this pull request as it has been labeled with an integration ( |
| zha_gateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY] | ||
| ieee = msg[ATTR_IEEE] | ||
| zha_gateway: ZHAGateway = hass.data[DATA_ZHA][DATA_ZHA_GATEWAY] | ||
| ieee: EUI64 = msg[ATTR_IEEE] |
There was a problem hiding this comment.
Typing for msg[ATTR_IEEE] isn't perfect yet, since the validator EUI64.convert could also return None if None is passed. Thus technically all ieee variables should be EUI64 | None.
That is unpractical as almost always only EUI64 is expected. For now I decided to use the optional variant only in combination with msg.get(ATTR_IEEE).
There was a problem hiding this comment.
To followup on it, I checked all websocket endpoints and service calls. As expected, almost all values for IEEE are required and thus it's safe to assume EUI64 for ATTR_IEEE. The exception here is the ´permit´ service / endpoint that is the only one for which it's optional.
PR to update the schema validators: #68353
Proposed change
Followup to #68220
Continue typing
zha/api.py.ZHAGatewayinstead ofZhaGatewayType. Type checkers can't handle the redefinition fromstrto a type in core/typing.py. A temporary fix would be to put the str defs in theelseclause forif TYPE_CHECKING. However it's much better to use the correct types directly anyway. -> With the next PRs, I'll successively replace these aliases.hass.data[DATA_ZHA][DATA_ZHA_GATEWAY]->ZHAGatewayType of change
Additional information
Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: