Announcement

Collapse
No announcement yet.

Alarm not working with 8.3?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Originally posted by mherger View Post
    Rather than just blocking player-refs notifications we should probably just ignore any player specific notification:

    Code:
    diff --git a/Slim/Utils/Alarm.pm b/Slim/Utils/Alarm.pm
    index e6acade08..abf4be8a6 100644
    --- a/Slim/Utils/Alarm.pm
    +++ b/Slim/Utils/Alarm.pm
    @@ -1982,6 +1982,11 @@ sub _alarmEnd {
                    main::DEBUGLOG && $isDebug && $log->debug('Ignoring self-created request');
                    return;
            }
    +       elsif ($source && $source !~ m|^/[a-z0-9]+/slim/request| && $source =~ m|^/[a-z0-9]+/slim/\w+/(?:[0-9a-f]:){5}[0-9a-f]|i) {
    +               warn Data::Dump::dump($request, 'Alarm: ignored event');
    +               main::DEBUGLOG && $isDebug && $log->debug('Ignoring notification to subscriber');
    +               return;
    +       }
            elsif ($source) {
                    warn Data::Dump::dump($request, 'Alarm: fired event');
                    $log->error("Unknown source: $source");
    Would anybody be able to apply this and test? I think that (most) interactive actions taken by a user would be `/abc213/slim/request`, whereas notification come with a MAC address in the source element. As notifications already are in response to some action we should ignore them.
    Testing this change today, I'm still getting alarm failures, first a sanity check... here's the code changes I copied into /usr/local/slimserver/Slim/Utils/Alarm.pm

    Click image for larger version

Name:	newcode.jpg
Views:	1
Size:	113.9 KB
ID:	1576120

    and here's a BBEdit differences between the original Alarm.pm (left) and the modified Alarm.pm (right)

    Click image for larger version

Name:	diff.jpg
Views:	1
Size:	153.3 KB
ID:	1576121

    Logfile extract of one of the failures:

    [22-11-27 10:30:00.0016] Slim::Utils::Alarm::sound (516) Alarm triggered for Spare Radio 2
    [22-11-27 10:30:00.0025] Slim::Utils::Alarm::sound (560) Sounding alarm
    [22-11-27 10:30:00.0054] Slim::Utils::Alarm::sound (589) Current Power State: Off
    [22-11-27 10:30:00.0105] Slim::Utils::Alarm:ushAlarmScreensaver (1839) Attempting to push into alarm screensaver: . Current mode: INPUT.List
    [22-11-27 10:30:00.0117] Slim::Utils::Alarm::sound (609) Current vol: 18 Alarm vol: 18
    [22-11-27 10:30:00.0126] Slim::Utils::Alarm::sound (622) Alarm playlist shufflemode: 0
    [22-11-27 10:30:00.0143] Slim::Utils::Alarm::sound (628) Alarm playlist url: sounds://_LIVE_bbc_radio_two
    [22-11-27 10:30:00.0293] Slim::Utils::Alarm::_setAlarmSubscription (1204) Adding alarm subscription
    [22-11-27 10:30:00.0304] Slim::Utils::Alarm::sound (697) Scheduling time out in 300 seconds
    [22-11-27 10:30:00.0311] Slim::Utils::Alarm::_startStopTimeCheck (1880) 0 scheduled alarm(s)
    [22-11-27 10:30:00.0316] Slim::Utils::Alarm::_startStopTimeCheck (1889) Stopping time checker task
    [22-11-27 10:30:00.0321] Slim::Utils::Alarm::scheduleNext (1391) Asked to schedule next alarm for Spare Radio 2
    [22-11-27 10:30:00.0326] Slim::Utils::Alarm::findNextTime (461) Potential next time found: 18:0:0 27/11/2022
    [22-11-27 10:30:00.0330] Slim::Utils::Alarm::findNextTime (466) Last alarm due: 10:30:0 27/11/2022
    ~KeBul - removed lots of findNextTime entries~
    [22-11-27 10:30:00.0708] Slim::Utils::Alarm::findNextTime (461) Potential next time found: 9:45:0 28/11/2022
    [22-11-27 10:30:00.0713] Slim::Utils::Alarm::findNextTime (466) Last alarm due: 10:30:0 27/11/2022
    [22-11-27 10:30:00.0717] Slim::Utils::Alarm::scheduleNext (1424) Next alarm is at 10:45:0 27/11/2022
    [22-11-27 10:30:00.0721] Slim::Utils::Alarm::scheduleNext (1435) Scheduling alarm
    [22-11-27 10:30:00.0725] Slim::Utils::Alarm::_startStopTimeCheck (1880) 1 scheduled alarm(s)
    [22-11-27 10:30:00.0728] Slim::Utils::Alarm::_startStopTimeCheck (1884) Starting time checker task
    [22-11-27 10:30:00.0813] Slim::Utils::Alarm::_alarmEnd (1970) _alarmEnd called with request: stop
    [22-11-27 10:30:00.0833] Slim::Utils::Misc::msg (1325) Warning: [10:30:00.0828] (
    bless({
    _cb_args => undef,
    _cb_enable => 1,
    _cb_func => undef,
    _clientid => "00:04:20:26:1d:b9",
    _func => sub { "???" },
    _isQuery => 0,
    _langoverride => undef,
    _needClient => 1,
    _params => {},
    _request => ["stop"],
    _requeststr => "stop",
    _results => {},
    _source => "/c6aad791/slim/playerprefs/00:04:20:26:1d:b9|20||c6aad791|Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15",
    _status => 10,
    _useixhash => 0,
    }, "Slim::Control::Request"),
    "Alarm: fired event",
    ) at /usr/local/slimserver/Slim/Utils/Alarm.pm line 1991.
    [22-11-27 10:30:00.0838] Slim::Utils::Alarm::_alarmEnd (1992) Unknown source: /c6aad791/slim/playerprefs/00:04:20:26:1d:b9|20||c6aad791|Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15
    [22-11-27 10:30:00.0841] Slim::Utils::Alarm::_alarmEnd (2002) Stopping alarm
    [22-11-27 10:30:00.0854] Slim::Utils::Alarm:opAlarmScreensaver (1866) Attempting to pop alarm screensaver. Current mode: INPUT.List
    [22-11-27 10:30:01.0863] Slim::Utils::Alarm::__ANON__ (901) Restoring pre-alarm shuffle mode: 0
    [22-11-27 10:30:01.0881] Slim::Utils::Alarm::__ANON__ (905) Restoring pre-alarm power state: off

    Comment


      Originally posted by gordonb3 View Post
      If you could I would appreciate you verifying the patch for the LMS side I posted earlier (with the 'bad' MaterialSkin). Obviously it is good when the current issue gets solved from whatever side but I think the objective should be to stop this forever rather than rely on Craig fixing it all.
      I tested this last night and it seemed to work...

      Code:
      # Don't respond to requests that we created ourselves
      	my $source = $request->source;
      	if ($source && (($source eq 'ALARM') || ($source eq 'PLUGIN_RANDOMPLAY') || (index($source,'playerprefs') != -1))) {
      		warn Data::Dump::dump($request, 'Alarm: ignored event');
      		main::DEBUGLOG && $isDebug && $log->debug('Ignoring self-created request');
      		return;
      	}
      	elsif ($source) {
      		warn Data::Dump::dump($request, 'Alarm: fired event');
      		$log->error("Unknown source: $source");
      	}
      Here's my test actions/results log:

      21:25 - Alarm OK - timeout to end, log file shows source=ALARM
      21:40 - Alarm OK - timeout to end, log file shows source=ALARM
      Opened Material MacOS/Safari, swapped players from BB to SR2 and then to Lounge - left monitoring Lounge
      21:55 - Alarm OK - timeout to end, log file shows source=blahblah'playerprefs’
      22:10 - Alarm OK - Turned off Material player dropdown, log file shows source=ALARM
      22:30 - Alarm OK - timeout to end, log file shows source=blahblah’playerprefs’
      22:40 - Alarm OK - timeout to end, log file shows source=ALARM, changed to SR2 and then back to Lounge in Material
      22:50 - Alarm OK - timeout to end, log file shows source=blahblah’playerprefs’, changed to SR2 and then back to Lounge in Material
      23:00 - Alarm OK - timeout to end, log file shows source=blahblah’playerprefs’

      Here's a debug extract from 21:55 alarm which showed a source of 'playerprefs' but the Alarm still worked:

      [22-11-26 21:55:00.0011] Slim::Utils::Alarm::sound (516) Alarm triggered for Spare Radio 2
      [22-11-26 21:55:00.0020] Slim::Utils::Alarm::sound (560) Sounding alarm
      [22-11-26 21:55:00.0045] Slim::Utils::Alarm::sound (589) Current Power State: Off
      [22-11-26 21:55:00.0091] Slim::Utils::Alarm:ushAlarmScreensaver (1839) Attempting to push into alarm screensaver: . Current mode: INPUT.List
      [22-11-26 21:55:00.0100] Slim::Utils::Alarm::sound (609) Current vol: 18 Alarm vol: 18
      [22-11-26 21:55:00.0109] Slim::Utils::Alarm::sound (622) Alarm playlist shufflemode: 0
      [22-11-26 21:55:00.0124] Slim::Utils::Alarm::sound (628) Alarm playlist url: sounds://_LIVE_bbc_radio_two
      [22-11-26 21:55:00.0317] Slim::Utils::Alarm::_setAlarmSubscription (1204) Adding alarm subscription
      [22-11-26 21:55:00.0329] Slim::Utils::Alarm::sound (697) Scheduling time out in 300 seconds
      [22-11-26 21:55:00.0338] Slim::Utils::Alarm::_startStopTimeCheck (1880) 0 scheduled alarm(s)
      [22-11-26 21:55:00.0341] Slim::Utils::Alarm::_startStopTimeCheck (1889) Stopping time checker task
      [22-11-26 21:55:00.0348] Slim::Utils::Alarm::scheduleNext (1391) Asked to schedule next alarm for Spare Radio 2
      [22-11-26 21:55:00.0353] Slim::Utils::Alarm::findNextTime (461) Potential next time found: 14:0:0 27/11/2022
      [22-11-26 21:55:00.0356] Slim::Utils::Alarm::findNextTime (466) Last alarm due: 21:55:0 26/11/2022
      ~KeBul - removed lots of findNextTime entries~
      [22-11-26 21:55:00.0680] Slim::Utils::Alarm::findNextTime (461) Potential next time found: 16:15:0 27/11/2022
      [22-11-26 21:55:00.0684] Slim::Utils::Alarm::findNextTime (466) Last alarm due: 21:55:0 26/11/2022
      [22-11-26 21:55:00.0688] Slim::Utils::Alarm::scheduleNext (1424) Next alarm is at 22:10:0 26/11/2022
      [22-11-26 21:55:00.0692] Slim::Utils::Alarm::scheduleNext (1435) Scheduling alarm
      [22-11-26 21:55:00.0696] Slim::Utils::Alarm::_startStopTimeCheck (1880) 1 scheduled alarm(s)
      [22-11-26 21:55:00.0700] Slim::Utils::Alarm::_startStopTimeCheck (1884) Starting time checker task
      [22-11-26 21:55:00.0785] Slim::Utils::Alarm::_alarmEnd (1970) _alarmEnd called with request: stop
      [22-11-26 21:55:00.0805] Slim::Utils::Misc::msg (1325) Warning: [21:55:00.0800] (
      bless({
      _cb_args => undef,
      _cb_enable => 1,
      _cb_func => undef,
      _clientid => "00:04:20:26:1d:b9",
      _func => sub { "???" },
      _isQuery => 0,
      _langoverride => undef,
      _needClient => 1,
      _params => {},
      _request => ["stop"],
      _requeststr => "stop",
      _results => {},
      _source => "/91843e22/slim/playerprefs/00:04:20:26:1d:b9|17||91843e22|Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15",
      _status => 10,
      _useixhash => 0,
      }, "Slim::Control::Request"),
      "Alarm: ignored event",
      ) at /usr/local/slimserver/Slim/Utils/Alarm.pm line 1981.
      [22-11-26 21:55:00.0810] Slim::Utils::Alarm::_alarmEnd (1982) Ignoring self-created request
      [22-11-26 21:55:00.0846] Slim::Utils::Alarm::_alarmEnd (1970) _alarmEnd called with request: power
      [22-11-26 21:55:00.0866] Slim::Utils::Misc::msg (1325) Warning: [21:55:00.0861] (
      bless({
      _cb_args => undef,
      _cb_enable => 1,
      _cb_func => undef,
      _clientid => "00:04:20:26:1d:b9",
      _func => sub { "???" },
      _isQuery => 0,
      _langoverride => undef,
      _needClient => 1,
      _params => { _newvalue => 1, _noplay => undef },
      _request => ["power"],
      _requeststr => "power",
      _results => {},
      _source => "/91843e22/slim/playerprefs/00:04:20:26:1d:b9|17||91843e22|Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15",
      _status => 10,
      _useixhash => 0,
      }, "Slim::Control::Request"),
      "Alarm: ignored event",
      ) at /usr/local/slimserver/Slim/Utils/Alarm.pm line 1981.
      [22-11-26 21:55:00.0870] Slim::Utils::Alarm::_alarmEnd (1982) Ignoring self-created request
      [22-11-26 21:55:00.1666] Slim::Utils::Alarm::_alarmEnd (1966) Ignoring unwanted notification: playlist stop
      [22-11-26 22:00:00.0341] Slim::Utils::Alarm::_timeout (1162) Alarm b609635f ending automatically due to timeout
      [22-11-26 22:00:00.0429] Slim::Utils::Alarm:opAlarmScreensaver (1866) Attempting to pop alarm screensaver. Current mode: INPUT.List
      [22-11-26 22:00:01.0434] Slim::Utils::Alarm::__ANON__ (896) Restoring pre-alarm volume level: 18
      [22-11-26 22:00:01.0450] Slim::Utils::Alarm::__ANON__ (901) Restoring pre-alarm shuffle mode: 0
      [22-11-26 22:00:01.0467] Slim::Utils::Alarm::__ANON__ (905) Restoring pre-alarm power state: off

      Cheers

      Kev
      Last edited by KeBul; 2022-11-27, 17:40.

      Comment


        Originally posted by KeBul View Post
        Testing this change today, I'm still getting alarm failures, first a sanity check...
        I suspect a typo in Michael's second regex, checking for a MAC address in the source but I don't see it offhand.
        Last edited by SamY; 2022-11-27, 17:34.
        Sam

        Comment


          Originally posted by SamY View Post
          I suspect a typo in Michael's second regex, checking for a MAC address in the source but I don't see it offhand.
          At the risk of exposing my limited knowledge of the intricacies of regular expressions, I believe the problem could be the trailing 'i' after the pattern in the last regex. I would replace:

          Code:
          m|^/[a-z0-9]+/slim/\w+/(?:[0-9a-f]:){5}[0-9a-f]|i
          with:

          Code:
          m|^/[a-z0-9]+/slim/\w+/(?:[0-9a-f]:){5}[0-9a-f]|
          i.e. No trailing 'i'
          Sam

          Comment


            The trailing i is to indicate that the text matching should be case-insensitive.
            Paul Webster
            Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
            and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin

            Comment


              Originally posted by Paul Webster View Post
              The trailing i is to indicate that the text matching should be case-insensitive.
              I stand exposed...
              Sam

              Comment


                Really interesting thread and thanks for tirelessly chasing the bug. This morning I had it again - faulty/non-triggered alarm with my 8.3.1 setup and the whole family overslept - the interesting thing about it, I hadn't touched the setup for the past few weeks and I hadn't adjusted the alarm either and it was reliable over this weeks. In my view, material was not really involved and the alarm was always acknowledged over the radios - anyway, I'm really happy that the issue has been recognized and will be fixed soon.

                Best regards and thank you so much!
                LMS: 8.3.1 - 1667914563
                on RPi4/ Raspbian Buster 10
                points to MusicLibrary on QNAP TS212 (NFS)

                1x Duet - Cntrl-FW: 8.0.1-r16907/ Receiver-FW: 77
                2x SB Radio - FW: 8.0.1-r16907
                1x Squeezebox Boom - FW 57
                1x Transporter - FW: 87
                RPi 2B - pCP 8.0.1/ SqueezeLite v1.9.9-1391-pCP
                Softsqueeze 3.9.2 on Win 10 / Squeezeplay 8.0.1r1343 on Win 10
                Squeeze Player 1.3.21 on S22/Android 13.0.0

                Controller:
                Android Phone - Squeezer 2.3.0/ Material Skin 3.0.1

                Comment


                  Originally posted by SamY View Post
                  I stand exposed...
                  Okay. I've got it this time. No, REALLY!!!
                  (I verified it with a regex testing utility.)
                  The problem is missing quantifiers after the components of the MAC address so the solution is to change:

                  Code:
                  m|^/[a-z0-9]+/slim/\w+/(?:[0-9a-f]:){5}[0-9a-f]|
                  To:

                  Code:
                  m|^/[a-z0-9]+/slim/\w+/(?:[0-9a-f]+:){5}[0-9a-f]+|
                  Or, to be more strict:

                  Code:
                  m|^/[a-z0-9]+/slim/\w+/(?:[0-9a-f]{2}:){5}[0-9a-f]{2}|
                  Hopefully this post will redeem my technical credibility to at least a minor extent. In any case, the change should allow Michael's solution to function as intended.
                  Sam

                  Comment


                    Alarm not working with 8.3?

                    > Okay. I've got it this time. No, REALLY!!!
                    > (I verified it with a regex testing utility.)
                    > The problem is missing quantifiers after the components of the MAC


                    You're correct!

                    > Hopefully this post will redeem my technical credibility to at least a
                    > minor extent. In any case, the change should allow Michael's solution to
                    > function as intended.


                    Thanks! You got my blessing :-D
                    Michael

                    "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
                    (LMS: Settings/Information)

                    Comment


                      Originally posted by mherger View Post
                      Rather than just blocking player-refs notifications we should probably just ignore any player specific notification:

                      Code:
                      diff --git a/Slim/Utils/Alarm.pm b/Slim/Utils/Alarm.pm
                      index e6acade08..abf4be8a6 100644
                      --- a/Slim/Utils/Alarm.pm
                      +++ b/Slim/Utils/Alarm.pm
                      @@ -1982,6 +1982,11 @@ sub _alarmEnd {
                                      main::DEBUGLOG && $isDebug && $log->debug('Ignoring self-created request');
                                      return;
                              }
                      +       elsif ($source && $source !~ m|^/[a-z0-9]+/slim/request| && $source =~ m|^/[a-z0-9]+/slim/\w+/(?:[0-9a-f]:){5}[0-9a-f]|i) {
                      +               warn Data::Dump::dump($request, 'Alarm: ignored event');
                      +               main::DEBUGLOG && $isDebug && $log->debug('Ignoring notification to subscriber');
                      +               return;
                      +       }
                              elsif ($source) {
                                      warn Data::Dump::dump($request, 'Alarm: fired event');
                                      $log->error("Unknown source: $source");
                      Would anybody be able to apply this and test? I think that (most) interactive actions taken by a user would be `/abc213/slim/request`, whereas notification come with a MAC address in the source element. As notifications already are in response to some action we should ignore them.
                      I actually think that the MAC address is included in the source string when the associated session is controlling a different device, i.e. other than itself. This regex might thus block legit actions to stop the alarm from e.g. Controller.

                      Also not completely unimportant, `index()` is more CPU friendly than regex, even if the latter is applied with fixed strings.

                      Comment


                        Alarm not working with 8.3?

                        > I actually think that the MAC address is included in the source string
                        > when the associated session is controlling a different device, i.e.


                        In that case it would be a /slim/request - which is excluded explicitly.

                        Michael

                        "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
                        (LMS: Settings/Information)

                        Comment


                          Alarm not working with 8.3?

                          New 8.3.1/8.4 builds should be available with this additional check on
                          the source.
                          Michael

                          "It doesn't work - what shall I do?" - "Please check your server.log and/or scanner.log file!"
                          (LMS: Settings/Information)

                          Comment


                            wow, thank you all, would be great if this fixes it.
                            just updated, and now hoping I will wake up tomorrow morning.
                            Wake up with music that is...instead of stressed out kids

                            cheers
                            Dennis

                            Comment


                              Originally posted by mherger View Post
                              New 8.3.1/8.4 builds should be available with this additional check on
                              the source.
                              Thanks Michael,

                              I've been testing this since late morning - 35 successful alarms triggered, no failures, plenty of debug reports of source = blahblah'playerprefs' so we are looking good on the fix for that specific cause of alarm failures.

                              I've started some adhoc functional testing just to check the fix doesn't seem to have broken anything in alarm use - will continue that to completion tomorrow, had enough tonight - Mrs B has been kind enough to share her covid-19 infection and that has now won for the day, time hopefully for some sleep.

                              Kev

                              Comment


                                Wow indeed!
                                Thanks! You are all amazing. I love this community.
                                Just installed and will report if any failure (or Covid)
                                Transporter, Touch, SB3, SB2, Duet, Booms, Radios, piCorePlayer --- iPeng & Material --- LMS Version: 8.3.1 - 1668787267 on Pi4 4GB - Max2Play --- Qobuz

                                Comment

                                Working...
                                X