Author Topic: ALTSonos Group ID changes overtime.  (Read 149 times)

Offline kyle.dawson

  • Full Member
  • ***
  • Posts: 153
  • Karma: +1/-1
ALTSonos Group ID changes overtime.
« on: December 27, 2018, 09:42:57 am »
I have started to use the ALTSonos plugin to run TTS over my sonos.  Announcements, etc  But one flaw I have seen is that you must play the sound/TTS over a Group ID. The problem lies in that the group ID will change over time and there is not way via Luup code to retrieve it.   When ever I pair speakers via a group, in the Sonos App, the Group ID number will change.  Or if I create a

local ALTUI_DEVICE_NO = 850
local ALTUI_DEVICE_SID = "urn:upnp-org:serviceId:altui1"
local ALTSONOS_DEVICE_NO = 879
local ALTSONOS_DEVICE_SID = "urn:upnp-org:serviceId:altsonos1"
local GROUP_ID_KITCHEN = "RINCON_B8******:725"


--Set Volume and Make announcement
luup.call_action(ALTSONOS_DEVICE_SID, "SetVolumeRelative", { groupID = GROUP_ID_KITCHEN, volumeDelta = DIFFERANCE_VOLUME} , ALTSONOS_DEVICE_NO)
luup.call_action(ALTUI_DEVICE_SID, "SayTTS", {newMessage = EVENT_MESSAGE, newVolume = EVENT_VOLUME, newGroupDevices = GROUP_ID_KITCHEN}, ALTUI_DEVICE_NO)


1) Is there a way to have TTS over a "Player ID"? New Action?
               luup.call_action(ALTUI_DEVICE_SID, "SayTTS", {newMessage = EVENT_MESSAGE, newVolume = EVENT_VOLUME, newPlayerName = "Kitchen"}, ALTUI_DEVICE_NO)
2) Is it possible to get Group ID via new action based on Friendly name?  New Action?
               resultCode, resultString, job, returnArguments = luup.call_action(ALTSONOS_DEVICE_SID, "GetGroupID", { playerName= "Kitchen"} , ALTSONOS_DEVICE_NO)


With the Group ID changing, it will be impossible to really use Sonos, unless I am missing something.



VeraPlus(1), Sonos(3), GE Switch(30), GE Dimmer(5), GE Zwave Outlet(3), MimoLight Garage Door(1),Neo Motion(6), Door Sensors(3) Camera(9), Honeywell Thermostat(2), Google Home(4), Alexa(4), Google Chrome Cast(5)  - Driven via ALTUI

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3164
  • Karma: +209/-8
Re: ALTSonos Group ID changes overtime.
« Reply #1 on: December 28, 2018, 12:42:16 pm »
I have started to use the ALTSonos plugin to run TTS over my sonos.  Announcements, etc  But one flaw I have seen is that you must play the sound/TTS over a Group ID. The problem lies in that the group ID will change over time and there is not way via Luup code to retrieve it.   When ever I pair speakers via a group, in the Sonos App, the Group ID number will change.  Or if I create a

local ALTUI_DEVICE_NO = 850
local ALTUI_DEVICE_SID = "urn:upnp-org:serviceId:altui1"
local ALTSONOS_DEVICE_NO = 879
local ALTSONOS_DEVICE_SID = "urn:upnp-org:serviceId:altsonos1"
local GROUP_ID_KITCHEN = "RINCON_B8******:725"


--Set Volume and Make announcement
luup.call_action(ALTSONOS_DEVICE_SID, "SetVolumeRelative", { groupID = GROUP_ID_KITCHEN, volumeDelta = DIFFERANCE_VOLUME} , ALTSONOS_DEVICE_NO)
luup.call_action(ALTUI_DEVICE_SID, "SayTTS", {newMessage = EVENT_MESSAGE, newVolume = EVENT_VOLUME, newGroupDevices = GROUP_ID_KITCHEN}, ALTUI_DEVICE_NO)


1) Is there a way to have TTS over a "Player ID"? New Action?
               luup.call_action(ALTUI_DEVICE_SID, "SayTTS", {newMessage = EVENT_MESSAGE, newVolume = EVENT_VOLUME, newPlayerName = "Kitchen"}, ALTUI_DEVICE_NO)
2) Is it possible to get Group ID via new action based on Friendly name?  New Action?
               resultCode, resultString, job, returnArguments = luup.call_action(ALTSONOS_DEVICE_SID, "GetGroupID", { playerName= "Kitchen"} , ALTSONOS_DEVICE_NO)


With the Group ID changing, it will be impossible to really use Sonos, unless I am missing something.

v 0.12 includes a change that enables you to pass a playerID instead of a groupID; the action will affect the group currently owning that player. please note the UPNP parameter name change

Offline kyle.dawson

  • Full Member
  • ***
  • Posts: 153
  • Karma: +1/-1
Re: ALTSonos Group ID changes overtime.
« Reply #2 on: December 28, 2018, 01:34:37 pm »
I uploaded new version and reloaded LUUP engine.  But getting failure now:


08      12/28/18 13:16:00.141   JobHandler_LuaUPnP::HandleActionRequest device: 879 service: urn:upnp-org:serviceId:altsonos1 action: AudioClip <0x778eb320>
08      12/28/18 13:16:00.141   JobHandler_LuaUPnP::HandleActionRequest argument Duration=4 <0x778eb320>
08      12/28/18 13:16:00.141   JobHandler_LuaUPnP::HandleActionRequest argument groupID=RINCON_B8######### <0x778eb320>
08      12/28/18 13:16:00.142   JobHandler_LuaUPnP::HandleActionRequest argument urlClip=http://192.168.1.120/altui-sonos.mp3 <0x778eb320>
04      12/28/18 13:16:00.143   <Job ID="188" Name="" Device="850" Created="2018-12-28 13:15:58" Started="2018-12-28 13:15:58" Completed="2018-12-28 13:16:00" Duration="1.324267000" Runtime="1.323854000" Status="Successful" LastNote=""/> <0x778eb320>
01      12/28/18 13:16:00.144  LuaInterface::CallFunction_Job device 879 function SALTSonos_altsonos1_AudioClip_job failed [string "-- // This program is free software: you ca..."]:855: bad argument #3 to 'format' (string expected, got nil) <0x778eb320>
01      12/28/18 13:16:00.144   Lua_Job::Run job#189 : dev:879 (0x19c77a0) P:50 S:0 Id: 189 failed <0x778eb320>



I get same error if I use the Action from ALTUI SayTTS or if I use my own luup code. It creates the MP3, but when it looks to run the AudioClip, it fails.   When I try the AudioClip from the ALTSonos Action directly, it works.  I think you updated the parms in ALTSonos but in ALTUI, does not pass new name?   groupID_playerID


I updated local copy L_ALTUI.lua and seems to works now.

local params = {urlClip=uri, Duration=estDuration}
if (groupDevices ~= "") then
    params["groupID_playerID"]= groupDevices
else
   params["groupID_playerID"]= "ALL"
end

VeraPlus(1), Sonos(3), GE Switch(30), GE Dimmer(5), GE Zwave Outlet(3), MimoLight Garage Door(1),Neo Motion(6), Door Sensors(3) Camera(9), Honeywell Thermostat(2), Google Home(4), Alexa(4), Google Chrome Cast(5)  - Driven via ALTUI

Offline amg0

  • Moderator
  • Master Member
  • *****
  • Posts: 3164
  • Karma: +209/-8
Re: ALTSonos Group ID changes overtime.
« Reply #3 on: December 28, 2018, 01:49:04 pm »
I uploaded new version and reloaded LUUP engine.  But getting failure now:


08      12/28/18 13:16:00.141   JobHandler_LuaUPnP::HandleActionRequest device: 879 service: urn:upnp-org:serviceId:altsonos1 action: AudioClip <0x778eb320>
08      12/28/18 13:16:00.141   JobHandler_LuaUPnP::HandleActionRequest argument Duration=4 <0x778eb320>
08      12/28/18 13:16:00.141   JobHandler_LuaUPnP::HandleActionRequest argument groupID=RINCON_B8######### <0x778eb320>
08      12/28/18 13:16:00.142   JobHandler_LuaUPnP::HandleActionRequest argument urlClip=http://192.168.1.120/altui-sonos.mp3 <0x778eb320>
04      12/28/18 13:16:00.143   <Job ID="188" Name="" Device="850" Created="2018-12-28 13:15:58" Started="2018-12-28 13:15:58" Completed="2018-12-28 13:16:00" Duration="1.324267000" Runtime="1.323854000" Status="Successful" LastNote=""/> <0x778eb320>
01      12/28/18 13:16:00.144  LuaInterface::CallFunction_Job device 879 function SALTSonos_altsonos1_AudioClip_job failed [string "-- // This program is free software: you ca..."]:855: bad argument #3 to 'format' (string expected, got nil) <0x778eb320>
01      12/28/18 13:16:00.144   Lua_Job::Run job#189 : dev:879 (0x19c77a0) P:50 S:0 Id: 189 failed <0x778eb320>



I get same error if I use the Action from ALTUI SayTTS or if I use my own luup code. It creates the MP3, but when it looks to run the AudioClip, it fails.   When I try the AudioClip from the ALTSonos Action directly, it works.  I think you updated the parms in ALTSonos but in ALTUI, does not pass new name?   groupID_playerID


I updated local copy L_ALTUI.lua and seems to works now.

local params = {urlClip=uri, Duration=estDuration}
if (groupDevices ~= "") then
    params["groupID_playerID"]= groupDevices
else
   params["groupID_playerID"]= "ALL"
end

yes I also updated ALTUI.

please note  these ALTSONOS evolutions:
v 0.12 : Ability to pass a playerID in the UPNP api where a groupID is expected. the api will affect the group currently owning the player
v 0.13 : respect Volume parameter in AudioClip UPNP action if specified ( set new volume and restore old one after )

Offline kyle.dawson

  • Full Member
  • ***
  • Posts: 153
  • Karma: +1/-1
Re: ALTSonos Group ID changes overtime.
« Reply #4 on: December 28, 2018, 02:05:05 pm »
Reloaded and everything working and now able to use player IDs.  Thanks for update.
VeraPlus(1), Sonos(3), GE Switch(30), GE Dimmer(5), GE Zwave Outlet(3), MimoLight Garage Door(1),Neo Motion(6), Door Sensors(3) Camera(9), Honeywell Thermostat(2), Google Home(4), Alexa(4), Google Chrome Cast(5)  - Driven via ALTUI