Sync with the relay's current API: all effects, groups, scenes - #8
Merged
Merged
Conversation
The relay grew per-pixel addressing, spatial effects and a field renderer;
the integration was still pinned to the eight effects it shipped with and
to a single whole-room light.
Ask the relay what it can do instead of hardcoding it. At setup the hub
reads GET /effects for the effect list and each effect's parameters, /info
for the scenes, and /config for group membership — so the relay's current
seventeen effects (comet, snake, and the seven field effects on top of the
original eight) show up without an integration release.
Entities gained a group light per relay group and a scene entity per relay
scene. Everything now hangs off one shared hub, so a config entry holds a
single /events subscription no matter how many entities it creates, rather
than one stream per entity.
Effects that take parameters — direction, spread, x/y, diameter — can't be
driven through HA's effect picker, which passes a name and nothing else, so
artnet_relay.start_effect and .stop_effect take the parameter bag straight
through to the relay.
Also fixes _attr_effect: the relay reports the running effect as
{"name": ..., "params": {...}} and the whole dict was being handed to Home
Assistant where a name string belongs.
Verified the discovery parsing against the live relay at 10.32.8.50:8000
(17 effects, 4 scenes, 5 groups of 8, 40 strips).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The relay grew per-pixel addressing, spatial effects and a field renderer. This integration was still pinned to the eight effects it shipped with and to a single whole-room light.
What changed
Ask the relay what it can do. At setup the new hub reads
GET /effects(names + each effect's parameters and defaults),/info(scenes) and/config(group membership). The relay's current seventeen effects —comet,snake, and the field effectsspot,ripple,plasma,blobs,tunnel,sweep,auroraon top of the original eight — now appear without an integration release.New entities. A light per relay group (
POST /groups/{name}) and a scene entity per relay scene (POST /scenes/{name}). Effects stay on the whole-relay light, since the relay runs them rig-wide.One SSE stream per config entry. Everything hangs off a shared
hub.py, so the relay sees a single/eventssubscriber no matter how many entities Home Assistant creates. Previously each entity would have opened its own.Services for parameterised effects. HA's effect picker passes a name and nothing else, so
artnet_relay.start_effect/.stop_effecthand the parameter bag (direction,spread,x/y,diameter, …) straight through to the relay.Bug fix
_attr_effectwas being set to the relay's{"name": ..., "params": {...}}dict where Home Assistant expects the effect name.Verification
python -m unittest discover -s tests). The newtests/test_hub.pystubs the handful of Home Assistant and aiohttp nameshub.pyimports, so CI stays dependency-free.10.32.8.50:8000: 17 effects with their parameter defaults, 4 scenes, 5 groups of 8, 40 strips. Read-only calls only.Also bumps the manifest to
0.2.0, addsstrings.json+translations/en.json, and refreshes the vendoredopenapi.json.🤖 Generated with Claude Code