Closed TobiBu closed 4 years ago
Hi Tobias
I just started using mozilla's web thing gateway
Welcome on board!
when I turn on the spotify adapter it turns itself off immediately
It sounds like the adapter is crashing.
Can you please check the logs for errors?
You'll find them at /settings/developer
after clicking on View Internal Logs.
Hi Tim,
Thanks for your quick answer! The internal logs say this:
2020-04-30 17:29:31.992 INFO : spotify-adapter: Setting state to true 2020-04-30 17:29:32.110 ERROR : spotify-adapter: AddonManagerProxy: Failed to setProperty state to true for device: Spotify 2020-04-30 17:29:32.111 ERROR : spotify-adapter: { [WebapiError: Unauthorized] name: 'WebapiError', message: 'Unauthorized', statusCode: 401 }
not sure what this means. I guess something went wrong with the spotify authorisation?
cheers Tobias
I think the access token is expired. I'm currently refactoring the adapter. This may already solve it. Does the problem persist after rebooting the adapter?
what exactly does rebooting mean? simply deactivating and activating the adapter again? Or deinstall and reinstall?
simply deactivating and activating the adapter again
This one 😄
nope, that does not work. I'll might try reinstalling and getting new spotify credentials...
A prepared a new update to add some more logs: https://github.com/mozilla-iot/addon-list/pull/810
stupid question, how do I install this specific update? not the normal way via add-ons in the gateway section, right?
stupid me, reading helps a lot. Can install version 0.2.3
this is the new log:
2020-04-30 18:53:41.889 INFO : Unloading SpotifyAdapter 2020-04-30 18:53:41.893 INFO : spotify-adapter: Adapter: SpotifyAdapter unloaded 2020-04-30 18:53:45.636 INFO : Loading add-on: spotify-adapter 2020-04-30 18:53:46.597 INFO : spotify-adapter: Opening database: /home/pi/.mozilla-iot/config/db.sqlite3 2020-04-30 18:53:47.017 INFO : spotify-adapter: Loading add-on spotify-adapter from /home/pi/.mozilla-iot/addons/spotify-adapter 2020-04-30 18:53:47.386 INFO : spotify-adapter: Initializing spotify client 2020-04-30 18:53:47.402 INFO : spotify-adapter: Found client id 2020-04-30 18:53:47.405 INFO : spotify-adapter: Found access token 2020-04-30 18:53:47.407 INFO : spotify-adapter: Authorizing client by authorization code 2020-04-30 18:53:47.659 INFO : spotify-adapter: Client is now authorized 2020-04-30 18:53:55.024 INFO : spotify-adapter: Setting state to true 2020-04-30 18:53:55.163 ERROR : spotify-adapter: AddonManagerProxy: Failed to setProperty state to true for device: Spotify 2020-04-30 18:53:55.164 ERROR : spotify-adapter: { [WebapiError: Not Found] name: 'WebapiError', message: 'Not Found', statusCode: 404 } 2020-04-30 18:53:57.811 INFO : spotify-adapter: Setting state to true 2020-04-30 18:53:57.993 ERROR : spotify-adapter: AddonManagerProxy: Failed to setProperty state to true for device: Spotify 2020-04-30 18:53:57.994 ERROR : spotify-adapter: { [WebapiError: Not Found] name: 'WebapiError', message: 'Not Found', statusCode: 404 }
stupid question
There are no stupid questions. Feel free to ask anything :)
how do I install this specific update?
When I prepare an update I create a new PR in the https://github.com/mozilla-iot/addon-list repo. As soon as it's merged the update is available in the addons section in your gateway. You could also download the build and extract it to the right folder in your gateway.
this is the new log
Thanks. The access key seems to be ok but the API refuses to fulfill the request. I'm not sure why a 404 is returned but it may be related to the selected device. Can you please try to play a song in your Spotify app and pause it via the addon?
amazing, that seems to work...
So, the adapter does not open spotify itself? It needs the spotify app to be open on my laptop or phone?
So, the adapter does not open spotify itself?
If you don't specify a device in the play/pause commands the currently active device is used. I guess if there is no active device the API does not know which device to use. That's why they return a 404.
Another possible explanation would be that there was no device available at all.
You can see the list of available devices here.
Just click on GET TOKEN
and TRY IT
.
After that, you should see a list of devices on the right side.
It needs the spotify app to be open on my laptop or phone?
The spotify app seems to be only available if it's open. That's a limitation of the Spotify API.
I'm thinking about creating one gateway device per Spotify device. This way you could control a specific device rather than the currently active device.
I'm closing this now as the issue seems to be resolved.
Thanks a lot for your help! Much appreciated. It seems like you know a lot about developing adapters. What's the best way to get started? I am currently reading through Mozilla's Documentation but maybe you have some more advice?
Thanks a lot for your help! Much appreciated.
You're welcome :)
It seems like you know a lot about developing adapters.
I created one or two 😬
What's the best way to get started?
It depends on what you would wanna do. There are bindings for Python and JS. I prefer TypeScript though. There is an example adapter written in JS. If you prefer python you need to look at one of the existing adapters.
In order to get the gateway running, you simply need to
Open http://localhost:8080 in the browser.
To start developing an adapter:
.mozilla-iot/addons
in your home directoryAfter changing something in the adapter you need to restart (enable/disable) the adapter.
If the directory .mozilla-iot/addons
does not exist already you may have to install one of the adapters in the gateway ui.
If you have any problems, feel free to ask me.
I see, thanks a lot!
I bought the aquara cube which is not recognised by the gateway. I was planning on working on that...
So, you recommend development on the laptop or directly on raspberry?
So, you recommend development on the laptop or directly on raspberry?
It's way faster on the laptop if your pi is not connected to a monitor. If you need the pi because of the hardware requirements it's easier to develop on the pi though.
I bought the aquara cube which is not recognised by the gateway.
There is already an adapter for zigbee devices. You may only need a supported zigbee stick.
ah, yeah. Its recognising the cube as a zigbee device. But it does not recognise the different options... So I thought, maybe I need to do the features on my own.
But it does not recognise the different options
Then I'd suggest you open an issue in the adapter repo. Maybe there is just a little part missing. There is a list of all available classifiers.
I'll try that, thanks. It seems someone had already opened an issue about that there.
Hi Tim,
ich hab noch eine eher generelle Frage. Hast du auch Erfahrung mit dem voice controller?
Viele Grüße Tobias
Hi Tim,
I just started using mozilla's web thing gateway and came across your spotify adapter. I followed the instructions to set it up and the little box was ticked after the procedure but now when I turn on the spotify adapter it turns itself off immediately. I guess it it is not properly connecting. Any clue why that might be? It's probably a simple fault of mine as I am just starting with the gateway. Any help would be highly appreciated.
cheers Tobias