Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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-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 |

Expand Down Expand Up @@ -87,6 +88,22 @@ 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-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. **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
`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
Expand Down
25 changes: 18 additions & 7 deletions custom_components/ultimea/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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__)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions custom_components/ultimea/media_player.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
source_for_name_for_model,
source_name_for_model,
source_options_for_model,
sound_modes_for_model,
)

SOURCE_NAMES = {
Expand Down Expand Up @@ -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

Expand Down
86 changes: 86 additions & 0 deletions custom_components/ultimea/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -66,6 +68,7 @@
)

POSEIDON_D70_MODEL = "Poseidon D70"
POSEIDON_M60_MODEL = "Poseidon M60"
AURA_A40_MODEL = "Aura A40"

VERIFIED_D80_FEATURES = frozenset(
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand All @@ -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.
Expand Down Expand Up @@ -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",
Expand All @@ -311,6 +363,20 @@ 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,
# 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(
key="apk_common", verified=False, apk_embedded=True
)
Expand All @@ -329,6 +395,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:
Expand Down Expand Up @@ -373,6 +441,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,
Expand Down
41 changes: 35 additions & 6 deletions custom_components/ultimea/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -262,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
Expand All @@ -281,6 +297,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
Expand Down Expand Up @@ -358,9 +383,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)
Comment thread
Chreece marked this conversation as resolved.
Resolved

Expand Down
Loading
Loading