Skip to content

Add get_configuration/set_configuration for device settings - #16

Open
gabrielmazor wants to merge 3 commits into
Guy293:masterfrom
gabrielmazor:feat/device-configuration
Open

gabrielmazor wants to merge 3 commits into
Guy293:masterfrom
gabrielmazor:feat/device-configuration

Conversation

@gabrielmazor

Copy link
Copy Markdown

Closes #6.

Adds get_configuration() and set_configuration() to Tami4EdgeAPI.py, wrapping the /api/v3/device/{id}/configuration endpoint (verified against a real device, firmware 4.1.29):

  • get_configuration() returns the configurationProperties dict as-is (no dataclass — firmware versions expose different key sets, so a fixed schema would raise KeyError on bars with fewer keys).
  • set_configuration(**properties) POSTs only the given properties; partial payloads merge server-side, so no read-modify-write is needed.
  • set_configuration() refuses to write connectivityEnabled, raising UnsafeConfigurationException. Disabling it may take the device off the cloud, which is the only channel able to turn it back on. Reads are unaffected.
  • Note for reviewers: writes aren't visible via get_configuration() for a few seconds after the POST — a read issued immediately after a write will still show the old value.

Bumped version to 3.1 in setup.py and documented the new methods in the README.

I've also built a Home Assistant switch platform on top of this, exposing the LED lighting plus six other device settings, which I'd like to upstream to home-assistant/core. I've been running it against my own bar and it works well. That PR is blocked on Tami4EdgeAPI==3.1 being on PyPI, since manifest.json pins exact versions and your publish workflow runs on release — would you be able to cut a 3.1 release once this looks good to you? Happy to make any changes you'd like first.

@Guy293

Guy293 commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Hi Gabriel, thank you very much for the contribution. I will be able to test it against my own device this weekend then I'll accept the PR.
I appreciate your help 🙏🏼

@gabrielmazor
gabrielmazor force-pushed the feat/device-configuration branch from 4b3c651 to 5c672f8 Compare September 2, 2026 06:24
Exposes the device configuration endpoint (lighting, child lock, etc.)
so downstream integrations like Home Assistant can read and toggle
these settings. Partial POSTs merge server-side; changes propagate to
reads after a few seconds.
Disabling connectivity may take the device off the cloud, which is the
only channel able to turn it back on. set_configuration now raises
UnsafeConfigurationException rather than sending it. Reads are
unaffected and still return the property.
@gabrielmazor
gabrielmazor force-pushed the feat/device-configuration branch from 5c672f8 to 574fd82 Compare September 2, 2026 13:57
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.

Tami4 Light Toggle

2 participants