From 5df108c70135b9a3ca4a5c83a3e5993c0b571ad6 Mon Sep 17 00:00:00 2001 From: Jonathan Keslin Date: Mon, 16 Nov 2026 15:00:57 -0800 Subject: [PATCH 1/3] Add support for Poseidon M60 --- README.md | 15 ++++ custom_components/ultimea/device.py | 25 ++++-- custom_components/ultimea/media_player.py | 8 +- custom_components/ultimea/profiles.py | 85 ++++++++++++++++++ custom_components/ultimea/runtime.py | 24 +++-- docs/PROTOCOL.md | 38 ++++++++ tests/fixtures/poseidon_m60_diagnostic.json | 19 ++++ tests/test_poseidon_m60.py | 99 +++++++++++++++++++++ 8 files changed, 297 insertions(+), 16 deletions(-) create mode 100644 tests/fixtures/poseidon_m60_diagnostic.json create mode 100644 tests/test_poseidon_m60.py diff --git a/README.md b/README.md index 60c6580..180d7df 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ | --- | --- | | ULTIMEA Poseidon D80 Boom (U2623) | ✅ Hardware verified | | ULTIMEA Poseidon D70 | 🧪 Reporter-confirmed: volume, ARC/Optical/Bluetooth/AUX/USB, mute and power-off; BLE power-on unavailable | +| ULTIMEA Poseidon M60 | ✅ Wire verified: power on/off, volume, mute, eARC/Optical/Bluetooth/USB and Movie/Music/Voice/Sport/Night/Game/Custom modes | | ULTIMEA Aura A40 (V56) | 🧪 Confirmed BLE discovery and read-only state; no verified write controls | | Other ULTIMEA devices that pass the APK common/custom protocol probe | 🧪 Experimental, capability-driven/read-only writes unless proven | @@ -87,6 +88,20 @@ The INFO source decoder is restricted to the D70's documented inputs does not prove them. See [issue #4](https://github.com/Chreece/HA-Ultimea/issues/4). The D80 and Aura A40 profiles remain independent. +## Poseidon M60 support + +The Poseidon M60 is a separate, wire-verified profile. It exposes power on and +off (including **BLE power-on from standby**), absolute volume, mute, the four +physical inputs (**eARC, Optical, Bluetooth and USB**) and **Movie, Music, +Voice, Sport, Night, Game and Custom EQ** sound modes. It intentionally does +not expose AUX or HDMI. + +The M60 reports eARC as `INFO 01:06=10`, matching its `02:02 10` setter; +this differs from the D80/D70 INFO eARC response. Its Custom selection is +`02:04 08`. Although that selection returns a 41-byte frequency table, no +writable M60 band-gain curve was captured, so the integration does not create +the D80-only EQ number entities or Style actions. + ## Poseidon D80 Boom entities ### Media player diff --git a/custom_components/ultimea/device.py b/custom_components/ultimea/device.py index 71939a8..b6dc210 100644 --- a/custom_components/ultimea/device.py +++ b/custom_components/ultimea/device.py @@ -49,13 +49,11 @@ MINUTES_TO_STANDBY, PROMPT_SOUND_TO_VALUE, SCREEN_TIMEOUT_TO_VALUE, - SOUND_MODE_TO_VALUE, TRANSPORT_COMMON, TRANSPORT_UUIDS, VALUE_TO_BRIGHTNESS, VALUE_TO_PROMPT_SOUND, VALUE_TO_SCREEN_TIMEOUT, - VALUE_TO_SOUND_MODE, Brightness, Feature, PromptSound, @@ -64,7 +62,15 @@ Source, ) from .models import UltimeaCapabilities, UltimeaIdentity, UltimeaState -from .profiles import can_turn_on, can_write_feature, decode_source_value, profile_for_model, source_value_for_model +from .profiles import ( + can_turn_on, + can_write_feature, + decode_sound_mode_value, + decode_source_value, + profile_for_model, + sound_mode_value_for_model, + source_value_for_model, +) from .protocol import UltimeaFrame, build_command, decode_ascii, iter_frames _LOGGER = logging.getLogger(__name__) @@ -566,7 +572,7 @@ def _handle_control_frame(self, frame: UltimeaFrame) -> bool: return True if frame.command == CMD_SOUND_MODE and len(data) == 1: self.state.raw_sound_mode = data[0] - mode = VALUE_TO_SOUND_MODE.get(data[0]) + mode = decode_sound_mode_value(self.identity.model, data[0]) if mode is not None: self.state.sound_mode = mode return True @@ -614,7 +620,7 @@ def _handle_info_frame(self, frame: UltimeaFrame) -> bool: return True if frame.command == INFO_SOUND_MODE and len(data) == 1: self.state.raw_sound_mode = data[0] - mode = VALUE_TO_SOUND_MODE.get(data[0]) + mode = decode_sound_mode_value(self.identity.model, data[0]) if mode is not None: self.state.sound_mode = mode return True @@ -787,7 +793,7 @@ async def async_detect_capabilities(self) -> UltimeaCapabilities: lambda d: len(d) == 1 and decode_source_value(self.identity.model, d[0], info=True) is not None, ), - (Feature.SOUND_MODE, INFO_SOUND_MODE, lambda d: len(d) == 1 and d[0] in VALUE_TO_SOUND_MODE), + (Feature.SOUND_MODE, INFO_SOUND_MODE, lambda d: len(d) == 1 and decode_sound_mode_value(self.identity.model, d[0]) is not None), (Feature.BRIGHTNESS, INFO_BRIGHTNESS, lambda d: len(d) == 1 and d[0] in VALUE_TO_BRIGHTNESS), (Feature.SCREEN_TIMEOUT, INFO_SCREEN_TIMEOUT, lambda d: len(d) == 1 and d[0] in VALUE_TO_SCREEN_TIMEOUT), (Feature.PROMPT_SOUND, INFO_PROMPT_SOUND, lambda d: len(d) == 1 and d[0] in VALUE_TO_PROMPT_SOUND), @@ -1002,7 +1008,12 @@ async def async_set_source(self, source: Source) -> None: ) async def async_set_sound_mode(self, mode: SoundMode) -> None: - data = bytes([SOUND_MODE_TO_VALUE[mode]]) + value = sound_mode_value_for_model(self.identity.model, mode) + if value is None: + raise UltimeaCommandError( + f"sound mode {mode.value!r} is not proven for this ULTIMEA model" + ) + data = bytes([value]) await self._async_write_verified( CMD_SOUND_MODE, data, diff --git a/custom_components/ultimea/media_player.py b/custom_components/ultimea/media_player.py index a15ab0e..0d228bb 100644 --- a/custom_components/ultimea/media_player.py +++ b/custom_components/ultimea/media_player.py @@ -26,6 +26,7 @@ source_for_name_for_model, source_name_for_model, source_options_for_model, + sound_modes_for_model, ) SOURCE_NAMES = { @@ -167,14 +168,15 @@ def source_list(self) -> list[str] | None: def sound_mode_list(self) -> list[str] | None: if not self._can_write(Feature.SOUND_MODE): return None + supported_modes = sound_modes_for_model(self.device.identity.model) names = [ name for mode, name in SOUND_MODE_NAMES.items() - if mode not in (SoundMode.CUSTOM, SoundMode.STYLE) + if mode in supported_modes and mode not in (SoundMode.CUSTOM, SoundMode.STYLE) ] - if self._can_write(Feature.EQUALIZER): + if SoundMode.CUSTOM in supported_modes or self._can_write(Feature.EQUALIZER): names.append(SOUND_MODE_NAMES[SoundMode.CUSTOM]) - if self._can_write(Feature.STYLE): + if SoundMode.STYLE in supported_modes or self._can_write(Feature.STYLE): names.append(SOUND_MODE_NAMES[SoundMode.STYLE]) return names diff --git a/custom_components/ultimea/profiles.py b/custom_components/ultimea/profiles.py index 9455440..eed117e 100644 --- a/custom_components/ultimea/profiles.py +++ b/custom_components/ultimea/profiles.py @@ -36,9 +36,11 @@ INFO_VOLUME, INFO_XUPMIX, INFO_VALUE_TO_SOURCE, + SOUND_MODE_TO_VALUE, SOURCE_TO_VALUE, VALUE_TO_SOURCE, Feature, + SoundMode, Source, VERIFIED_MODEL, VERIFIED_MODEL_NUMBER, @@ -66,6 +68,7 @@ ) POSEIDON_D70_MODEL = "Poseidon D70" +POSEIDON_M60_MODEL = "Poseidon M60" AURA_A40_MODEL = "Aura A40" VERIFIED_D80_FEATURES = frozenset( @@ -94,6 +97,12 @@ } ) +# Android HCI capture-backed M60 controls. Setting/telemetry reads seen in the +# capture deliberately are not made writable without matching SET data. +VERIFIED_M60_FEATURES = frozenset( + {Feature.POWER, Feature.MUTE, Feature.VOLUME, Feature.SOURCE, Feature.SOUND_MODE} +) + DEFAULT_SOURCE_NAMES: Mapping[Source, str] = { Source.EARC: "eARC", Source.HDMI: "HDMI", @@ -129,6 +138,29 @@ 0x04: Source.USB, } +# M60 INFO and CONTROL both use 0x10 for eARC. It has no AUX or HDMI input. +M60_SOURCE_VALUES: Mapping[Source, int] = { + Source.EARC: 0x10, + Source.OPTICAL: 0x01, + Source.BLUETOOTH: 0x02, + Source.USB: 0x04, +} +M60_INFO_SOURCE_VALUES: Mapping[int, Source] = { + value: source for source, value in M60_SOURCE_VALUES.items() +} + +# M60 Custom is 0x08, unlike D80 Custom EQ (0x07). Its captured reply is a +# frequency table, not the D80 writable gain-curve format. +M60_SOUND_MODE_VALUES: Mapping[SoundMode, int] = { + SoundMode.MOVIE: 0x01, + SoundMode.MUSIC: 0x02, + SoundMode.VOICE: 0x03, + SoundMode.SPORT: 0x04, + SoundMode.NIGHT: 0x05, + SoundMode.GAME: 0x06, + SoundMode.CUSTOM: 0x08, +} + # Aura A40 V56: INFO source 01 = Optical was observed in issue #5. # Other values follow the app-derived common INFO enum; their physical inputs # are corroborated by the A40 ability flags and manufacturer documentation. @@ -210,6 +242,14 @@ def _control(command: int) -> WireCommand: Feature.POWER: FeatureWireSpec(write=_control(CMD_POWER)), } +M60_WIRE_FEATURES: Mapping[Feature, FeatureWireSpec] = { + Feature.POWER: FeatureWireSpec(_info(INFO_POWER), _control(CMD_POWER)), + Feature.MUTE: FeatureWireSpec(_info(INFO_MUTE), _control(CMD_MUTE)), + Feature.VOLUME: FeatureWireSpec(_info(INFO_VOLUME), _control(CMD_VOLUME)), + Feature.SOURCE: FeatureWireSpec(_info(INFO_SOURCE), _control(CMD_SOURCE)), + Feature.SOUND_MODE: FeatureWireSpec(_info(INFO_SOUND_MODE), _control(CMD_SOUND_MODE)), +} + FRONTIER_STATIC_WIRE_FEATURES: Mapping[Feature, FeatureWireSpec] = { Feature.SINGLE_LED_SHUTDOWN_TIME: FeatureWireSpec( _info(0x16), _control(0x14) @@ -234,6 +274,7 @@ class UltimeaModelProfile: source_control_values: Mapping[Source, int] = field(default_factory=dict) source_info_values: Mapping[int, Source] = field(default_factory=dict) source_names: Mapping[Source, str] = field(default_factory=dict) + sound_mode_values: Mapping[SoundMode, int] = field(default_factory=dict) power_on_supported: bool = True # Preserve D80's legacy disconnect fallback. D70's captured ACK is # authoritative and must not be replaced by a guessed OFF state. @@ -285,6 +326,17 @@ def source_for_name(self, name: str) -> Source | None: None, ) + def encode_sound_mode(self, mode: SoundMode) -> int | None: + """Return the profile's explicitly mapped sound-mode wire value.""" + if self.sound_mode_values: + return self.sound_mode_values.get(mode) + return SOUND_MODE_TO_VALUE.get(mode) + + def decode_sound_mode(self, value: int) -> SoundMode | None: + """Decode a sound-mode value without assuming D80 custom IDs.""" + values = self.sound_mode_values or SOUND_MODE_TO_VALUE + return next((mode for mode, wire_value in values.items() if wire_value == value), None) + D80_BOOM_PROFILE = UltimeaModelProfile( key="poseidon_d80_boom", @@ -311,6 +363,19 @@ def source_for_name(self, name: str) -> Source | None: # rejected GATT write or premature disconnect must remain an error. power_off_disconnect_fallback=False, ) +M60_PROFILE = UltimeaModelProfile( + key="poseidon_m60", + verified=True, + verified_features=VERIFIED_M60_FEATURES, + wire_features=M60_WIRE_FEATURES, + source_control_values=M60_SOURCE_VALUES, + source_info_values=M60_INFO_SOURCE_VALUES, + source_names=DEFAULT_SOURCE_NAMES, + sound_mode_values=M60_SOUND_MODE_VALUES, + # The capture proves direct 02:09:01 power-on from BLE standby. + power_on_supported=True, + power_off_disconnect_fallback=False, +) APK_COMMON_PROFILE = UltimeaModelProfile( key="apk_common", verified=False, apk_embedded=True ) @@ -329,6 +394,8 @@ def profile_for_model(model: str | None) -> UltimeaModelProfile: return D80_BOOM_PROFILE if normalized == POSEIDON_D70_MODEL.casefold(): return D70_PROFILE + if normalized == POSEIDON_M60_MODEL.casefold(): + return M60_PROFILE if normalized == AURA_A40_MODEL.casefold(): return A40_PROFILE if model in APK_EMBEDDED_MODELS: @@ -373,6 +440,24 @@ def source_for_name_for_model(model: str | None, name: str) -> Source | None: return profile_for_model(model).source_for_name(name) +def decode_sound_mode_value(model: str | None, value: int) -> SoundMode | None: + """Decode a model-specific INFO/CONTROL sound-mode value.""" + return profile_for_model(model).decode_sound_mode(value) + + +def sound_mode_value_for_model(model: str | None, mode: SoundMode) -> int | None: + """Return a proven model-specific CONTROL sound-mode value.""" + return profile_for_model(model).encode_sound_mode(mode) + + +def sound_modes_for_model(model: str | None) -> tuple[SoundMode, ...]: + """Return the sound modes proven selectable for this exact model.""" + profile = profile_for_model(model) + if profile.sound_mode_values: + return tuple(profile.sound_mode_values) + return tuple(mode for mode in SoundMode if mode not in (SoundMode.CUSTOM, SoundMode.STYLE)) + + def can_write_feature( model: str | None, feature: Feature, diff --git a/custom_components/ultimea/runtime.py b/custom_components/ultimea/runtime.py index ce8a2ee..0a577fd 100644 --- a/custom_components/ultimea/runtime.py +++ b/custom_components/ultimea/runtime.py @@ -29,12 +29,11 @@ INFO_SOURCE, INFO_VOLUME, INFO_XUPMIX, - VALUE_TO_SOUND_MODE, Feature, SoundMode, ) from .device import UltimeaCommandError, UltimeaDevice as BaseUltimeaDevice, UltimeaError -from .profiles import decode_source_value, profile_for_model +from .profiles import decode_sound_mode_value, decode_source_value, profile_for_model from .eq_style import build_style_payload, parse_d80_profile from .protocol import ( EQ_CUSTOM_PROFILE, @@ -247,7 +246,7 @@ def _apply_sound_mode(self, value: int) -> None: if value != self.state.raw_sound_mode or value not in (EQ_CUSTOM_PROFILE, EQ_STYLE_PROFILE): self._clear_profile_curve() self.state.raw_sound_mode = value - mode = VALUE_TO_SOUND_MODE.get(value) + mode = decode_sound_mode_value(self.identity.model, value) if mode is SoundMode.STYLE and not self.supports(Feature.STYLE): mode = None self.state.sound_mode = mode @@ -281,6 +280,15 @@ def _handle_control_frame(self, frame: UltimeaFrame) -> bool: if frame.command == CMD_SOUND_MODE: eq = parse_d80_profile(frame.data) if eq is not None: + # M60 returns a 41-byte frequency table for its ordinary + # CUSTOM=08 selection. It is not a D80 editable Style curve. + if ( + decode_sound_mode_value(self.identity.model, eq.profile) + is SoundMode.CUSTOM + and not self.supports(Feature.EQUALIZER) + ): + self._apply_sound_mode(eq.profile) + return True feature = Feature.STYLE if eq.profile == EQ_STYLE_PROFILE else Feature.EQUALIZER if not self.supports(feature): return False @@ -358,9 +366,13 @@ async def async_refresh_state(self): async def async_set_sound_mode(self, mode: SoundMode) -> None: async with self._sound_mode_lock: - if mode in (SoundMode.CUSTOM, SoundMode.STYLE): - profile = EQ_STYLE_PROFILE if mode is SoundMode.STYLE else EQ_CUSTOM_PROFILE - await self._async_read_profile_locked(profile, activate=True) + # The M60's CUSTOM=08 is an ordinary selector. Only profiles with + # the D80 full-curve capability may enter the curve reader. + if mode is SoundMode.CUSTOM and self.supports(Feature.EQUALIZER): + await self._async_read_profile_locked(EQ_CUSTOM_PROFILE, activate=True) + return + if mode is SoundMode.STYLE and self.supports(Feature.STYLE): + await self._async_read_profile_locked(EQ_STYLE_PROFILE, activate=True) return await super().async_set_sound_mode(mode) diff --git a/docs/PROTOCOL.md b/docs/PROTOCOL.md index 4fe2a54..f423180 100644 --- a/docs/PROTOCOL.md +++ b/docs/PROTOCOL.md @@ -178,6 +178,44 @@ disabled. The public test fixture `tests/fixtures/d70_pcap_evidence.json` contains only the extracted protocol facts, without serial or addresses. See [issue #4](https://github.com/Chreece/HA-Ultimea/issues/4). +## Poseidon M60 wire-verified profile + +The Poseidon M60 was decoded from an official-app Android HCI snoop capture. +This is a distinct profile: it must not inherit the D80 Custom EQ/Style curve +semantics or the D70 source enum. + +- `INFO 01:02` returns `Poseidon M60`. +- `INFO 01:04` returns a serial/firmware string (not retained in the public + fixture). +- `00:00` returned the 26-byte ability bitmap + `00 01 01 01 01 00 01 00 01 01 00 00 01 00 00 01 01 01 01 01 01 00 01 01 01 00`. +- The device remains reachable in standby: `02:09 01` has a matching ACK and + `01:0D` reports `01`. Therefore both Home Assistant power actions are + exposed. + +| Semantic control | SET | INFO state | Values proven on M60 | +|---|---:|---:|---| +| Power | `02:09` | `01:0D` | Off `00`, On `01` | +| Volume | `02:03` | `01:07` | one-byte absolute (`0A`, `20` observed) | +| Mute | `02:0A` | `01:0E` | On `00`, Off `01` | +| Source | `02:02` | `01:06` | Optical `01`, Bluetooth `02`, USB `04`, eARC `10` | +| Sound mode | `02:04` | `01:08` | Movie `01`, Music `02`, Voice `03`, Sport `04`, Night `05`, Game `06`, Custom `08` | + +Every captured SET above has a matching `BB` acknowledgement. There are only +four physical M60 inputs; AUX and HDMI are intentionally rejected by the +model decoder. Unlike D80, M60 INFO also uses `10` for eARC. + +Selecting Custom with `02:04 08` returns a 41-byte payload containing the +profile ID and frequency table. It is evidence for selecting/decoding Custom, +not for D80-style editable EQ bands: no M60 full gain-curve write was +captured. The integration consequently exposes Custom as a media-player sound +mode only, without D80 Custom EQ number entities or Style actions. + +Additional observed telemetry (`01:05`, `01:18`, `01:1B`, `01:1C`, `01:1F`) +is retained as undocumented and has no entity/control mapping. The sanitized +regression fixture is `tests/fixtures/poseidon_m60_diagnostic.json`; it has no +device address, identifier or serial number. + ## Aura A40 V56 read-only evidence (issue #5) A reporter's diagnostic confirms model `Aura A40`, firmware `V56`, protocol v1, common `8D11/8D22` transport, a valid heartbeat and state GET replies for power, mute, volume, source, sound mode, brightness, screen timeout and prompt sound. Its captured state was on, volume 13, Optical (INFO `01:06=01`) and Music (INFO `01:08=02`). diff --git a/tests/fixtures/poseidon_m60_diagnostic.json b/tests/fixtures/poseidon_m60_diagnostic.json new file mode 100644 index 0000000..6a25962 --- /dev/null +++ b/tests/fixtures/poseidon_m60_diagnostic.json @@ -0,0 +1,19 @@ +{ + "model": "Poseidon M60", + "firmware": "V23", + "protocol_version": 1, + "transport": "common_8d11_8d22", + "ability_flags": [0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0], + "discovery_features": ["auto_standby", "brightness", "mute", "power", "prompt_sound", "screen_timeout", "sound_mode", "volume"], + "observed_state": { + "power": true, + "raw_volume": 10, + "muted": false, + "raw_sound_mode": 1 + }, + "redactions": { + "address": "REDACTED", + "serial": "REDACTED", + "device_id": "REDACTED" + } +} diff --git a/tests/test_poseidon_m60.py b/tests/test_poseidon_m60.py new file mode 100644 index 0000000..617a2c5 --- /dev/null +++ b/tests/test_poseidon_m60.py @@ -0,0 +1,99 @@ +"""Wire-verified Poseidon M60 model profile contract.""" + +from __future__ import annotations + +import importlib.util +import json +from pathlib import Path +import sys +import types + + +ROOT = Path(__file__).parents[1] +COMPONENT = ROOT / "custom_components" / "ultimea" +PACKAGE = "_ultimea_m60_contract" + + +def _load(name: str): + fullname = f"{PACKAGE}.{name}" + if fullname in sys.modules: + return sys.modules[fullname] + if PACKAGE not in sys.modules: + package = types.ModuleType(PACKAGE) + package.__path__ = [str(COMPONENT)] + sys.modules[PACKAGE] = package + spec = importlib.util.spec_from_file_location(fullname, COMPONENT / f"{name}.py") + assert spec and spec.loader + module = importlib.util.module_from_spec(spec) + sys.modules[fullname] = module + spec.loader.exec_module(module) + return module + + +const = _load("const") +profiles = _load("profiles") +protocol = _load("protocol") +fixture = json.loads((ROOT / "tests/fixtures/poseidon_m60_diagnostic.json").read_text()) + + +def test_m60_discovery_fixture_is_sanitized_and_selects_verified_profile(): + assert fixture["model"] == "Poseidon M60" + assert fixture["firmware"] == "V23" + assert fixture["transport"] == "common_8d11_8d22" + assert set(fixture["redactions"].values()) == {"REDACTED"} + assert "U3721" not in json.dumps(fixture) + profile = profiles.profile_for_model(fixture["model"]) + assert profile.key == "poseidon_m60" + assert profile.verified + assert profiles.can_turn_on(fixture["model"], profile.verified_features) + + +def test_m60_decodes_only_the_four_wire_verified_inputs_and_modes(): + sources = { + const.Source.EARC: 0x10, + const.Source.OPTICAL: 0x01, + const.Source.BLUETOOTH: 0x02, + const.Source.USB: 0x04, + } + for source, value in sources.items(): + assert profiles.source_value_for_model("Poseidon M60", source) == value + assert profiles.decode_source_value("Poseidon M60", value, info=True) is source + assert profiles.source_value_for_model("Poseidon M60", const.Source.AUX) is None + assert profiles.decode_source_value("Poseidon M60", 0x03, info=True) is None + assert profiles.decode_source_value("Poseidon M60", 0x05, info=True) is None + source_frame = next(protocol.iter_frames(bytes.fromhex("bb0100010610c1"))) + mode_frame = next(protocol.iter_frames(bytes.fromhex("bb0100010804b7"))) + assert profiles.decode_source_value( + "Poseidon M60", source_frame.data[0], info=True + ) is const.Source.EARC + assert profiles.decode_sound_mode_value( + "Poseidon M60", mode_frame.data[0] + ) is const.SoundMode.SPORT + assert profiles.source_options_for_model("Poseidon M60") == ( + "eARC", "Optical", "Bluetooth", "USB" + ) + assert profiles.decode_sound_mode_value("Poseidon M60", 0x08) is const.SoundMode.CUSTOM + assert profiles.sound_mode_value_for_model("Poseidon M60", const.SoundMode.CUSTOM) == 0x08 + assert profiles.sound_mode_value_for_model("Poseidon M60", const.SoundMode.STYLE) is None + + +def test_m60_write_commands_match_the_hci_capture(): + assert protocol.build_command(2, const.CMD_POWER, b"\x00").hex() == "aa0100020900b5" + assert protocol.build_command(2, const.CMD_POWER, b"\x01").hex() == "aa0100020901b6" + assert protocol.build_command(2, const.CMD_VOLUME, b"\x20").hex() == "aa0100020320cf" + assert protocol.build_command(2, const.CMD_VOLUME, b"\x0a").hex() == "aa010002030ab9" + assert protocol.build_command(2, const.CMD_MUTE, b"\x00").hex() == "aa0100020a00b6" + assert protocol.build_command(2, const.CMD_MUTE, b"\x01").hex() == "aa0100020a01b7" + for value, frame in ((1, "aa0100020201af"), (2, "aa0100020202b0"), (4, "aa0100020204b2"), (16, "aa0100020210be")): + assert protocol.build_command(2, const.CMD_SOURCE, bytes([value])).hex() == frame + for value in range(1, 7): + assert protocol.build_command(2, const.CMD_SOUND_MODE, bytes([value]))[5] == value + assert protocol.build_command(2, const.CMD_SOUND_MODE, b"\x08").hex() == "aa0100020408b8" + + +def test_m60_writable_surface_excludes_unproven_curve_and_settings_controls(): + verified = profiles.profile_for_model("Poseidon M60").verified_features + assert profiles.writable_features_for_model("Poseidon M60", verified) == verified + assert const.Feature.EQUALIZER not in verified + assert const.Feature.STYLE not in verified + assert const.Feature.BRIGHTNESS not in verified From 069b76a973497b7ef676b55ce34e1e67ffc6c54d Mon Sep 17 00:00:00 2001 From: Jonathan Keslin Date: Mon, 16 Nov 2026 15:28:46 -0800 Subject: [PATCH 2/3] Remove power on capability, as device ends up disconnecting on off anyway --- README.md | 10 ++++++---- custom_components/ultimea/profiles.py | 5 +++-- docs/PROTOCOL.md | 8 ++++---- tests/test_poseidon_m60.py | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 180d7df..edc66db 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ | --- | --- | | ULTIMEA Poseidon D80 Boom (U2623) | ✅ Hardware verified | | ULTIMEA Poseidon D70 | 🧪 Reporter-confirmed: volume, ARC/Optical/Bluetooth/AUX/USB, mute and power-off; BLE power-on unavailable | -| ULTIMEA Poseidon M60 | ✅ Wire verified: power on/off, volume, mute, eARC/Optical/Bluetooth/USB and Movie/Music/Voice/Sport/Night/Game/Custom modes | +| ULTIMEA Poseidon M60 | ✅ Wire verified: power-off, volume, mute, eARC/Optical/Bluetooth/USB and Movie/Music/Voice/Sport/Night/Game/Custom modes; BLE power-on unavailable | | ULTIMEA Aura A40 (V56) | 🧪 Confirmed BLE discovery and read-only state; no verified write controls | | Other ULTIMEA devices that pass the APK common/custom protocol probe | 🧪 Experimental, capability-driven/read-only writes unless proven | @@ -90,11 +90,13 @@ The D80 and Aura A40 profiles remain independent. ## Poseidon M60 support -The Poseidon M60 is a separate, wire-verified profile. It exposes power on and -off (including **BLE power-on from standby**), absolute volume, mute, the four +The Poseidon M60 is a separate, wire-verified profile. It exposes power-off, +absolute volume, mute, the four physical inputs (**eARC, Optical, Bluetooth and USB**) and **Movie, Music, Voice, Sport, Night, Game and Custom EQ** sound modes. It intentionally does -not expose AUX or HDMI. +not expose AUX or HDMI. **Bluetooth power-on is intentionally unavailable:** a +captured `02:09 01` acknowledgement did not produce reliable real-world wake +behavior, so Home Assistant exposes `TURN_OFF` but not `TURN_ON`. The M60 reports eARC as `INFO 01:06=10`, matching its `02:02 10` setter; this differs from the D80/D70 INFO eARC response. Its Custom selection is diff --git a/custom_components/ultimea/profiles.py b/custom_components/ultimea/profiles.py index eed117e..82cad51 100644 --- a/custom_components/ultimea/profiles.py +++ b/custom_components/ultimea/profiles.py @@ -372,8 +372,9 @@ def decode_sound_mode(self, value: int) -> SoundMode | None: source_info_values=M60_INFO_SOURCE_VALUES, source_names=DEFAULT_SOURCE_NAMES, sound_mode_values=M60_SOUND_MODE_VALUES, - # The capture proves direct 02:09:01 power-on from BLE standby. - power_on_supported=True, + # A captured 02:09:01 ACK did not translate into reliable operational + # power-on. Keep TURN_ON unavailable until it is hardware-proven. + power_on_supported=False, power_off_disconnect_fallback=False, ) APK_COMMON_PROFILE = UltimeaModelProfile( diff --git a/docs/PROTOCOL.md b/docs/PROTOCOL.md index f423180..b8d0270 100644 --- a/docs/PROTOCOL.md +++ b/docs/PROTOCOL.md @@ -189,13 +189,13 @@ semantics or the D70 source enum. fixture). - `00:00` returned the 26-byte ability bitmap `00 01 01 01 01 00 01 00 01 01 00 00 01 00 00 01 01 01 01 01 01 00 01 01 01 00`. -- The device remains reachable in standby: `02:09 01` has a matching ACK and - `01:0D` reports `01`. Therefore both Home Assistant power actions are - exposed. +- Although `02:09 01` has a captured ACK and `01:0D` can report `01`, it did + not provide reliable real-world wake behavior. Home Assistant deliberately + exposes only `TURN_OFF`; direct Bluetooth power-on is rejected before I/O. | Semantic control | SET | INFO state | Values proven on M60 | |---|---:|---:|---| -| Power | `02:09` | `01:0D` | Off `00`, On `01` | +| Power | `02:09` | `01:0D` | Off `00` exposed; `On 01` captured but unsupported | | Volume | `02:03` | `01:07` | one-byte absolute (`0A`, `20` observed) | | Mute | `02:0A` | `01:0E` | On `00`, Off `01` | | Source | `02:02` | `01:06` | Optical `01`, Bluetooth `02`, USB `04`, eARC `10` | diff --git a/tests/test_poseidon_m60.py b/tests/test_poseidon_m60.py index 617a2c5..266fb74 100644 --- a/tests/test_poseidon_m60.py +++ b/tests/test_poseidon_m60.py @@ -45,7 +45,7 @@ def test_m60_discovery_fixture_is_sanitized_and_selects_verified_profile(): profile = profiles.profile_for_model(fixture["model"]) assert profile.key == "poseidon_m60" assert profile.verified - assert profiles.can_turn_on(fixture["model"], profile.verified_features) + assert not profiles.can_turn_on(fixture["model"], profile.verified_features) def test_m60_decodes_only_the_four_wire_verified_inputs_and_modes(): From 9f1695da56d55648a00db2196d8d767385d204c2 Mon Sep 17 00:00:00 2001 From: Jonathan Keslin Date: Tue, 17 Nov 2026 20:31:27 -0800 Subject: [PATCH 3/3] Address review feedback --- custom_components/ultimea/runtime.py | 17 +++++++++++++++++ tests/fixtures/poseidon_m60_diagnostic.json | 1 + tests/test_style.py | 20 ++++++++++++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/custom_components/ultimea/runtime.py b/custom_components/ultimea/runtime.py index 0a577fd..f4dc147 100644 --- a/custom_components/ultimea/runtime.py +++ b/custom_components/ultimea/runtime.py @@ -261,6 +261,23 @@ def _apply_custom_profile(self, profile: int, gains: tuple[int, ...]) -> None: def _resolve_pending(self, frame: UltimeaFrame) -> None: """A profile read needs its full matching curve, not a one-byte mode ACK.""" pending = self._pending + # M60 acknowledges Custom (02:04 08) with the complete 41-byte + # frequency-table response, rather than a separate one-byte echo. + if ( + pending is not None + and profile_for_model(self.identity.model).key == "poseidon_m60" + and pending[:2] == (GROUP_CONTROL, CMD_SOUND_MODE) + and pending[2] == bytes([EQ_STYLE_PROFILE]) + ): + eq = parse_d80_profile(frame.data) + if ( + (frame.group, frame.command) == (GROUP_CONTROL, CMD_SOUND_MODE) + and eq is not None + and eq.profile == EQ_STYLE_PROFILE + ): + if not pending[3].done(): + pending[3].set_result(frame) + return if ( self._profile_reply_expected is not None and pending is not None diff --git a/tests/fixtures/poseidon_m60_diagnostic.json b/tests/fixtures/poseidon_m60_diagnostic.json index 6a25962..0558659 100644 --- a/tests/fixtures/poseidon_m60_diagnostic.json +++ b/tests/fixtures/poseidon_m60_diagnostic.json @@ -11,6 +11,7 @@ "muted": false, "raw_sound_mode": 1 }, + "custom_mode_response_data": "081f0000003e0000007d000000fa000000f4010000e8030000d0070000a00f0000401f0000803e0000", "redactions": { "address": "REDACTED", "serial": "REDACTED", diff --git a/tests/test_style.py b/tests/test_style.py index e83f41b..551403d 100644 --- a/tests/test_style.py +++ b/tests/test_style.py @@ -15,6 +15,7 @@ ROOT = Path(__file__).parents[1] COMPONENT = ROOT / 'custom_components' / 'ultimea' CAPTURE = json.loads((ROOT / 'tests/fixtures/d80_style_capture.json').read_text()) +M60 = json.loads((ROOT / 'tests/fixtures/poseidon_m60_diagnostic.json').read_text()) @pytest.fixture @@ -121,6 +122,9 @@ async def write_gatt_char(self, uuid, packet, response=False): elif group==2 and command==4: self.mode=data[0] if len(data)==1: + if self.device.identity.model == 'Poseidon M60' and data == b'\x08': + self.rx(group,command,bytes.fromhex(M60['custom_mode_response_data'])) + return reply=self.curves[data[0]] if self.short_ack: self.rx(group,command,data) @@ -134,10 +138,10 @@ async def write_gatt_char(self, uuid, packet, response=False): self.rx(group,command,reply) -def device_with_peer(code, mode=8): +def device_with_peer(code, mode=8, model=None): dev=code.runtime.UltimeaDevice(SimpleNamespace(), '00:00:00:00:00:01','Test D80') c=code.const - dev.identity.model=c.VERIFIED_MODEL + dev.identity.model=model or c.VERIFIED_MODEL dev.restore_capabilities() dev._available=True dev.state.power=True @@ -206,6 +210,18 @@ async def run(): asyncio.run(run()) +def test_m60_custom_full_response_completes_pending_selection(code): + async def run(): + dev, peer = device_with_peer(code, model='Poseidon M60') + await dev.async_set_sound_mode(code.const.SoundMode.CUSTOM) + assert peer.trace[-1] == (2, 4, b'\x08') + assert dev.state.raw_sound_mode == 8 + assert dev.state.sound_mode is code.const.SoundMode.CUSTOM + assert dev.state.eq_profile_id is None + assert dev.state.eq_band_gains_tenths_db is None + asyncio.run(run()) + + @pytest.mark.parametrize('preset',['bass','rock','pop','classical','flat']) def test_buttons_send_proven_curves_and_publish_only_echoed_values(code,preset): async def run():