Remove group management
Deploy HEOS panel / deploy (push) Successful in 25s

This commit is contained in:
2026-09-16 13:43:31 +02:00
parent 5b82a24ac4
commit 58a2dedc03
15 changed files with 358 additions and 588 deletions
+50 -48
View File
@@ -5,6 +5,7 @@ first time you run this, so the names below match exactly what HEOS
reports for your own devices.
"""
import json
import os
from pathlib import Path
@@ -27,63 +28,62 @@ def _load_dotenv(path: Path):
_load_dotenv(Path(__file__).resolve().parent / ".env")
# --- 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
# Port the panel itself listens on.
WEB_PORT = 5443
# --- Rooms ------------------------------------------------------------
# key -> how to find it on the network, and how to label it in the UI.
# --- Rooms, ports & behaviour -------------------------------------------
# None of this is sensitive -- it doesn't give away anything about your
# LAN or credentials -- but it's still yours, not the app's: buying a
# speaker, renaming a room, or changing a port is a config edit, not a
# code change. Lives in config.json rather than here or in .env; copy
# config.json.example to get started.
#
# 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.
# heos_name : the EXACT name HEOS reports for that player -- including
# an In-Room Group like a stereo pair, which HEOS pairs at
# the hardware level into one player, one pid, always.
# spotify_name : only needed if a room's Spotify Connect name differs
# from heos_name -- GET /api/spotify/devices?account=fifou shows what
# from heos_name -- GET /api/spotify/devices?account=account1 shows what
# Spotify actually calls it. Defaults to heos_name.
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
"spotify_name": "Living Room", # what Spotify Connect calls the pair
# "players": ["Denon Home 200 L", "Denon Home 200 R"],
},
}
_config_path = Path(__file__).resolve().parent / "config.json"
try:
_cfg = json.loads(_config_path.read_text())
except FileNotFoundError:
raise SystemExit(
f"{_config_path} not found -- copy config.json.example to config.json "
"and fill in your own rooms (see the README's Configure section)."
)
TARGETS = _cfg["targets"]
# 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"
HOST_KEY = _cfg["host_key"]
# The rooms that get a card with volume + a join/leave button, in order.
ROOM_KEYS = ["home400", "living_room_group"]
ROOM_KEYS = _cfg["room_keys"]
# --- Behaviour --------------------------------------------------------
# The grid the volume buttons snap to. A tap moves to the next multiple of
# this rather than adding it, so at 5 a level of 23 goes to 25, not 28.
VOLUME_STEP = 5
VOLUME_STEP = _cfg["volume_step"]
# Narrows the AVR's input picker to the sources you actually use, by their
# HEOS input id (see GET /api/avr/inputs for the exact strings, e.g.
# "inputs/aux_in_1"), and sets their order in the list. Empty = every
# source HEOS reports for it.
AVR_INPUT_CODES = []
# Port the panel itself listens on.
WEB_PORT = _cfg["web_port"]
# --- 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. A LAN address isn't a credential, so it lives
# here rather than in .env -- just don't publish this file if your LAN
# is reachable from outside it.
HEOS_HOST = _cfg["heos_host"]
HEOS_PORT = _cfg["heos_port"]
# --- Zidoo (optional) ---------------------------------------------------
# A Zidoo media player plugged into one of the AVR's inputs. HEOS only
# knows that input is selected, not what the Zidoo is actually showing, so
# its "now playing" comes from the Zidoo's own HTTP API instead -- queried
# only while ZIDOO_INPUT_CODE is the AVR's selected input. Leave
# zidoo_host out of config.json if there is no Zidoo to ask.
ZIDOO_HOST = _cfg.get("zidoo_host")
ZIDOO_PORT = _cfg["zidoo_port"]
ZIDOO_INPUT_CODE = "inputs/mediaplayer" # see GET /api/avr/inputs
# Shown as the app's name on the iOS home screen.
APP_NAME = "Heos"
@@ -98,8 +98,10 @@ SPOTIFY_CLIENT_ID = os.environ.get("SPOTIFY_CLIENT_ID")
SPOTIFY_CLIENT_SECRET = os.environ.get("SPOTIFY_CLIENT_SECRET")
# key -> button label and that account's refresh token, in button order.
# An account without a token gets no button.
# An account without a token gets no button. The label comes from
# spotify_accounts in config.json -- e.g. "account1": "Fifou".
_spotify_names = _cfg.get("spotify_accounts", {})
SPOTIFY_ACCOUNTS = {
"fifou": {"label": "Fifou", "refresh_token": os.environ.get("SPOTIFY_FIFOU_REFRESH_TOKEN")},
"clarita": {"label": "Clarita", "refresh_token": os.environ.get("SPOTIFY_CLARITA_REFRESH_TOKEN")},
"account1": {"label": _spotify_names.get("account1", "Account 1"), "refresh_token": os.environ.get("SPOTIFY_ACCOUNT1_REFRESH_TOKEN")},
"account2": {"label": _spotify_names.get("account2", "Account 2"), "refresh_token": os.environ.get("SPOTIFY_ACCOUNT2_REFRESH_TOKEN")},
}