SONOS app - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Application Store (https://forum.logicmachine.net/forumdisplay.php?fid=11) +--- Thread: SONOS app (/showthread.php?tid=415) |
RE: SONOS app - Hippolyte - 09.09.2019 Hello everyone I have been following this conversation for the last year and implementend the SE version which was working nicely. I'd like to test this new app and more specifically the new Sonos API. Has anyone manage to control their Sonos with the new API ? I am completely stuck with all theses : Create authorization code -> https://developer.sonos.com/reference/authorization-api/create-authorization-code/ Create token -> https://developer.sonos.com/reference/authorization-api/create-token/ etc ... I don't know what part is already done by the LM Sonos App itself and what part should I do to have a simple script doing play/pause (without using the objects automatically created but fully Sonos API) ? https://developer.sonos.com/reference/control-api/playback/play/ Anyone could help us on that ? Thank you very much. RE: SONOS app - Erwin van der Zwart - 10.09.2019 Hi, The old version of the Sonos app was created by me, in that app i created a self build API that was able to receive HTTP command with arguments and those where converted to LUA commands to SOAP (UpnP). The new version of the app is build by our development department and the decission was made to certify the app to be able to use the official Sonos API, due to this certification we where forced to drop the self build API in the app. Now you can only use the objects that are created automatically by adding them to the touch application. There is no build in mechanisme to send HTTP commands to the app anymore in the new version. We still can use the old .lp API by uploading it to the ftp folder, but i still need to make some adjustments as the old app performed a auto scan of Sonos devices on startup that is now missing in the .lp file, but i have no time this moment to do it. BR, Erwin RE: SONOS app - Daniel - 11.09.2019 Hi Here is how to use new Sonos app via script: The app runs a daemon which keeps communication with each player/group The daemon will be closed down after 120s if no update is send so we need to run such script every 60s to keep communication up and running. Code: require('custom.sonos.lib') To control the players we need to know groupID which can be read via such command. Code: groupID=sonos_app.GetStoragePlayerGroups() Basic control is done like this Code: -- simle command: play, pause, skipToPrev, skipToNext Code: -- set volume The url_group_id is in the table from the groupID but it can be read automatically when we know group name so example start/pause script would looks like that. Code: require('custom.sonos.lib') To read Playlist table use this Code: sonos_app.GetStoragePlayerGroupData(groupID, 'Playlists') To Play a playlist Code: -- play playlist by ID To read Favorites use Code: sonos_app.GetStoragePlayerGroupData(groupID, 'Favorites') To play a Favorites Code: sonos_app.SendApiActionCommand(url_groupID, 'playFavorite', url_favID) RE: SONOS app - Hippolyte - 11.09.2019 Thank you very much Erwin and Daniel for you answers ! RE: SONOS app - Trond Hoyem - 06.10.2019 (11.09.2019, 07:47)Daniel. Wrote: HiHi Daniel Is there a command for reading the volume level? If one wants a slider for volume, it would be good to be able to update the slider if the volume is changed from somewhere else than the LM-object. RE: SONOS app - Daniel - 07.10.2019 I think it is in the table when you read this. Code: groupID=sonos_app.GetStoragePlayerGroups() RE: SONOS app - Daniel - 07.10.2019 I just checked and there is no volume in there. You can read it this way Code: groupstate = storage.get('app:se-sa:' .. groupID .. ':GroupVolume') * table: ["fixed"] * bool: false ["volume"] * number: 35 ["muted"] * bool: false RE: SONOS app - Trond Hoyem - 14.10.2019 (07.10.2019, 11:54)Daniel. Wrote: I just checked and there is no volume in there. You can read it this wayOK, thx Will try this. RE: SONOS app - Igor68 - 26.10.2019 Hi, please help!)) Sonos does not play files with the old API ... (( where could there be an error? require('socket.url') require('socket.http') socket.http.TIMEOUT = 5 reply = socket.http.request('http://198.168.0.10/user/sonos.lp?action=getsonosdata') file = socket.url.escape('http://admin:pass@192.168.0.10/user/Mix_Lastochka.mp3') reply = socket.http.request('http://admin:pass@192.168.0.10/user/sonos.lp?action=say&ip=192.168.0.32&audiofile=' .. file .. '&volume=90&duration=10') log(reply) RE: SONOS app - Igor68 - 26.10.2019 Event for sonos (32/5/56) 26.10.2019 12:41:35 * string: Error in /www/user/sonos.lp at line 544: attempt to index global 'sonos' (a nil value) RE: SONOS app - Daniel - 28.10.2019 New app do not support those libraries. You can install old app, link below, or you can manually upload libraries from old app. All was explained here just read this thread few pages back. https://forum.logicmachine.net/showthread.php?tid=415&pid=13173#pid13173 RE: SONOS app - Erwin van der Zwart - 28.10.2019 Hi, Just tested this, and is still working, you cannot send a mp3 to the Sonos from a password secured location so you must disable the password of the user folder or use a different source location. BR, Erwin RE: SONOS app - Igor68 - 28.10.2019 (28.10.2019, 13:18)Эрвин ван дер Цварт Wrote: Привет,Эрвин, привет, правда. ) Все работает, но файл недоступен. Как отключить пароль для ftr? На вкладке вы можете только ввести другой пароль .... Все работает, но файл недоступен. Как отключить пароль для ftr? На вкладке вы можете только ввести другой пароль .... Erwin, hi, really. ) Everything works, but the file is not available. How to disable password for ftr? In the tab you can only enter another password .... sorry for my English)) RE: SONOS app - Erwin van der Zwart - 28.10.2019 Hi, On the bottom of the user access tab there is a button "User access settings" uncheck the checkbox "Enable password for User directory", any source in the user folder is now reachable without the need of a password so Sonos should be able to access it. BR, Erwin RE: SONOS app - Igor68 - 29.10.2019 Erwin, I can’t remove the password. I followed all your instructions, but the password remains, I can access the apps with only a password. Did a soft reset. Any other ideas? RE: SONOS app - Erwin van der Zwart - 29.10.2019 Hi, Unchecking the box for the user folder should be enough, what do you mean by apps folder? You only need to change this: http://admin:pass@192.168.0.10/user/Mix_Lastochka.mp3 to http://192.168.0.10/user/Mix_Lastochka.mp3 When running http://192.168.0.10/user/Mix_Lastochka.mp3 in the browser (new session, no other sessions open) it should play the .mp3, if that works then Sonos should be able to reach it.. BR, Erwin RE: SONOS app - Igor68 - 29.10.2019 Works! Erwin, thank you so much! RE: SONOS app - Hippolyte - 09.12.2019 Hello everyone, we the previous version of the Sonos app when someone physically pressed the volume button on the Sonos it updated the value on the appropriate object on the LM. Is it still possible with the new app ? I know I can do a resident on groupstate = storage.get('app: se-sa:' .. groupID .. ':GroupVolume') to get the updated value yet it is not really elegant way of having the updated value if the user physically pressed the volume button Thank you for you help. RE: SONOS app - Daniel - 09.12.2019 Yes, when you add widget then groups with monitoring are also created, same as in old one. RE: SONOS app - Arnoud - 14.12.2019 Daniel can you give a example using the new API for playing a doorbell mp3? |