Homey Dashboards — Public Beta Megathread

yes if we can just open spotify in somewhat of a window or popup and then let it rund in the background that is also fine

1 Like

The Spotify app is lacking a lot of useful features, but I can imagine there is a lot more interesting to work on right now for the Homey team. However,… it seems so simple based of some coding I’ve done in the past few hours.

As mentioned above, the Spotify Web API, does provide methods to control your Spotify Connect device. Despite the official plug-in telling us there are limitations to it.

Not knowing the limitations (and options) of Homey Apps, I just decided to dive in and see what I would run into. But surprisingly (and luckily?) enough it turns out the capabilities can be bound to the Spotify Web API logic!

What I’ve succeeded in so far…
As far as I can tell there shouldn’t be any limitations into the implementation function-wise, as the API supports the features below. All green checked items have been added to my demo so far:

  • :white_check_mark: Show the currently being played song (artist, song and album)
  • :white_check_mark: Setting the album art
  • :white_check_mark: Previous and next actions for the player
  • :white_check_mark: Getting the currently set volume of the device
  • :white_check_mark: Setting volume to a given percentage
  • :white_check_mark: Pausing and playing the player
  • :white_check_mark: Muting and unmuting the player
  • :white_check_mark: Cycle through the player shuffle modes
  • :white_check_mark: Setting the player to repeat

Search playlist / song from within a widget
Besides that I also tested an app widget holding an input field. The app allows the display of this field and usage of it’s value. Based of this finding I’m currently trying to create custom widgets that allow me for searching a song and sending the “Play song” command to my device. The downside to this approach would be 2 separate widgets (1 playback, 1 search) but at least it’s something better compared to switching to the Spotify app on your device or using your phone.

I’d be happy to share what I’ve got with the Athom team to see if this can be implemented into the official app and widget (at least the control functionality).

Current state
On the left (Macbook) is my current Spotify Connect speaker widget compared to right (Samsung Soundbar) which comes with the official app. Oh, and on the plus side: volume control isn’t tripping like the Sonos widget does :clap:

4 Likes

Thank you. I think I remembered wrong and that’s why I somehow in my mind thought it would work but good thing I asked here first before spending money on something I wasn’t going to be able to use. I caved in and bought a big tablet, that should do the trick :smiling_face::smiling_face::+1:

You sir are a genious! please share! :slight_smile:

1 Like

{BD1DE43D-D881-490F-8B6B-8D166692C121}
I have this widget of the persons on the dashboard - in the emulator it works, but on the table it does not react to any touch at all - I can’t figure out why

It looks great. Thanks for your contribution @pendojoshua

Beside sharing your findings with Homey (I guess, I would use the official channel by contacting Homy support), it would be great if you could share a step by step in the Tutorials section of this community as I have seen many requests for a better integration between Homey and Spotify

@pendojoshua nice work! The largest problem here are the rate-limits. Even with the extended rate-limits it is not sufficient… Homey supported this feature many years ago for Spotify. Would be nice if you found a way to work around the rate-limits :smiling_imp:

1 Like

And that is exactly what that method does. Only not in a window. :wink:

I didnt really understand how that works, and I dont want to buy another app just to try, can you share some pics?
and more info how this then looks like with the homey dashboard / app running as main thing?

@Harwin @Didier_SmartHome @Rocky_Lonigro: thanks for the kind words! I need a bit more time and I’ve got a few more things to fix first before this can be released in the wild. As said my preference is to find a fitting solution for the official app, but I wouldn’t mind releasing this open-source.

Rate-limit
The rate limit for Spotify is based on a 30-second window usage. While Spotify hasn’t mentioned absolute numbers a topic on their forum (https://community.spotify.com/t5/Spotify-for-Developers/Web-API-ratelimit/td-p/5330410) believes about 2-3 request per second is still valid. The extended limit should be a lot more, but no info on that one at all.

I’ve got a few tricks up my sleeve to prevent unnecessary calls, but it all comes down to the amount of users that would install the widget. Things I’ve done / will do:

  • The volume slider triggers a lot of unneeded calls. Of course this makes changing volume sound smooth but this is an easy place to reduce calls: setting a timestamp when the volume has changed and only applying it to the api if there at least has been an X interval could help here. Maybe combined with 10% steps: if the step is 10% or larger, apply instantly otherwise queue.
  • I also queue updating the Homey widget interface (artist, album, track and art) by using an interval of 15 seconds. While I understand that this does give a pretty large timeframe in which the UI shows the wrong song I also can’t imagine this being an issue for the use case of the tablet as a controller. Besides the interval, synching the interface also happens instantly as it’s bound to the player’s next and previous functions.
  • You can get the device status (online yes/no and playing yes/no), based off of these values I want to increase or decrease the interval lenght. F.e. the offline device can be synced once per minute, a non-playing device every 30 seconds and when its online and playing every 10-15 sec. State would be overwritten as soon as you start it from within the app / widget.

As good as this sounds, all these numbers do increase rapidly when usage of the app increases. The amount of widgets * the amount of calls per interval = total usage. And I can see why that (eventually) is going to be an issue.

Solution(?): setup Spotify web API per user
Another solution would be to have each user setup their own Spotify Web API account and insert their credentials in the setup process of the app. This would scope the usage to just their Homey devices. While looking for code examples I ended up sniffing around in HomeAssistant and noticed that’s in their Spotify instructions as well. As it’s just filing in some forms it’s not exactly rocket science. And as far as I’m concerned a valid option that most of us should feel comfortable with.

Questions
As I’ve just been tinkering around for about 10 hours with Homey (loving it so far!) there are a few things I need some help or explanation to:

  1. For some reason setting an image resource for the albumArt does not work very good when using homey app run, it does however work if I use homey app install.
  2. :white_check_mark: When I run homey app run I get errors on speaker_shuffle and speaker_repeat: invalid capability. When installing the app there are no errors, but the UI buttons on the media card are not working. Any idea’s? This is fixed, not sure how, but it suddenly started working :man_shrugging:

Current state
All capabilities work in the player! See screenshot below.

Want to take this to the testrack?
If anybody is interested in playing around with this Spotify app, feel free to do so. I’ve released the source code to Github with a set of instructions on how to get it running. You have to be comfortable with using the homey cli (for now). I’ll gladly accept suggestions for code improvements :slight_smile:

5 Likes

A verry hard time :wink:

For the handy-few among us, I’ve added the source code for the Spotify app to Github with instructions on how to set it up. Feel free to test, feedback and suggest your findings!

After testing and improving the app I hope to find an option to have the OAuth2 app id and secret to be part of the app settings. As soon as I figure that out the app should be publishable and usable for regular users with a few instructions on how to create the Spotify app.

I’m also going to stop hijacking this thread so we can get back on topic about the dashboard feature. Although this is part of it I feel like I’m taking the focus of the actual subject here. I created a separate topic in the Apps sub-forum for the people interested:

2 Likes

I also have a few dashboards but now I want to put variable in them but I can’t choose one I only get “next event title”

Homey is 2016 version 12.1.0

Who can help me with this?

You can run iPados apps in a mac, but that doesnt mean that they always run well