Home of the Squeezebox™ & Transporter® network music players.
Page 3 of 3 FirstFirst 123
Results 21 to 28 of 28
  1. #21
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    4,553
    Quote Originally Posted by mherger View Post
    > My suggestion (which Michael has said before that he does not like but
    > it works great for me) ...


    But it's so much more complicated than needed... and risks to mess with
    the managed plugins folder.

    I never zip the files before release. I edit them right from inside
    their folder where LMS picks them up whenever I restart LMS.
    I don't like running a 2nd LMS on the same LAN because real players used by others in the house sometimes migrate to it and leads to turmoil.
    So LMS on pCP is production and development ... and I tend to write the code in Windows using Notepad++

    It does mean that I can only try out something new when no-one else is listening to stuff but that is not a big issue since it stops me spending inordinate amounts of time on it!
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  2. #22
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,590

    LMS Plugin Development

    > I don't like running a 2nd LMS on the same LAN because real players used
    > by others in the house sometimes migrate to it and leads to turmoil.


    I do this all the time, in the office as well as at home. AFAIK original
    hardware would never switch server. squeezelite would pick whatever was
    available when starting and the "old" server wasn't available. But none
    of this should happen out of the blue.

  3. #23
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    4,553
    Plus ... running LMS on Windows makes it harder to debug tricky things when (as I had to do to recently understand the Protocol Handler stuff better) I need to put extra tracing code in the core LMS.
    Paul Webster
    http://dabdig.blogspot.com
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, Supla Finland, ABC Australia, CBC/Radio-Canada and RTE Ireland

  4. #24
    Senior Member
    Join Date
    Apr 2005
    Location
    Honiton, Devon, UK
    Posts
    1,969
    Quote Originally Posted by mherger View Post
    > After restarting LMS, here's what happens:

    You need to initialize the Settings in your plugin. Add

    use Plugins::M218::Settings;

    at the top of it, and in initPlugin() you do:

    Plugins::M218::Settings->new();

    Instead of dealing with a pCP's folders I'd recommend you run LMS on
    your local dev machine. This allows you to easily restart LMS without
    having to copy files around etc.
    Got home from being out for the afternoon to see your very quick response, and tried your suggestion.

    Success!
    It was as simple as adding those extra lines into my plugin.
    I will now start looking at adding the additional configuration settings that it ought to have, and remove the hard-coded stuff.

    Thank you so much for your assistance, much appreciated.

    BTW, it's no problem for me to copy files to the pCP server using Samba, and restarting LMS is no hassle. I'm not planning to be a regular plugin developer, so this is all pretty much a one-off.
    Until recently: Transporter -> ATC SCM100A, now sold :-(
    House move forced change to: piCorePlayer(RPi2/HiFiBerry DIGI2 Pro/HiFiBerry DSP) -> Meridian 218 -> Meridian M6

  5. #25
    Senior Member philchillbill's Avatar
    Join Date
    Jan 2019
    Location
    The Netherlands
    Posts
    802
    Sorry to be late to the party, but if this plug-in is only for your own use in your setup, it
    might be easier to just ssh into the SBR and run a shell script on it on a cron schedule to turn your amp on/off together with the player.

    See my post from a few years ago on the Domoticz forum. It reads the Lux sensor in the SBR and updates Domoticz accordingly. Not quite your application but might give you some ideas to push from the SBR instead of push from LMS.

    https://www.domoticz.com/wiki/Logite...o_and_SB-Touch

  6. #26
    Quote Originally Posted by cliveb View Post
    OK, making progress. I decided that all I really needed to do was switch the Meridian 218 on & off with the Squeezebox player,
    Here's some code from my DenonSerial plugin that I think should help:

    Code:
    # outside/before initPlugin() is where I usually put this:
    $serverPrefs = preferences('server');
    
    # inside initPlugin() register to have your code run any time the power status changes for any player:
    $serverPrefs->setChange(\&powerChange, 'power');
    # inside initPlugin you might also want to tell LMS to run some code when a new player connects (after player reset, network disruption, etc):
    Slim::Control::Request::subscribe( \&newPlayerCheck, [['client']],[['new']]);
    
    # after initPlugin() define the powerChange() function
    sub powerChange {
        my ($pref, $val, $client) = @_;
        my $id = $client->id(); # client ID, e.g. MAC address if normal Squeezbox; use this to decide what to do / if you care
        #$val will be 1 if the player just turned on, 0 if it just turned off
        # do your work
    }
    
    # after initPlugin() define newPlayerCheck():
    sub newPlayerCheck {
        my $request = shift;
        my $client = $request->client();
        my $id = $client->id(); # client ID, e.g. MAC address if normal Squeezbox; use this to decide what to do / if you care
        # power status is available as $client->power()
        #etc
    }
    Last edited by peterw; 2021-06-09 at 19:12. Reason: add notes about $client->power() API
    owner of the stuff at https://tuxreborn.netlify.app/
    (which used to reside at www. tux.org/~peterw/)
    Note: The best way to reach me is email or PM, as I don't spend much time on the forums.
    Free plugins: AllQuiet Auto Dim/AutoDisplay BlankSaver ContextMenu DenonSerial
    FuzzyTime KidsPlay KitchenTimer PlayLog PowerCenter/BottleRocket SaverSwitcher
    SettingsManager SleepFade StatusFirst SyncOptions VolumeLock

  7. #27
    Senior Member
    Join Date
    Apr 2005
    Location
    Honiton, Devon, UK
    Posts
    1,969
    Quote Originally Posted by peterw View Post
    Here's some code from my DenonSerial plugin that I think should help:
    ...
    Thanks Peter, but as you'll see from my post #24, I now have it working.
    The problem was never intercepting and dealing with the power status change - it was figuring out how to install the plugin so it was usable on any kind of player.

    Incidentally, I suspect that my desire to control the Meridian 218 is pretty niche and therefore not worth the effort to release it as a 3rd party plugin. (There's a whole heap of extra functionality that would be needed to handle all the possile use cases that 218 owners might want).

    But if anyone else wants it, drop me a PM and I can send you the code. I think it should also work with a Meridian Audio Core 200 as that uses the same protocol.
    Until recently: Transporter -> ATC SCM100A, now sold :-(
    House move forced change to: piCorePlayer(RPi2/HiFiBerry DIGI2 Pro/HiFiBerry DSP) -> Meridian 218 -> Meridian M6

  8. #28
    Quote Originally Posted by cliveb View Post
    Thanks Peter, but as you'll see from my post #24, I now have it working.
    I missed that but am glad to hear it!
    owner of the stuff at https://tuxreborn.netlify.app/
    (which used to reside at www. tux.org/~peterw/)
    Note: The best way to reach me is email or PM, as I don't spend much time on the forums.
    Free plugins: AllQuiet Auto Dim/AutoDisplay BlankSaver ContextMenu DenonSerial
    FuzzyTime KidsPlay KitchenTimer PlayLog PowerCenter/BottleRocket SaverSwitcher
    SettingsManager SleepFade StatusFirst SyncOptions VolumeLock

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •