fix: resolve 4 bugs found in HA integration code review
- Auto-authorize HA events in gateway (system-generated, not user messages) - Guard _read_events against None/closed WebSocket after failed reconnect - Use UUID for send() message_id instead of polluting WS sequence counter - entity_id parameter now takes precedence over data["entity_id"]
This commit is contained in:
parent
b32c642af3
commit
2390728cc3
4 changed files with 16 additions and 6 deletions
|
|
@ -130,13 +130,13 @@ class TestBuildServicePayload:
|
|||
payload = _build_service_payload()
|
||||
assert payload == {}
|
||||
|
||||
def test_data_does_not_overwrite_entity_id(self):
|
||||
def test_entity_id_param_takes_precedence_over_data(self):
|
||||
payload = _build_service_payload(
|
||||
entity_id="light.a",
|
||||
data={"entity_id": "light.b"},
|
||||
)
|
||||
# data.update overwrites entity_id set earlier
|
||||
assert payload["entity_id"] == "light.b"
|
||||
# explicit entity_id parameter wins over data["entity_id"]
|
||||
assert payload["entity_id"] == "light.a"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue