Assisted RPi Install – step 4

This topic is applicable to Sonos owners only.

This is the fourth and final stage of the assisted install option for your Raspberry Pi. The first step can be found here.

This stage covers some wrap up jobs; some convenience functions, and some security functions to protect your database, and to protect your Raspberry Pi against hacker attack.

Index:

Cause AlbumPlays to autostart whenever the RPi is rebooted

The Raspberry Pi module of AlbumPlays needs to be already running whenever you listen to music on your Sonos system.

It is likely that your Raspberry Pi has neither screen nor keyboard, so it is best that your Raspberry Pi is kept running the whole time, and that it autostarts AlbumPlays each time that it is powered up or rebooted.

click here for how to cause AlbumPlays to autostart on the RPi
configure to autostart AlbumPlays
configure to autostart AlbumPlays … click to expand
  • step #1: on the RPi, open the File Manager (ie their Explorer) by clicking the folders icon on the toolbar at the top
  • step #2: navigate to the following directory … nb. Linux hides the .local directory; the File Manger will open at /home/pi … either type the whole path as shown below, or add /.l … so that it now reads /home/pi/.l … and then use the arrow and tab keys to complete your selection, then press the Enter key to navigate to it

    /home/pi/.local/bin

  • step #3: right click the file named Xrunspy_auto.sh … this opens a pop-up menu

  • step #4: select Rename, and remove the leading X, so that the file name is runspy_auto.sh
  • step 5: reboot the the Raspberry Pi, and verify that AlbumPlays has auto-started … hint: the following section shows how to control and observe the Raspberry Pi from your Windows PC

collapse

 

Controlling and observing the Raspberry Pi from your Windows PC

One of the greatest advantages of choosing to run the AlbumPlays Spy component upon a Raspberry Pi, is that it reliably just runs and runs, without need of attention. But there are some exceptions, where you may want to interact or peek inside:

  • you want to close it down, or reboot it … if you are using the database transfer option, you should protect that database by closing down AlbumPlays before turning off the Raspberry Pi, or rebooting
  • or you want to check whether AlbumPlays is running, or has successfully detected all of your Sonos zones … your current Sonos plays will be lost if the AlbumPlays Spy component is not running, or it can’t see your Sonos zone for some reason … this is useful following a Sonos software update
  • or you experience a problem within the Spy module … in which case you need to put the Rasberry Spy ito debug mode, or get the info & error logs, so that you can send them to me
  • or you are using the text file transfer method for fresh play observations, or some communications problem has lost some plays from the transfer *database … you will need to trigger the Raspberry Pi to transfer the fresh observations to your PC

You access the Raspberry Pi Remote Control Menu via a link, which is sent to the transfer location that you specified during install of the Spy module, or manually reconfigured with the Spy module’s _nas_path configuration option.

The file name of the control menu link is sonos_spy_menu.html. The menu is rewritten each time the Raspberry Pi is rebooted. It always has the same name, so you may create a desktop shortcut pointing to that file path and file name.

See here for detailed instructions regarding Spy Remote Control menu facilities.

 

Set your local timezone

Configure your Raspberry Pi so that your track plays are recorded using your local time zone.

click here for details showing how to set the RPi to your time zone
  • click on the raspberry icon, top left, and take option “Raspberry Pi Configuration
  • set local timezone step1
  • select the Localisation tab, then Set Timezone, and select your own location
  • select your own timezone

collapse

 

Change your Raspberry Pi password

Your Raspberry Pi will appear on your local network as RASPBERRYPI, and its password is albumplays.

The Raspberry Pi device is an example of the “Internet Of Things”; a massive exponential growth of devices which attach to the Internet. Any of these could be targeted by hackers, and you should not be one the 15% of users, who do not change their default password. .. A hacked Raspberry Pi in your network endangers more than just your track play history.

The Raspberry Pi is an extremely successful example of the “Internet Of Things”. It is currently the third best-selling “general purpose computer” ever, behind Apple Macintosh and Microsoft Windows PCs. This means that the default password for each Raspberry Pi is known to everyone.

AlbumPlays has already taken a small step towards securing your Raspberry Pi, as it has changed its password, from the default of “raspberry“, to “albumplays“.

You should change this to a personal password.

click here for details showing how to change your password
  • click on the raspberry icon, top left, and take option “Raspberry Pi Configuration
  • change password step 1
  • press the Change Password button
  • change password step 2
  • you will then be required to supply the existing password, and then type the new password twice

collapse

 

Change your Raspberry Pi network host name
Network hostname

You can change the Raspberry Pi hostname from the default of *RASPBERRYPI”. This could be useful if you have more than one Raspberry Pi to add to on your network, or you want rename it to something which better describes its function.


click here for how to change the network host name
  • click on the raspberry icon, top left, and take option “Raspberry Pi Configuration
  • change hostname step 1
  • change the hostname, and then press OK
  • change hostname step 2
  • you will then be asked for permission for the Raspberry Pi to reboot itself … press Yes
  • I changed my hostname to albumplays … as you can see in the following diagram, after rebooting, the Raspberry Pi is now called ALBUMPLAYS in my network, but I can no longer access it using Explorer from my Windows PC
  • unable to access new hostname
  • you fix this via a configuration change on the Raspberry Pi
  • change SMB password
  • … as shown in the above illustration, click on the Terminal icon on the Raspberry Pi toolbar, and then type the following command into the Linux Terminal window is opened for you

    sudo smbpasswd -a pi
    
  • the Raspberry Pi will ask for your RaspBerry Pi password twice … nb: the RPi does not echo back any confirmation as you type the password characters; ie. you get no * characters

  • the next time that you try to open your renamed Raspberry Pi from Windows, you will receive the same authentication challenge, but this time a User Name of pi and your RPi password should provide access

collapse

 

Create a backup copy of O&D component and the RPi environment

You should make a bootable copy of RPi SD card, ie.:

  • the RPi Operating System
  • the AlbumPlays O&D component, and its database
  • all of your configuration
  • ie. everything 🙂
click here for details
clone your SD card
RPi: card cloning utility
  • Buy a microSDHC with adapter sleave, having at least 8gb
  • plug the card into a USB SD card reader
  • on your Windows PC, format the card to FAT (see “How to format an SD card as FAThere)
  • eject the USB card reader, and then plug it into a USB port on your RPi
  • press the Raspberry icon, at the top left of the RPi screen
  • take menu option Accessories|SD_CardCopier
  • more details about use of the Card Copier utility here (roll down to “SD Card Copier“)

collapse

 

How to use the clone SD card:

  • power the Raspberry off
  • replace the current SD card with the backup copy
  • power up the raspberry Pi

 

Configure RPi to send an alert email if problems arise

You can configure the Raspberry Pi to send yourself an alert email if some problem stops it from storing track play observations. It will also send you a confirmation email each time the Spy O&D is restarted or terminated.

click here for details

You first need to configure the Play Counts module of AlbumPlays with email credentials as described here

And then you need to transfer the encrypted email credentials to the Spy Transfer database on the Raspberry Pi.

transfer credentials

And then, since the Raspberry Pi is unattended, you need to supply it with the encryption phrase that you used to encrypt your email credentials, as described here

Then use the raspberry Pi Control Menu to reboot the RPi.

Verify that all is configured OK by checking to make sure that you received a “start-up” email from the Raspberry Pi Spy O&D module.

collapse