Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Problem]: MQTT Remote Control does nothing #1858

Open
1 of 2 tasks
tomm1ed opened this issue May 28, 2024 · 23 comments
Open
1 of 2 tasks

[Problem]: MQTT Remote Control does nothing #1858

tomm1ed opened this issue May 28, 2024 · 23 comments

Comments

@tomm1ed
Copy link

tomm1ed commented May 28, 2024

What happened?

Installed latest dev version and connected to MQTT server
Sending [mqtt topic]/remote play etc does nothing, I see nothing in the logs of shairport-sync confirming that it is processing the commands (and nothing happens so it seems to ignore it)

Relevant log output

shairport-sync -v
         0.002415677 "shairport.c:2278" Startup in AirPlay 2 mode, with features 0x405fca00,0x1c340 on device "b8:27:eb:52:1f:1e".
         0.000163541 "shairport.c:2317" Version String: "4.3.3-dev-82-g2ec6068b-AirPlay2-smi10-OpenSSL-Avahi-ALSA-soxr-metadata-mqtt-sysconfdir:/etc"
         0.000029636 "shairport.c:2336" Command Line: "shairport-sync -v".
         0.000490104 "shairport.c:2372" Log Verbosity is 1.
         0.000070729 "audio_alsa.c:1022" alsa: alsa_maximum_stall_time of 0.200000 sec.
         0.000060677 "audio_alsa.c:1311" alsa: disable_standby_mode is "never".
         0.000023281 "audio_alsa.c:1315" alsa: disable_standby_mode_silence_threshold is 0.040000 seconds.
         0.000022605 "audio_alsa.c:1317" alsa: disable_standby_mode_silence_scan_interval is 0.004000 seconds.
         0.000033281 "audio_alsa.c:1357" alsa: output device name is "default".
         0.000237760 "shairport.c:2440" disable_resend_requests is off.
         0.000031823 "shairport.c:2441" diagnostic_drop_packet_fraction is 0.000000. A value of 0.0 means no packets will be dropped deliberately.
         0.000026406 "shairport.c:2445" statistics_requester status is 0.
         0.000025625 "shairport.c:2450" rtsp listening port is 7000.
         0.000022084 "shairport.c:2451" udp base port is 6001.
         0.000021823 "shairport.c:2452" udp port range is 10.
         0.000021875 "shairport.c:2453" player name is "Livingroom".
         0.000022083 "shairport.c:2454" backend is "alsa".
         0.000021667 "shairport.c:2455" run_this_before_play_begins action is "(null)".
         0.000022395 "shairport.c:2456" run_this_after_play_ends action is "(null)".
         0.000022396 "shairport.c:2457" wait-cmd status is 0.
         0.000021823 "shairport.c:2458" run_this_before_play_begins may return output is 0.
         0.000022552 "shairport.c:2459" run_this_if_an_unfixable_error_is_detected action is "(null)".
         0.000022813 "shairport.c:2461" run_this_before_entering_active_state action is  "(null)".
         0.000022396 "shairport.c:2463" run_this_after_exiting_active_state action is  "(null)".
         0.000022552 "shairport.c:2465" active_state_timeout is  10.000000 seconds.
         0.000027031 "shairport.c:2466" mdns backend "(null)".
         0.000021823 "shairport.c:2468" interpolation setting is "auto".
         0.000022187 "shairport.c:2472" interpolation soxr_delay_threshold is 30000000.
         0.000022813 "shairport.c:2473" resync time is 0.050000 seconds.
         0.000023281 "shairport.c:2474" resync recovery time is 0.100000 seconds.
         0.000023802 "shairport.c:2475" allow a session to be interrupted: 0.
         0.000022031 "shairport.c:2476" busy timeout time is 0.
         0.000021719 "shairport.c:2477" drift tolerance is 0.002000 seconds.
         0.000023281 "shairport.c:2478" password is not set.
         0.000021928 "shairport.c:2479" default airplay volume is: -24.000000.
         0.000025260 "shairport.c:2480" high threshold airplay volume is: -16.000000.
         0.000024948 "shairport.c:2482" check for higher-than-threshold volume for new play session is disabled.
         0.000022656 "shairport.c:2488" ignore_volume_control is 0.
         0.000022083 "shairport.c:2492" volume_max_db is not set
         0.000021407 "shairport.c:2493" volume range in dB (zero means use the range specified by the mixer): 0.
         0.000023229 "shairport.c:2495" volume_range_combined_hardware_priority (1 means hardware mixer attenuation is used first) is 0.
         0.000023542 "shairport.c:2499" playback_mode is 0 (0-stereo, 1-mono, 1-reverse_stereo, 2-both_left, 3-both_right).
         0.000023177 "shairport.c:2501" disable_synchronization is 0.
         0.000021823 "shairport.c:2502" use_mmap_if_available is 1.
         0.000021875 "shairport.c:2503" output_format automatic selection is enabled.
         0.000022656 "shairport.c:2507" output_rate automatic selection is enabled.
         0.000022187 "shairport.c:2511" audio backend desired buffer length is 0.200000 seconds.
         0.000024323 "shairport.c:2513" audio_backend_buffer_interpolation_threshold_in_seconds is 0.120000 seconds.
         0.000024271 "shairport.c:2515" audio backend latency offset is 0.000000 seconds.
         0.000023698 "shairport.c:2517" audio backend silence lead-in time is "auto".
         0.000022031 "shairport.c:2521" zeroconf regtype is "_raop._tcp".
         0.000022344 "shairport.c:2522" decoders_supported field is 1.
         0.000021979 "shairport.c:2523" use_apple_decoder is 0.
         0.000021771 "shairport.c:2524" alsa_use_hardware_mute is 0.
         0.000021979 "shairport.c:2528" no special mdns service interface was requested.
         0.000060156 "shairport.c:2531" configuration file name "/etc/shairport-sync.conf" resolves to "/etc/shairport-sync.conf".
         0.000026563 "shairport.c:2538" metadata enabled is 1.
         0.000022396 "shairport.c:2539" metadata pipename is "/tmp/shairport-sync-metadata".
         0.000022916 "shairport.c:2540" metadata socket address is "(null)" port 0.
         0.000022552 "shairport.c:2542" metadata socket packet size is "500".
         0.000022292 "shairport.c:2543" get-coverart is 1.
         0.000021771 "shairport.c:2546" mqtt is enabled.
         0.000021354 "shairport.c:2547" mqtt hostname is 192.168.11.23, port is 1883.
         0.000022656 "shairport.c:2548" mqtt topic is shairport/livingroom.
         0.000021771 "shairport.c:2549" mqtt will not publish raw metadata.
         0.000022188 "shairport.c:2550" mqtt will publish parsed metadata.
         0.000022343 "shairport.c:2551" mqtt will publish cover Art.
         0.000022605 "shairport.c:2552" mqtt remote control is enabled.
         0.000021718 "shairport.c:2561" loudness is 0.
         0.000021615 "shairport.c:2562" loudness reference level is -20.000000
         0.000199375 "rtsp.c:4235" metadata pipe name is "/tmp/shairport-sync-metadata".
         0.000811979 "mqtt.c:252" Initialising MQTT
         0.004326615 "shairport.c:2689" NQPTP is online.
         1.499888853 "shairport.c:255" "soxr" interpolation has been chosen.


MQTT log:
mosquitto_sub -h 192.168.11.23 -v -t "shairport/#" | ts
May 28 08:52:00 shairport/livingroom/service_name Livingroom
May 28 08:52:00 shairport/livingroom/output_frame_rate 44100
May 28 08:52:00 shairport/livingroom/output_format S16_LE
May 28 08:52:43 shairport/livingroom/remote play
May 28 08:53:31 shairport/livingroom/remote pause
May 28 08:53:32 shairport/livingroom/remote nextitem
May 28 08:53:35 shairport/livingroom/remote volumeup
May 28 08:53:36 shairport/livingroom/remote volumedown

System Information.

Raspberry Pi 3B running RaspberryPi OS Bullseye
HifiBerry DAC+

uname -a
Linux livingroom 5.15.76-v7+ #1597 SMP Fri Nov 4 12:13:17 GMT 2022 armv7l GNU/Linux

shairport-sync -V
4.3.3-dev-82-g2ec6068b-AirPlay2-smi10-OpenSSL-Avahi-ALSA-soxr-metadata-mqtt-sysconfdir:/etc

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpihifiberry [snd_rpi_hifiberry_dacplus], device 0: HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0 [HiFiBerry DAC+ Pro HiFi pcm512x-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0

Configuration Information.

shairport-sync --displayConfig
>> Display Config Start.

From "uname -a":
 Linux livingroom 5.15.76-v7+ #1597 SMP Fri Nov 4 12:13:17 GMT 2022 armv7l GNU/Linux

From /etc/os-release:
 Raspbian GNU/Linux 11 (bullseye)

From /sys/firmware/devicetree/base/model:
 Raspberry Pi 3 Model B Rev 1.2

Shairport Sync Version String:
 4.3.3-dev-82-g2ec6068b-AirPlay2-smi10-OpenSSL-Avahi-ALSA-soxr-metadata-mqtt-sysconfdir:/etc

Command Line:
 shairport-sync --displayConfig

Configuration File:
 /etc/shairport-sync.conf

Configuration File Settings:
 metadata :
 {
   enabled = "yes";
   include_cover_art = "yes";
   cover_art_cache_directory = "";
   pipe_name = "/tmp/shairport-sync-metadata";
   pipe_timeout = 5000;
 };
 mqtt :
 {
   enabled = "yes";
   hostname = "192.168.11.23";
   port = 1883;
   username = "username";
   password = "password";
   topic = "shairport/livingroom";
   publish_parsed = "yes";
   publish_cover = "yes";
   enable_remote = "yes";
 };

>> Display Config End.
>> Goodbye!

PulseAudio or PipeWire installed?

  • Check if your system uses a Sound Server.

How did you install Shairport Sync?

Built from source

Check previous issues

  • Confirm
@mikebrady
Copy link
Owner

Thanks for the post. Unfortunately, this seems to be due to a change at the player (e.g. the Music app). The issue is that some changes have occurred in recent versions of iOS and Mac such that the players don't respond to the remote control commands being sent by Shairport Sync. It's not just confined to Shairport Sync either -- it seems to be a general problem.

@tomm1ed
Copy link
Author

tomm1ed commented May 28, 2024

Thanks for the post. Unfortunately, this seems to be due to a change at the player (e.g. the Music app). The issue is that some changes have occurred in recent versions of iOS and Mac such that the players don't respond to the remote control commands being sent by Shairport Sync. It's not just confined to Shairport Sync either -- it seems to be a general problem.

Ouch that sucks... Was looking forward to put a Hue tap in the shower to be able to pause music, skip a track and change the volume. TvOS 17.5 is already out and Apple appears to have done nothing it seems.
Is there any way I can help to troubleshoot?

@mikebrady
Copy link
Owner

Thanks, yeah, it is a pity alright, but it may be that Apple are simply moving on, removing obsolete (to them!) features. IOW, it might not be a "bug" to them...

The real problem is that the protocols for their remote control and general supervision are (to my knowledge) unknown. If progress could be made there, it would give us a way to move forward.

@tomm1ed
Copy link
Author

tomm1ed commented May 28, 2024

Thanks, yeah, it is a pity alright, but it may be that Apple are simply moving on, removing obsolete (to them!) features. IOW, it might not be a "bug" to them...

The real problem is that the protocols for their remote control and general supervision are (to my knowledge) unknown. If progress could be made there, it would give us a way to move forward.

Yeah the weird thing is that pausing the specific shairport-sync speaker from Apple Shortcuts on my iPhone (iOS 17.5.1) works without problem.

@mikebrady Just so I am understanding correctly; the fact that shairport-sync does not log anything when I post /remote play etc on MQTT is by design?

@mikebrady
Copy link
Owner

Yeah the weird thing is that pausing the specific shairport-sync speaker from Apple Shortcuts on my iPhone (iOS 17.5.1) works without problem.

Could that be because the shortcut is talking directly to the Music app on the iPhone?

Just so I am understanding correctly; the fact that shairport-sync does not log anything when I post /remote play etc on MQTT is by design?

It is by design, though it could easily be changed. The question is whether it might just fill up the log...

@tomm1ed
Copy link
Author

tomm1ed commented May 30, 2024

Yeah the weird thing is that pausing the specific shairport-sync speaker from Apple Shortcuts on my iPhone (iOS 17.5.1) works without problem.

Could that be because the shortcut is talking directly to the Music app on the iPhone?

I am gonna test this when I have the time. The shortcuts targets a specific shairport-sync player. Gonna start a stream from my iPad and then run the shortcut from my iPhone. NB this only works since I updated from 1.1.1 (which has been running amazingly but was missing the 'remote control' part) to the latest dev version. (Was already running dev since back then only dev supported AirPlay2)

Just so I am understanding correctly; the fact that shairport-sync does not log anything when I post /remote play etc on MQTT is by design?

It is by design, though it could easily be changed. The question is whether it might just fill up the log...

No worries, was just wondering if shairport-sync was even registering the remote commands

Copy link

This issue has been inactive for 28 days so will be closed 7 days from now. To prevent this, please remove the "stale" label or post a comment.

@github-actions github-actions bot added the Stale label Jul 31, 2024
@2xsaiko
Copy link

2xsaiko commented Aug 2, 2024

common stale bot L 🤫

@github-actions github-actions bot removed the Stale label Aug 3, 2024
@mikebrady
Copy link
Owner

common stale bot L 🤫

Huh?

@2xsaiko
Copy link

2xsaiko commented Aug 5, 2024

Huh?

will be closed 7 days from now. To prevent this, please remove the "stale" label or post a comment.

What can I say, except that stale bot's only purpose (or at least effect) is to fill issues with useless comments like these under the threat of closing the issue otherwise. (I almost don't want to write this one because it's clearly off topic but whatever.) An issue doesn't automatically become invalid just because it's old.

@mikebrady
Copy link
Owner

Closing inactive issues keeps actively discussed issues to the forefront. Closed issues do not become invalid and can be reopened when they become active again. It's pretty simple.

@casenjo
Copy link

casenjo commented Aug 22, 2024

Wanted to chime in that I'm experiencing the same issue. Integrated using the Home Assistant, can't control anything when using Airplay from my iPhone (iOS 17.6.1). I did some tests and discovered that I actually do have some control when I use Airplay from my Macbook (OSX 12.7). I can control Play/Pause but not volume up/down.

Edit: Saw in one of the other issue threads that it's not a shairport issue at all and seems like it'll be fixed in iOS 18

@MSL-DA
Copy link

MSL-DA commented Sep 19, 2024

Has this been fixed with iOS 18?

@MSL-DA
Copy link

MSL-DA commented Sep 19, 2024

I don't know about others, but for me it doesn't work with iOS18 either

play/pause, volumeup/volumedown on hass-shairport-sync

mqtt log:

HiFi/play_resume --
HiFi/track_id DAA3B51980460851
HiFi/album Load
HiFi/artist Metallica
HiFi/genre Metal
HiFi/title Until It Sleeps
HiFi/remote volumedown
HiFi/remote volumeup
HiFi/remote pause
HiFi/remote nextitem
HiFi/remote previtem
HiFi/remote play

Up/Down on iPhone 15 Pro iOS18

mqtt log:

HiFi/volume -18.92,-60.73,-96.30,0.00
HiFi/volume -20.79,-66.75,-96.30,0.00

@MSL-DA
Copy link

MSL-DA commented Sep 23, 2024

The same applies to iOS 18.1 beta 5 😡

@mvoss96
Copy link

mvoss96 commented Nov 16, 2024

also not working for me

@Vaskyy
Copy link

Vaskyy commented Nov 26, 2024

Also came here to report control issues.

Shairport Log on iPhone 12mini (iOS 17.6.1):

         2.185883801 "mqtt.c:55" [MQTT]: received Message on topic /Vaskyy-Hyperion/remote: pause

         0.000138542 "mqtt.c:68" [MQTT]: DACP Command: pause

         0.000064479 "dacp.c:370" send_simple_dacp_command: sending command "pause".
        14.590154005 "mqtt.c:55" [MQTT]: received Message on topic /Vaskyy-Hyperion/remote: play

         0.000144219 "mqtt.c:68" [MQTT]: DACP Command: play

         0.000069271 "dacp.c:370" send_simple_dacp_command: sending command "play".

Shairport Log on iPhone SE 1. Gen (iOS 15.8.3):

    12.809021297 "mqtt.c:55" [MQTT]: received Message on topic /Vaskyy-Hyperion/remote: pause

     0.000151510 "mqtt.c:68" [MQTT]: DACP Command: pause

     0.000064375 "dacp.c:370" send_simple_dacp_command: sending command "pause".
     0.224262188 "ptp-utilities.c:225" Send control message to NQPTP: "/nqptp P"
     0.001441719 "rtsp.c:2011" Connection 1: Pause playing.
     0.000156614 "rtp.c:1322" Connection 1: Clear anchor information.
     0.000101042 "rtsp.c:2019" Connection 1: Stop the output backend.
     0.000063437 "audio_alsa.c:1883" alsa: do_close()
     0.010627969 "audio_alsa.c:1896" alsa: do_close() -- closing alsa handle
     0.001380781 "rtp.c:2473" Play stopped.
     0.000257500 "rtp.c:1428" Connection 1: Awaiting clock anchor information.
     2.945021145 "mqtt.c:55" [MQTT]: received Message on topic /Vaskyy-Hyperion/remote: play

     0.000125886 "mqtt.c:68" [MQTT]: DACP Command: play

     0.000056562 "dacp.c:370" send_simple_dacp_command: sending command "play".
     0.117529583 "rtsp.c:2541" Connection 1: POST /audioMode Content-Length 64
     0.000148125 "rtsp.c:2543"   Type: "Content-Length", content: "64"
     0.000055782 "rtsp.c:2543"   Type: "Content-Type", content: "application/x-apple-binary-plist"
     0.000047708 "rtsp.c:2543"   Type: "CSeq", content: "47"
     0.000045208 "rtsp.c:2543"   Type: "DACP-ID", content: "292C08CD5FC924AD"
     0.000040990 "rtsp.c:2543"   Type: "Active-Remote", content: "3880305684"
     0.000049375 "rtsp.c:2543"   Type: "User-Agent", content: "AirPlay/620.8.2"
     0.000136771 "rtsp.c:2543"   Content Plist (as XML):

It seems like "ptp-utilities.c:225" isnt being called after the remote command in the new iOS versions.
So is it an issue with NQPTP? Since this does never happen on new iOS versions → Send control message to NQPTP: "/nqptp P"

@mikebrady
Copy link
Owner

Thanks for the report! Just BTW, is Shairport Sync the same version in both?

Anyway, the Send control message to NQPTP: "/nqptp P" message is generated by Shairport Sync once the audio feed has been stopped by the player -- in other words, it's Shairport Sync responding to information coming from the player. If the player isn't sending that information (we suspect that it's just ignoring the dacp command) then nothing would happen...

@Vaskyy
Copy link

Vaskyy commented Nov 26, 2024

i do also see that with the old AirPlay User-Agent there is an "Active-Remote" content.

         0.000148125 "rtsp.c:2543"   Type: "Content-Length", content: "64"
         0.000055782 "rtsp.c:2543"   Type: "Content-Type", content: "application/x-apple-binary-plist"
         0.000047708 "rtsp.c:2543"   Type: "CSeq", content: "47"
         0.000045208 "rtsp.c:2543"   Type: "DACP-ID", content: "292C08CD5FC924AD"
         0.000040990 "rtsp.c:2543"   Type: "Active-Remote", content: "3880305684"
         0.000049375 "rtsp.c:2543"   Type: "User-Agent", content: "AirPlay/620.8.2"
         0.000136771 "rtsp.c:2543"   Content Plist (as XML):

But with the newer User-Agent there is no remote anymore :(

         0.000243959 "rtsp.c:2543"   Type: "Content-Length", content: "64"
         0.000130469 "rtsp.c:2543"   Type: "Content-Type", content: "application/x-apple-binary-plist"
         0.000132447 "rtsp.c:2543"   Type: "CSeq", content: "375"
         0.000113750 "rtsp.c:2543"   Type: "User-Agent", content: "AirPlay/775.3.1"
         0.000180782 "rtsp.c:2543"   Content Plist (as XML):

@Vaskyy
Copy link

Vaskyy commented Nov 26, 2024

Thanks for the report! Just BTW, is Shairport Sync the same version in both?

Anyway, the Send control message to NQPTP: "/nqptp P" message is generated by Shairport Sync once the audio feed has been stopped by the player -- in other words, it's Shairport Sync responding to information coming from the player. If the player isn't sending that information (we suspect that it's just ignoring the dacp command) then nothing would happen...

What do you mean the same version in both?
Im only streaming to a single shairport-sync service, and copying the logs from that.
I tried to stream with my iPhone SE and then 12mini.
SE is able to being controlled with remote MQTT commands from home assistant mini-player.
12mini not.

@mikebrady
Copy link
Owner

Thanks -- sorry for not being clear.

Your observation about the missing User-Agent is correct, as far as we know, sadly.

@Vaskyy
Copy link

Vaskyy commented Nov 26, 2024

Sorry for the noob suggestion:
Isnt there a way to just ... tell shairport that its an different user-agent to get the controls back?

@mikebrady
Copy link
Owner

Sorry for the noob suggestion: Isnt there a way to just ... tell shairport that its an different user-agent to get the controls back?

Not a bad suggestion at all! Sadly, we've tried it, and no cigar.

We've also been looking to see if it's carried somewhere else, but unfortunately haven't found it.

If anyone has any more ideas, we'd love to hear 'em.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants