Aller au contenu

drboss

Membres confirmés
  • Compteur de contenus

    100
  • Inscription

  • Dernière visite

  • Jours gagnés

    5

Tout ce qui a été posté par drboss

  1. drboss

    Support Gea

    Mon problème est résolu, j'ai oublié que pour le temps (-1) une nouvelle instance de la scène est démarrée à chaque fois.
  2. drboss

    Support Gea

    I return to my problem with: I can't find where is the problem, it's occurs with this code (paste partially): --[[ %% properties 344 sceneActivation ../.. GEA.add ({"SceneActivation", 344, 10}, -1, "Ogród - alarm uzbrojony", {{"geatelegram", "Ogród - alarm uzbrojony"}}) GEA.add ({"SceneActivation", 344, 11}, -1, "Ogród - alarm rozbrojony", {{"geatelegram", "Ogród - alarm rozbrojony"}}) if the line is triggered by changed sceneActivation value the command is start (message, scene running) ok, but after this GEA call section for "CentralSceneEvent": centralsceneevent = {name="CentralSceneEvent", optimize = true, control=function(id, key, attribute) if (GEA.currentEntry.duration > -1) then return false, GEA.trad.central_instant end return GEA.options.number.control(id) and type(key)~="nil" and type(attribute)~="nil", GEA.trad.central_missing end, getValue=function(id, key, attribute) return (GEA.source.event.data.deviceId==tonumber(id) and tostring(GEA.source.event.data.keyId)==tostring(key) and tostring(GEA.source.event.data.keyAttribute)==tostring(attribute)) end --LINE 1309 }, And generate error because event table (GEA.source.event) is null. It's clear because it's sceneActivation not CentralSceneEvent from %% events section. The device is UBS with enabled scene functionality. Why this happen, Why???
  3. drboss

    Support Gea

    Mon code: --[[ %% autostart %% properties 312 value 311 sceneActivation 312 sceneActivation %% events %% globals --]] --pour info -- ID.Domogolne.dom_czuwanie = 311 -- ID.Domogolne.ogrod_czuwanie = 312 -- ID.techniczne.sterowanie_alarm = 313 GEA.add ({{"SceneActivation", ID.Domogolne.dom_czuwanie, 20},{"Value", ID.Domogolne.ogrod_czuwanie, 0},{"Time!", "22:00", "06:00"}}, -1, "Ogrod uzbrojony razem z nocnym", {"turnOn", ID.techniczne.sterowanie_alarm}) --wlaczenie ogrodu z noca -- dom_rozb i ( ogr_uzb lub org_alm ) GEA.add ({{"SceneActivation", ID.Domogolne.dom_czuwanie, 21},{"Or",{"SceneActivation", ID.Domogolne.ogrod_czuwanie, 10}, {"SceneActivation", ID.Domogolne.ogrod_czuwanie, 20}},{"Time", "6:00", "23:00"}}, -1, "Ogrod rozbrojony razem z nocnym", {"turnOn", ID.techniczne.sterowanie_alarm}) --wylaczenie ogrodu po nocy GEA exécute correctement les commandes mais... [DEBUG] 13:11:21: 2020-05-01 13:11:21.375676 [ fatal] Unknown exception: /opt/fibaro/scenes/211.lua:1309: attempt to index field 'event' (a nil value) centralsceneevent = {name="CentralSceneEvent", optimize = true, control=function(id, key, attribute) if (GEA.currentEntry.duration > -1) then return false, GEA.trad.central_instant end return GEA.options.number.control(id) and type(key)~="nil" and type(attribute)~="nil", GEA.trad.central_missing end, [1309] getValue=function(id, key, attribute) return (GEA.source.event.data.deviceId==tonumber(id) and tostring(GEA.source.event.data.keyId)==tostring(key) and tostring(GEA.source.event.data.keyAttribute)==tostring(attribute)) end pourquoi???
  4. drboss

    DAHUA  IPC-HDBW2431R-ZS et HC2

    BTW If you things use this camera via api ex. via REST HTTP it use digest authorisation. If you have problem with snapshot image taken by link with onvif in address (ex below) turn off onvif authorisation in camera setup. But test first with turned on STEP 8 - Check that MediaUri field contains valid URL URI: http://192.168.1.109/onvifsnapshot/media_service/snapshot?channel=1&subtype=0 ex for other Dahua with PTZ. # go to garden gate if opened curl --digest --user admin:pass -v 'http://admin:pass@192.168.1.109/cgi-bin/ptz.cgi?action=start&channel=0&code=GotoPreset&arg1=0&arg2=1&arg3=0' # return to track sleep 15 curl --digest --user admin:pass -v 'http://192.168.1.109/cgi-bin/ptz.cgi?action=start&channel=0&code=StartTour&arg1=1&arg2=0&arg3=0'
  5. drboss

    DAHUA  IPC-HDBW2431R-ZS et HC2

    This time in English :-) Check by this internal tool of ONVIF Assocation (it's old but last public accessed, test all function of Onvif cameras and give links to snaps or live streams) On discovery tab enter IP, user and pass of camera, select network card in NIC box (by default the loopback is selected) and press PROBE. After connected go to diagnostic tab and select <media configuration/media streaming> and <realtime streaming> (or more if you need) after this press RUN SELECTED. After test (with many black window or with image from camera) on right window you will see many interesting info and link to stream or jpg snap. I discovered snapshot link and lowres streams of my new and old Dahua and Novus cameras without problems https://drive.google.com/open?id=1vtl0ajm9oygxdPj4JykXmMrpo5RNYY-L
  6. Et encore mon ancienne modification, une petite pour indique quel VD ou scene vérifié par watchdog n'existe pas: Message("red", "Error : status=" .. tostring(response.status)..", when check: "..watchdog[i].type ..watchdog[i].id) en place du code: Message("red", "Error : status=" .. tostring(response.status))
  7. @tcheri Si vous en avez vraiment besoin at si toujours à jour, petite modification pour redémarrage du bouton avec error: 1. si vous devez vérifier un bouton spécifique, la ligne de VD a l'option ajoutée: vd_button avec le numéro du bouton pour vérifier {type = "VD", id =1151, match = {text="", interval=0}, no_match = {text="", type="ERROR"}, restart=true, notification = {"email", "SQLLOG"}, vd_button ="23"}, 2. modification de code: À la place de la lignes (position env. line 236): if watchdog[i].type:lower() == "scene" then getURL = "http://127.0.0.1:11111/api/scenes/"..watchdog[i].id.."/debugMessages" elseif watchdog[i].type:lower() == "vd" then if watchdog[i].vd_button == nil then watchdog[i].vd_button="0" end getURL = "http://127.0.0.1:11111/api/virtualDevices/"..watchdog[i].id.."/debugMessages/0" else Message("red", "Error : unknown type value") end insérer le code: if watchdog[i].type:lower() == "scene" then getURL = "http://127.0.0.1:11111/api/scenes/"..watchdog[i].id.."/debugMessages" elseif watchdog[i].type:lower() == "vd" then if watchdog[i].vd_button == nil then watchdog[i].vd_button="0" end getURL = "http://127.0.0.1:11111/api/virtualDevices/"..watchdog[i].id.."/debugMessages/"..watchdog[i].vd_button else Message("red", "Error : unknown type value") end
  8. J'ai aussi ce problème avec NodOn
  9. Erreur dans: http://192.168.1.x/services/system/servicesStatus.php - compte incorrectement les DEVICES avec piles vides. Le script compte lorsque la valeur est 0 au lieu de 255
  10. drboss

    Support Gea

    @Steven, @pepite jusqu'à que vous créée la nouvelle édition de GEA , je corrige chez moi comme suit: local num1 = tonumber(string.match(value4, "-?[0-9.]+")) local num2 = tonumber(string.match(result, "-?[0-9.]+")) et je vais tester...
  11. drboss

    Support Gea

    En résumé, la fonction "Value+/-" ne fonctionne pas lorsque la valeur du périphrique est négative et GEA est moins aléatoire qu'une femme...
  12. drboss

    Support Gea

    @pepite C'est comme ça que ça se passe chez moi (GEA6.10): values is taken from 3 thermometers devices value=-23.8 GEA.add({"Value+", 335, -40}, 30, "sukces1 #value#") not work (every time) value=-23.8 GEA.add({"Value-", 335, -10}, 30, "sukces1 #value#") not work (every time) value= 18.2 GEA.add({"Value+", 262, -9}, 30, "sukces2 #value#") work (every time) value= 11.5 GEA.add({"Value+", 1281, 0}, 30, "sukces3 #value#") work (every time) value= 11.5 GEA.add({"Value+", 1281, 0}, 30, "sukces3 #value#") work (every time) value= 11.5 GEA.add({"Value+", 1281,-11}, 30, "sukces3 #value#") work (every time) value= 11.5 GEA.add({"Value+", 1281,-9}, 30, "sukces3 #value#") not work (3 times), work after change condiction to fist position (to verify) value= -6.5 GEA.add({"Value+", 1126, -40}, 30, "sukces1 #value#") not work (every time) value= -6.5 GEA.add({"Value-", 1126, -9}, 30, "sukces2 #value#") not work (every time) ps. C'est comme demander à une femme quelque chose et son cœur répondra. Nous ne savons pas non plus quoi et pour quoi
  13. drboss

    Support Gea

    @pepite , tu es le plus actif alors je te demande, pourquoi {"Value+", 1281, 0} ou {"Value+", 1281, 9} fonctionne mais {"Value+", 1281, -9} ne fonctionne pas?
  14. Nouvelle version: http://192.168.1.x/services/system/servicesStatus.php Des résultats plus détaillés qu'auparavant: {"HCServer":{"running":true,"status":"Ok","devicesStatus":{"disconnected":10,"directRoute":41,"indirectRoute":24,"unknownRoute":26,"batteryEmpty":0,"batteryLow":0,"batteryMedium":17,"batteryHigh":13}},"Zwave":{"running":true,"status":"Ok"},"FibaroServices":{"running":true,"status":"Ok"},"RemoteAccess":{"running":true,"status":"Ok"}}
  15. drboss

    Support Gea

    Oui @Steven bien sûr, c'est un honneur pour moi . C'est juste une modification de votre travail.
  16. Qu'il n'y a pas d'interaction directe entre Google Assistant (Home) et Sonos, Oui pour "Google Assistant et Sonos : l'intégration repoussée à 2019", mais plus tôt il était 2018. Et alexa est déjà...
  17. Bonne route pour l’intégration sonon et google, juste pourquoi pas directement Quand ça fonctionnera si bien avec HC2.........
  18. For me yes, resolve stop 30sec after start play new playlist. I didn't never problem this problem with play / stop / pause list played before. When I have pure connection with one of my sonos and process inicialized by spotify_list take long time and no return state I added sseek()
  19. @pepite vous devez ajouter une commande fibaro:sleep(). J'ai eu le même problème, "PLAY" est effectué avant d'ajouter "PLAYLIST" --stop(); --fibaro:sleep(1000); sdel(); fibaro:sleep(2000) spotify_list('xxxxxx'); --playFile(FileVol); fibaro:sleep(3000); play(); --play(NN) - play NN seconds
  20. Yes @Lazer the api still exist, but without easy fast way to check many parameters by web interface (without xml and authorisation like in VD or via node) When I wrote "Web" I things about http://x.x.x.x:1400/status/tracks etc.
  21. J'utilise principalement des listes créées dans Spotify ( spotify_list() ). Ceci est plus universel pour moi. Les lists Sonos que j'utilise pour la musique enregistrée sur le NAS domestique (mais de moins en moins) ;-)
  22. Le numéro de l'album se trouve dans le client Spotify (PC). Sur client Spotify tu sélectionné l'album intéressant, appuyez sur le bouton droit de la souris, puis "partager" et "copier le lien". Le numéro de l'album est le code après "album/" et devant les signes "? Si =" , emblable avec playlist. https://open.spotify.com/album/22j1vb0GvgRdJ1AdbHtKXT?si=cOqvhLqtT4S53GdPIVq0pg Pour list - "sonos playlists" ( mémorisés dans le Sonos) tu deve découvrir les numéros des listes en vérifiant à partir de 1. (sonos_list(1), sonos_list(2) ...) Malheureusement, sonos a désactivé interface www des produits sonos.
  23. Si @Alexpelli , le problème était lors de la copie du code source dans le forum. Les caractères >, <, etc ont été remplacés par &gt, &lt. Il y a des fragments HTML dans le code LUA, ce qui explique pourquoi c'était un problème. J'ajoute un exemple de VD qui fonctionne sonos_example.vfib
  24. -- SONOS Play playlist, v.0.1 ------------------------------------------------------------------------------------------- ---made on source of:----------------------------------------------------------------------- -- SONOS Play stream... -- Copyright © 2014 Jean-Christophe Vermandé ------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------- ---------------------------------- -- User Settings ---------------------------------- ip = "192.168.1.232" port = 1400 FileVol = 10 PlayUnlimited = "Yes" -- si <> Yes, arrêt après 30s environ --duration = ---------------------------------- -- DO not change bellow this line ---------------------------------- --selfId = fibaro:getSelfId(); --album = fibaro:get(selfId, 'IPAddress'); --port = fibaro:get(selfId, 'TCPPort') or 1400; currentTransportState = ""; lastTransportState = ""; currentVolume = 0; lastVolume = 0; ttsVolumeIsDifferent = false; list_name = "Sonos Playlist n1" --not implemented list_nbr = 1 -- playlist number on jffs system of SONOS, You need test it for find interesting list uid = "RINCON_B8E937B01D4E01400" -- find by http://SONOS_IP:1400/status/upnp --album = "1kFVHozcxeXY3MfKB3F0yw" --album = "22j1vb0GvgRdJ1AdbHtKXT" spotify = "6he9MFK1bEvcA4dOByFJT3" urlencode = function(str) if (str) then str = string.gsub (str, "\n", "\r\n"); str = string.gsub (str, "([^%w ])", function (c) return string.format ("%%%02X", string.byte(c)) end); str = string.gsub (str, " ", "+"); end return str; end createRequestBody = function(action, schema, data) return string.format("<u:%s xmlns:u=\"%s\">%s</u:%s>", action, schema, data, action); end reponseCallback = function(fnc, args) if (fnc == nil) then return nil; end return fnc(args); end createSocket = function() -- Check IP and PORT before if (ip == nil or port == nil) then fibaro:debug("You must configure IPAddress and TCPPort first"); return; end local socket; local status, err = pcall(function() socket = net.FTcpSocket(ip, port); socket:setReadTimeout(1000); end); if (status ~= nil and status ~= true) then fibaro:debug("socket status: " .. tostring(status or '')); end if (err ~= nil) then fibaro:debug("socket err: " .. tostring(err or '')); return; end return socket; end disposeSocket = function(socket) if (socket ~= nil) then socket:disconnect(); socket = nil; return true; end return false; end sendSoapMessage = function(url, service, action, args, callback, retry) local socket = createSocket(); if (socket == nil) then return; end retry = retry or 0 -- prepare data --local url = "POST " .. url .. " HTTP/1.1"; local url = "POST " .. url .. " HTTP/1.1\r\nHOST: ".. ip ..":1400"; fibaro:debug(url) --local udn = "X-SONOS-TARGET-UDN: uuid:RINCON_B8E937B01D4E01400" -- udn of my SONOS (not need) local soapaction = "SOAPACTION: \"" .. service .. "#" .. action.name .. "\""; local body = createRequestBody(action.name, action.service, tostring(args or "")); local envelope = "<?xml version=\"1.0\" encoding=\"utf-8\"?><s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><s:Body>" .. body .. "</s:Body></s:Envelope>"; local ctl = "Content-Length: " .. string.len(envelope); --local payload = url .. "\r\n" .. ctl .. "\r\n" .. udn .. "\r\n" .. soapaction .. "\r\n" .. "\r\n" .. envelope; -- with UDN local payload = url .. "\r\n" .. ctl .. "\r\n" .. soapaction .. "\r\n" .. "\r\n" .. envelope; -- write data local bytes, errorcode = socket:write(payload); if (errorcode == 0) then local state, errorcode = socket:read(); if (errorcode == 0) then if (string.len(state or "") > 0) then -- callback if (callback ~= nil) then reponseCallback(callback, state); end -- dispose ... disposeSocket(socket); return true; else fibaro:debug("Error: Invalid response. response length: " .. string.len(state or "")); end else if (retry < 5) then fibaro:debug("retry #"..retry.." action: " .. action.name); return sendSoapMessage(url, service, action, args, callback, (retry + 1)); else fibaro:debug("Error: Code returned "..tostring(errorcode or "")); end end elseif (errorcode == 2) then fibaro:debug("Error: You must check your IP and PORT settings."); else if (retry < 5) then fibaro:debug("retry #"..retry.." action: " .. action.name); return sendSoapMessage(url, service, action, args, callback, (retry + 1)); else fibaro:debug("Error: Code returned "..tostring(errorcode or "")); end end -- dispose ... disposeSocket(socket); -- default response return false; end stop = function() return sendSoapMessage( -- control url "/MediaRenderer/AVTransport/Control", -- service type "urn:schemas-upnp-org:service:AVTransport:1", -- action { name = "Stop", service = "urn:schemas-upnp-org:service:AVTransport:1" }, -- soap body data (options) "<InstanceID>0</InstanceID><Speed>1</Speed>", -- callback (options) function(response) fibaro:debug("stop sent"); end); end pause = function() return sendSoapMessage( -- control url "/MediaRenderer/AVTransport/Control", -- service type "urn:schemas-upnp-org:service:AVTransport:1", -- action { name = "Pause", service = "urn:schemas-upnp-org:service:AVTransport:1" }, -- soap body data (options) "<InstanceID>0</InstanceID><Speed>1</Speed>", -- callback (options) function(response) fibaro:debug("stop sent"); end); end pnext = function() return sendSoapMessage( -- control url "/MediaRenderer/AVTransport/Control", -- service type "urn:schemas-upnp-org:service:AVTransport:1", -- action { name = "Next", service = "urn:schemas-upnp-org:service:AVTransport:1" }, -- soap body data (options) "<InstanceID>0</InstanceID>", -- callback (options) function(response) fibaro:debug("next sent"); end); end pprev = function() return sendSoapMessage( -- control url "/MediaRenderer/AVTransport/Control", -- service type "urn:schemas-upnp-org:service:AVTransport:1", -- action { name = "Previous", service = "urn:schemas-upnp-org:service:AVTransport:1" }, -- soap body data (options) "<InstanceID>0</InstanceID>", -- callback (options) function(response) fibaro:debug("previous sent"); end); end unMute = function() return sendSoapMessage( -- control url "/MediaRenderer/RenderingControl/Control", -- service type "urn:schemas-upnp-org:service:RenderingControl:1", -- action { name = "SetMute", service = "urn:schemas-upnp-org:service:RenderingControl:1" }, -- soap body data (options) "<InstanceID>0</InstanceID><Channel>Master</Channel><DesiredMute>0</DesiredMute>", -- callback (options) function(response) fibaro:debug("unMute sent"); end); end play = function(duration) return sendSoapMessage( -- control url "/MediaRenderer/AVTransport/Control", -- service type "urn:schemas-upnp-org:service:AVTransport:1", -- action { name = "Play", service = "urn:schemas-upnp-org:service:AVTransport:1" }, -- soap body data (options) "<InstanceID>0</InstanceID><Speed>1</Speed>", -- callback (options) function(response) fibaro:debug("play sent"); end); end sseek = function() return sendSoapMessage( -- control url "/MediaRenderer/AVTransport/Control", -- service type "urn:schemas-upnp-org:service:AVTransport:1", -- action { name = "Seek", service = "urn:schemas-upnp-org:service:AVTransport:1" }, -- soap body data (options) "<InstanceID>0</InstanceID>,<Unit>TRACK_NR</Unit>,<Target>1</Target>", -- callback (options) function(response) fibaro:debug("Seek"); end); end sdel = function() return sendSoapMessage( -- control url "/MediaRenderer/Queue/Control", -- service type "urn:schemas-sonos-com:service:Queue:1", -- action { name = "RemoveAllTracks", service = "urn:schemas-sonos-com:service:Queue:1" }, -- soap body data (options) "<QueueID>0</QueueID>,<UpdateID>0</UpdateID>", -- callback (options) function(response) fibaro:debug("Remove"); end); end sonos_list = function(list_nbr) return sendSoapMessage( -- control url "/MediaRenderer/AVTransport/Control", -- service type "urn:schemas-upnp-org:service:AVTransport:1", -- action { name = "AddURIToQueue", service = "urn:schemas-upnp-org:service:AVTransport:1" }, -- soap body data (options) "<InstanceID>0</InstanceID>,<EnqueuedURI>file:///jffs/settings/savedqueues.rsq#".. list_nbr.."</EnqueuedURI>,<EnqueuedURIMetaData><DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="SQ:1" parentID="SQ:" restricted="true"><dc:title>".. list_name .."</dc:title><upnp:class>object.container.playlistContainer</upnp:class><desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/">RINCON_AssociatedZPUDN</desc></item></DIDL-Lite></EnqueuedURIMetaData>,<DesiredFirstTrackNumberEnqueued>1</DesiredFirstTrackNumberEnqueued>,<EnqueueAsNext>1</EnqueueAsNext>", -- callback (options) function(response) fibaro:debug("set sonos playlist"); end); end spotify_list = function(spotify) --playlist from Spotify return sendSoapMessage( -- control url "/MediaRenderer/AVTransport/Control", -- service type "urn:schemas-upnp-org:service:AVTransport:1", -- action { name = "AddURIToQueue", service = "urn:schemas-upnp-org:service:AVTransport:1" }, -- soap body data (options) "<InstanceID>0</InstanceID>,<EnqueuedURI>x-rincon-cpcontainer:10062a6cspotify%3auser%3apdurbajlo%3aplaylist%3a"..spotify.."</EnqueuedURI>,<EnqueuedURIMetaData><DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="10062a6cspotify%3auser%3apdurbajlo%3aplaylist%3a"..spotify.."" parentID="10082664playlists" restricted="true"><dc:title>Fibaro from Spotify</dc:title><upnp:class>object.container.playlistContainer</upnp:class><desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/">SA_RINCON2311_X_#Svc2311-0-Token</desc></item></DIDL-Lite></EnqueuedURIMetaData>,<DesiredFirstTrackNumberEnqueued>2</DesiredFirstTrackNumberEnqueued>,<EnqueueAsNext>1</EnqueueAsNext>", -- callback (options) function(response) fibaro:debug("set spotify playlist"); end); end spotify_album = function(album) --album from Spotify return sendSoapMessage( -- control url "/MediaRenderer/AVTransport/Control", -- service type "urn:schemas-upnp-org:service:AVTransport:1", -- action { name = "AddURIToQueue", service = "urn:schemas-upnp-org:service:AVTransport:1" }, -- soap body data (options) "<InstanceID>0</InstanceID>,<EnqueuedURI>x-rincon-cpcontainer:1004206cspotify%3aalbum%3a"..album.."</EnqueuedURI>,<EnqueuedURIMetaData><DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="1004206cspotify%3aalbum%3a"..album.."" parentID="100d2064your_albums" restricted="true"><dc:title>Remote</dc:title><upnp:class>object.container.album.musicAlbum</upnp:class><desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/">SA_RINCON2311_X_#Svc2311-0-Token</desc></item></DIDL-Lite></EnqueuedURIMetaData>,<DesiredFirstTrackNumberEnqueued>2</DesiredFirstTrackNumberEnqueued>,<EnqueueAsNext>1</EnqueueAsNext>", -- callback (options) function(response) fibaro:debug("set spotify album"); end); end setVolume = function(value) return sendSoapMessage( -- control url "/MediaRenderer/RenderingControl/Control", -- service type "urn:schemas-upnp-org:service:RenderingControl:1", -- action { name = "SetVolume", service = "urn:schemas-upnp-org:service:RenderingControl:1" }, -- soap body data (options) "<InstanceID>0</InstanceID><Channel>Master</Channel><DesiredVolume>" .. tostring(value) .. "</DesiredVolume>", -- callback (options) function(response) fibaro:debug("Volume set: " .. value); end); end getVolume = function() fibaro:log("Get volume, please wait..."); return sendSoapMessage( -- control url "/MediaRenderer/RenderingControl/Control", -- service type "urn:schemas-upnp-org:service:AVTransport:1", -- action { name = "GetVolume", service = "urn:schemas-upnp-org:service:RenderingControl:1" }, -- soap body data (options) "<InstanceID>0</InstanceID><Channel>Master</Channel>", -- callback (options) function(response) currentVolume = tonumber(response:match("<CurrentVolume>(.+)</CurrentVolume>") or 0); end); end getTransportState = function() return sendSoapMessage( -- control url "/MediaRenderer/AVTransport/Control", -- service type "urn:schemas-upnp-org:service:AVTransport:1", -- action { name = "GetTransportInfo", service = "urn:schemas-upnp-org:service:AVTransport:1" }, -- soap body data (options) "<InstanceID>0</InstanceID>", -- callback (options) function(response) currentTransportState = response:match("<CurrentTransportState>(.+)</CurrentTransportState>") or ""; end); end pause_play = function() getTransportState() fibaro:debug('wstrzymanie'..currentTransportState) if currentTransportState == "PLAYING" then pause() end if currentTransportState == "PAUSED_PLAYBACK" then play() end end playFile= function(volume) return sendSoapMessage( -- control url SOAPACTION: "urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI" "/MediaRenderer/AVTransport/Control", -- service type "urn:schemas-upnp-org:service:AVTransport:1", -- action { name = "SetAVTransportURI", service = "urn:schemas-upnp-org:service:AVTransport:1" }, -- soap body data (options) "<InstanceID>0</InstanceID>,<CurrentURI>x-rincon-queue:"..uid.."#0</CurrentURI>,<CurrentURIMetaData></CurrentURIMetaData>", -- callback (options) function(response) -- retrieve current transport state getTransportState(); lastTransportState = currentTransportState; -- unmute before unMute(); -- retrieve volume getVolume(); lastVolume = currentVolume; -- set tts volume if <> with current if (volume ~= nil and volume ~= currentVolume) then setVolume(volume); ttsVolumeIsDifferent = true; end sseek(); play(); end); end -- function for call --[[ sdel(); -- remove last query sonos_list(1) --list_nbr = 1 -- playlist number on jffs system of SONOS, You need test it for find interesting list spotify_list("6he9MFK1bEvcA4dOBxxxxxx") -- "6he9MFK1bEvcA4dOByFJT3" playlist from spotify spotify_album('22j1vb0GvgRdJ1Axxxxxx') --22j1vb0GvgRdJ1AdbHtKXT album from spotify playFile(FileVol); -- play file with volume z głośnością pnext(); next track pprev(); previus track pause_play() -- swap play / pause, pause / play stop(); -- stop play(); -- play pause() Mute() unMute() sseek() -- seek getTransportState() --current status of sonos --]] sdel(); -- remove last query sonos_list(1) --list_nbr = 1 -- playlist number on jffs system of SONOS, You need test it for find interesting list spotify_list("6he9MFK1bEvcA4dOByFJT3") -- "6he9MFK1bEvcA4dOByFJT3" playlist from spotify spotify_album('22j1vb0GvgRdJ1AdbHtKXT') --22j1vb0GvgRdJ1AdbHtKXT album from spotify playFile(FileVol); -- play file with volume z głośnością pnext(); next track pprev(); previus track pause_play() -- swap play / pause, pause / play stop(); -- stop play(); -- play pause() Mute() unMute() sseek() -- seek getTransportState() --current status of sonos after last upgrade in all VD based on Jean-Christophe source is important to add port number 1400 in URL of sonos device (in my example is line 104)
×
×
  • Créer...