n00b001 / plexamp_homeassistant

A guide mainly to myself for how to connect PlexAmp and HomeAssistant
GNU General Public License v3.0
7 stars 0 forks source link

New plexamp integration #1

Open gloaysa opened 8 months ago

gloaysa commented 8 months ago

Hey man, just to let you know I was inspired by your work and I've made a proper integration on HomeAssistant of plexamp.

This is my PR: https://github.com/home-assistant/core/pull/111465

It's currently a work in progress, but I have installed on my own live home assistant instance and even if it's lacking some things (like volume control) is fully functional for back, next, pause, play, shuffle and repeat. I'm also getting the artist and album so it can be displayed in a mini-player (screenshot below).

My next step is to add also the ability to select a playlist to start a new session and I'm looking into being able to activate the DJ (although I'm not sure this is possible).

If the PR gets rejected because it's quite similar to functionality to the current Plex integration, I'll make a custom_component out of it to be integrated from HACS.

Just to let you know, I felt like I owed to you :)

imagen

PS: If you want to test it out, you gonna have to add the translations. When creating the PR to HA core, the translations are missing because are auto-generated. To do so, just copy the plexamp folder to your custom_components folder and copy the content of string.json into a file called en.json and place it in a folder named translations (you have to create that) at the root of plexamp.

n00b001 commented 8 months ago

Hello!

You w done something fantastic here, what a good idea!

I'll check out your implementation over the coming week and give it a go, it sounds far more polished than my implementation!

Let me know if I can help with anything, the DJ idea sounds pretty good, I usually just play the mixes from my phone (as in, control playback from my phone, the sound comes out of my receiver)

Thank you for reaching out with the message, it's a very nice thing to do!♥️

I suspect the usage of plexamp will have a major uptick with homeassistant integration (I know there is synced multi room playback coming soon too..)

gloaysa commented 8 months ago

My use case is a bit particular: I like to use the phone as a controller too, but I work from home and when I sit on my work chair in the morning an automation is triggered that, among other things, starts my music. I've been relying on Sonos integration for this, playing my music library on plex. That means, I have to go to the horrible Sonos app to control stuff manually if I'm not feeling like going into HA.

I have started playing with Plexamp recently, and I just felt in love. My main drawback: I couldn't start it from home assistant so I still had to rely on Sonos for that. Until I started digging and found this repo!

I've been using my still WIP component for five days now. I still can't add a playlist, but I've gone an step back on my automation and it doesn't start the playlist automatically. I do that from my phone. But pausing/starting again when I go into and out of a meeting is working wonderfully. Also changing the volume once my wife comes back home (yes! I finally added the option to set the volume!).

You also get the sensor out of the box so you know what of your plexamps are playing.

If you want to jump in, feel free to work on my branch. The basic full control functionality is there now and to reach the MVP that I've set for myself only remains being able to select and start albums/playlists. I'm going to be looking into that. Then all the unit tests are missing, and the documentation. If you have experience with python, a code review would be more than welcome. I feel like my code is a bit all over the place.

Edit to say that if you want to add the integration manually, in the manifest.json add "version": "1.0.0"