Merge the bridge and a home-screen interface into one app

The HEOS app is unpleasant to use for the four things that actually get
done in this house, so this is those four things on one screen: volume
for the Home 400 and the Living Room pair, joining either to the AVR,
splitting them off again, and picking the AVR's input.

The bridge's logic moves in mostly intact, split into a HEOS client, an
AVR client and a controller, with two grouping bugs fixed on the way:

  * Merging a room into the AVR sent only the pair's leader pid, which
    left the second Home 200 behind. Group targets now expand to every
    member pid, and unmerging re-forms the pair rather than leaving two
    lone speakers. The members are learned while the pair is visible and
    remembered in members.json so a restart can still rebuild it.

  * Volume for the pair used its gid, which stops existing the moment it
    joins the AVR's group. It now falls back to the member players.

Both sockets are kept open rather than reconnecting per command, which
is what made every button press feel slow; the AVR connection doubles as
a listener, so input changes made with the physical remote show up too.

The original query-string endpoints still answer, so anything already
pointed at the bridge keeps working.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-14 21:15:43 +02:00
co-authored by Claude Opus 5
parent 86fdf9a4d3
commit 375bcfdd76
20 changed files with 2428 additions and 490 deletions
+66
View File
@@ -0,0 +1,66 @@
"""Everything you might want to change lives here.
Copy the values out of `GET /api/targets` (or the old `/targets`) the
first time you run this, so the names below match exactly what HEOS
reports for your own devices.
"""
# --- Network ----------------------------------------------------------
# Any ONE HEOS device's IP is enough: HEOS is a distributed system, so
# whichever unit you connect to can see and control every player and
# group on the network.
HEOS_HOST = "192.168.0.10"
HEOS_PORT = 1255
# The AVR's classic Denon Telnet control port. Completely separate from
# HEOS, and the only place your *renamed* input list actually lives --
# HEOS itself only knows a fixed set of generic input identifiers.
AVR_HOST = "192.168.0.10"
AVR_PORT = 23
# Port the panel itself listens on.
WEB_PORT = 5005
# --- Rooms ------------------------------------------------------------
# key -> how to find it on the network, and how to label it in the UI.
#
# heos_name : the EXACT name HEOS reports for that player or group.
# players : only for a target that is a HEOS *group* (a stereo pair
# or an In-Room Group). List its member players, leader
# first. Leave it out and the panel learns the members the
# first time it sees the group un-merged, then remembers
# them in members.json -- which is what lets it rebuild the
# pair after you unmerge it from the AVR.
TARGETS = {
"avr": {
"label": "Home Cinema",
"heos_name": "Home Cinema", # AVR-X3800H
},
"home400": {
"label": "Lego Room",
"heos_name": "Lego Room", # Denon Home 400
},
"living_room_group": {
"label": "Living Room",
"heos_name": "Denon Home 200 L", # 2x Denon Home 200, In-Room Group
# "players": ["Denon Home 200 L", "Denon Home 200 R"],
},
}
# The AVR is always the group host: its content takes over every room
# that joins, which is the whole point of the merge buttons.
HOST_KEY = "avr"
# The rooms that get a card with volume + a join/leave button, in order.
ROOM_KEYS = ["home400", "living_room_group"]
# --- Behaviour --------------------------------------------------------
# How many HEOS volume points one tap of +/- moves.
VOLUME_STEP = 2
# Limit the input picker to the sources you actually use, by their SI
# code (see GET /api/avr/inputs for the full list). Empty = show all.
AVR_INPUT_CODES = []
# Shown as the app's name on the iOS home screen.
APP_NAME = "HEOS"