Skip to content

mobile_push: Android commands and TTS sent as calls of their own - #277

Merged
jeyrb merged 6 commits into
rhizomatics:mainfrom
lollox80:fix/android-commands-tts
Oct 9, 2026
Merged

jeyrb merged 6 commits into
rhizomatics:mainfrom
lollox80:fix/android-commands-tts

Conversation

@lollox80

@lollox80 lollox80 commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Follows #274 / #275 - the mobile_push_command_* / mobile_push_tts_text part.

The companion app takes notification commands and TTS as the message of a call of their own (message: command_dnd + data.command, message: TTS + data.tts_text), not as data of an ordinary notification. So today mobile_push_command_dnd / _ringer_mode / _screen_on go nowhere, and mobile_push_tts_text is never spoken.

Now, to Android devices only (an iPhone, or a device whose manufacturer isn't known, would show command_dnd as a notification):

  • each mobile_push_command_* is sent as its own call just before the notification, so the screen is on / Do Not Disturb is off when it arrives
  • mobile_push_tts_text is sent as its own message: TTS call after the notification - one wait for all the devices, 5 seconds by default, since started together the TTS cut off the notification's own sound; new mobile_push_tts_delay changes it (0 for straight away). mobile_push_tts_locale / _engine go with it as tts_text_language / tts_engine
  • for critical, the extra calls carry ttl: 0 + priority: high like the notification (without them the TTS waited for the phone to be unlocked and was then spoken late), and the TTS goes on media_stream: alarm_stream_max (the app puts the volume back afterwards); otherwise mobile_push_alarm_stream / _max pick the stream
  • the extra calls use single_target=True, as the notification call does since Follow re-paired mobile apps, and raise a repair rather than snooze a missing notify action #272, so a missing device isn't a transport failure
  • the documented values in the docstring fixed: command_dnd takes alarms_only / priority_only / total_silence / off, command_screen_on also keep_screen_on
  • docs: an "Android Commands and Spoken Text" section in transports/mobile_push.md
  - action: supernotify.notify
    data:
      message: Water leak under the sink
      priority: critical
      extra_data:
        mobile_push_command_screen_on: true
        mobile_push_tts_text: Water leak under the sink

One thing you may want different: the TTS wait is an asyncio.sleep inside deliver(), so a delivery with mobile_push_tts_text takes those 5 seconds longer to finish. Happy to move it to a background task if you'd rather.

Tried on my own HA with a Samsung S26 Ultra: commands, TTS after the notification, and a critical TTS heard on Do Not Disturb.

Locally on Python 3.14: ruff, ruff format, codespell, mypy clean; HA 2026.10.0 lane 2394 passed (coverage 97%, mobile_push.py 99% - the two missed lines are pre-existing), HA 2026.4.4 lane 2357 passed, 1 skipped. Branch merged with current main.

🤖 Generated with Claude Code

https://claude.ai/code/session_01XHmtQPskJJiphmnb37zkdR

The companion app takes notification commands and TTS as the message of a call (message: command_dnd + data.command, message: TTS + tts_text), not as notification data, so mobile_push_command_* went nowhere and mobile_push_tts_text only showed text. Commands now go just before the notification and TTS just after it (on the alarm stream for critical), to Android phones only. Tried on a Samsung S26 Ultra.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01TQHWk2kktg8aTN36n3PKVr
Tried on a Galaxy Watch: TTS on alarm_stream was too quiet to hear, alarm_stream_max was heard. The companion app puts the volume back afterwards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01TQHWk2kktg8aTN36n3PKVr
Without it the TTS call waited until the phone was unlocked and was then spoken late, alongside the next one. Tried on a Samsung S26 Ultra.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01TQHWk2kktg8aTN36n3PKVr
Started together, the TTS cut off the notification's own sound. One wait for all the devices, mobile_push_tts_delay to change it (0 for straight away). Tried on a Samsung S26 Ultra.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01TQHWk2kktg8aTN36n3PKVr
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01XHmtQPskJJiphmnb37zkdR
…s-tts

# Conflicts:
#	custom_components/supernotify/transports/mobile_push.py
#	tests/components/supernotify/transports/test_transport_mobile_push.py
@jeyrb
jeyrb merged commit 070d6cd into rhizomatics:main Oct 9, 2026
13 checks passed
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.

2 participants