Skip to content

Fix cloud IP fallback and off-state attrs#4

Draft
ejc3 wants to merge 1 commit into
AiDot-Development-Team:mainfrom
ejc3:fix-ip-fallback-and-dev-attr
Draft

Fix cloud IP fallback and off-state attrs#4
ejc3 wants to merge 1 commit into
AiDot-Development-Team:mainfrom
ejc3:fix-ip-fallback-and-dev-attr

Conversation

@ejc3

@ejc3 ejc3 commented Jun 4, 2026

Copy link
Copy Markdown

Summary

This fixes two local-control issues used by the Home Assistant AiDot integration:

  • Fix send_dev_attr() when setting attributes while the light is off. The method attempted to add OnOff to an undefined variable named attr; it should mutate the supplied dev_attr payload.
  • Use the cloud-reported properties.ipAddress as a fallback when UDP discovery has not provided an IP, while keeping UDP discovery authoritative when it succeeds.
  • Expose a read-only ip_address property so integrations do not need to read _ip_address directly.

Details

DeviceClient.send_dev_attr() currently raises NameError for calls such as brightness/color/CCT while the device is off, because the code uses attr[CONF_ON_OFF] instead of dev_attr[CONF_ON_OFF].

AidotClient.get_device_client() now reads properties.ipAddress defensively only when properties is a dict. If UDP discovery has a current IP, that still wins. If not, the cloud IP is used as a best-effort LAN fallback, including when the previous IP is disconnected.

Validation

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