Max2Play Home › Forums › Max2Play on Raspberry PI › Access to Max2play away from home
- This topic has 5 replies, 2 voices, and was last updated 5 years, 10 months ago by Martinsthlm premium.
-
Posted in: Max2Play on Raspberry PI
-
4. Januar 2019 at 18:09 #43162
Hi,
I use Spotify to randomly play some music when nobody is home (to give the impression that someone is home). Works fine most of the time. However, sometimes the spotify connect plugin on LMS and the Spotify plugin does not work and I need to reboot Max2play. Is there a way to do it remotely when I am not on my home network? In other words, I want to remote access. One way to solve it could be to install a remote switch to turn off the power to the RPi but I guess it is not a good solution for the SD card etc.
/Martin7. Januar 2019 at 15:00 #43205Hi Martin,
You can use our API examples plugin to copy the HTTP command for Max2Play reboot. You can use this command through any device in your network or an existing home automation setup or even in your own VPN solution to access it from anywhere.
9. Januar 2019 at 11:54 #43322Thanks Heiner!
I made a script in Home Asssistant and it works perfectly.10. Januar 2019 at 10:38 #43378That sounds great! If you can find the time, we would appreciate you sharing your process and script (anonymized/generalized if possible) for other users to be able to recreate it.
11. Januar 2019 at 18:38 #43536No probblem. It was not that advanced and quite easy.
In the config.yaml in Home assistant I wrote:rest_command:
my_request:
url: http://192.168.1.xx/plugins/max2play_settings/controller/Squeezeserver.php?action=restart
method: GET
my_request_2:
url: http://192.168.1.xx:9000/status.html?p0=mixer&p1=volume&p2=-10&player=%5BMAC ADRESS FROM M2P API]
method: GET
my_request_3:
url: http://192.168.1.xx:9000/status.html?p0=mixer&p1=volume&p2=%2B10&player=%5BMAC ADRESS FROM M2P API]
method: GETImportant, I gave the RPI a static ip adress in the router since I point the rest_commandt to a specific local IP adress.
Then I used the script editor in Hassio and created scripts „rest_command.my_request“ without any additional adjustments, „rest_command.my_request_2“ etc and then added the script ID to the Lovelace UI.Voilá, from the Home assistant app I can execute each specific script and the squeezebox server restarts, lower volume etc.
Now I just have to wait until Spotify connect is unreachable (not very often that problem occurs though) to see if it solves the problem. It should. 🙂
22. Januar 2019 at 9:36 #43972Update:
The remote restart of Max2Play via HomeAssistant works just fine! Great!
-
You must be logged in to reply to this topic.