Skip to content

Sync with the relay's current API: all effects, groups, scenes - #8

Merged
BernardJen merged 1 commit into
mainfrom
feat/sync-relay-api-effects-scenes-groups
Aug 25, 2026
Merged

Sync with the relay's current API: all effects, groups, scenes#8
BernardJen merged 1 commit into
mainfrom
feat/sync-relay-api-effects-scenes-groups

Conversation

@BernardJen

Copy link
Copy Markdown
Collaborator

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 effects spot, ripple, plasma, blobs, tunnel, sweep, aurora on 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 /events subscriber 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_effect hand the parameter bag (direction, spread, x/y, diameter, …) straight through to the relay.

Bug fix

_attr_effect was being set to the relay's {"name": ..., "params": {...}} dict where Home Assistant expects the effect name.

Verification

  • 10 unit tests pass (python -m unittest discover -s tests). The new tests/test_hub.py stubs the handful of Home Assistant and aiohttp names hub.py imports, so CI stays dependency-free.
  • Discovery parsing run against the live relay at 10.32.8.50:8000: 17 effects with their parameter defaults, 4 scenes, 5 groups of 8, 40 strips. Read-only calls only.
  • Not yet loaded in a running Home Assistant instance — hassfest and HACS validation run on this PR.

Also bumps the manifest to 0.2.0, adds strings.json + translations/en.json, and refreshes the vendored openapi.json.

🤖 Generated with Claude Code

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).
@BernardJen
BernardJen merged commit 84c4b6d into main Aug 25, 2026
2 of 3 checks passed
@BernardJen
BernardJen deleted the feat/sync-relay-api-effects-scenes-groups branch August 25, 2026 20:58
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