Aller au contenu

Titof_44

Membres confirmés
  • Compteur de contenus

    131
  • Inscription

  • Dernière visite

Tout ce qui a été posté par Titof_44

  1. Merci à tous. @Steven essayé et adopté. Vraiment top. . Un grand merci !
  2. Bonjour, Qu'est ce que je fais de mal, je ne comprends pas pour quoi cela ne marche pas, la variable n'est pas crée donc le debug renvoie nil et les debug de http n'apparaissent pas ! Dans un VD avec les Net.FHttp je n'ai pas de problème ! Merci d'avance. function createGlobalIfNotExists(varName, defaultValue) if (fibaro:getGlobal(varName) == nil) then fibaro:debug("Création de la variable "..varName.." avec comme valeur par défaut "..defaultValue) newVar = {} newVar.name = varName newVar.isEnum = 0 newVar.value = defaultValue local http = net.HTTPClient() http:request("http://127.0.0.1:11111/api/globalVariables", { options = { method = 'POST', data = json.encode(newVar)}, success = function(response) fibaro:debug(varName .. " création avec succès") end, error = function(response) fibaro:debug(varName .. " ERROR !!!") end }) end fibaro:debug(varName .. " valeur "..fibaro:getGlobal(varName)) return true end
  3. L'API a du changée. Depuis hier j'ai une erreur sur dataObject.mainRouteName..libpeage pour la ligne Trace("green","...Tmp trajet : " .. tm.."min. Arrivée estimée : " .. arrTime.." Via : "..dataObject.mainRouteName..libpeage) [DEBUG] 09:57:48: [1;31m2017-10-19 09:57:48.745417 [ fatal] LUA error: /opt/fibaro/scenes/337.lua:224: attempt to concatenate field 'mainRouteName' (a function value) et je ne sais pas comment le régler, pour le moment j'ai juste mis en commentaire les appels à dataObject.mainRouteName..libpeage
  4. Ok pour moi aussi. Merci.
  5. Top, avec IFTTT on peut lancer une scène avec des paramètres en POST ! Un grand merci @MAM78, @Lazer, @Gazous sur le fil "HC2 - Version 4.11x - Fonction figaro:args()".
  6. Réactivité au top. Bon j'ai une "fausse" fibre (seul disponible chez moi) Bouygues 200Mo/10Mo, ça doit aider quand même. Je n'ai pas assez de recul pour le niveau sonore juste qu'avec un fond musical pas de problème. Ce que j'observe, c'est que j'utilise le même compte google gmail depuis bien longtemps et que ma WAF et les enfants l'utilisent (on me prend sans arrêt mon tél). La reconnaissance de leur voix a été directement opérationnelle ! Ca va plaire à beaucoup de personne même le WAF qui déteste tout ce petit monde a joué avec.(Pour combien de temps ?) . Un truc qu'il faudrait quand même c'est la possibilité de changer la paraphrase "OK google", on peut toujours rêver comme pour les plugins developper !
  7. J'ai cracké, geek que je suis, j'ai acheté Google home hier. Installer en 15 minutes. Quelques tests, impressionné ! Puis dans le dur avec la HC2 : J'ai suivi ce tuto http://domotique-home.fr/decouverte-de-google-home-avec-fibaro-et-jeedom/ juste à la fin je lance des scénes au lieu des clicks bouton sur VD. C'est top !!! La triplète google Home IFTTT HC2, une tuerie exemple pour la musique et les playlist enregistrés diffusé sur Sonos ou autres,... . (Tester aussi ok google Home IFTTT Harmony pour lancer les activités) J'ai plus qu'à faire travailler mon imagination... Dommage pour Alexa, pas en français et cela fait trop longtemps que je l'attendais.
  8. @chris6783 vu les postes sur jeedom ca me donne vraiment pas envie et franchement je m'eclate avec mes hc2.
  9. MAJ OK. @Yannick pour moi je n'avais plus accès à la HC2 au bout d'une vingtaine d'heure (depuis la 4.131), là ça fait 3 jours sans soucis. Pour moi c'est une version Top.
  10. @jackd67000, là, ça donne envie ... Tu peux donner quelques explications. (Actuellement j'ai mon compte IFTTT avec le service Harmony activé.)
  11. Mise à jour Ok.
  12. Merci pour la MAJ.
  13. Depuis jeudi dernier, la scène ne fonctionne plus : le serveur waze renvoie une erreur 403. Avez-vous le soucis ?
  14. Titof_44

    Plugin Netatmo

    J'en ai ajouté un, il y a quelques semaines, après l'avoir ajouté à la station via netatmo, sur la HC2 et sur le plugin en recliquant sur getdevices, aucun problème, il est bien apparu.
  15. Titof_44

    Plugin Netatmo

    Voilà une autre scène pour lire les données du thermostat, je l'ai faites rapidement pour que tu puisse jouer avec. Elle ne renseigne que la température mais tu peux l'améliorer à ta guise et renvoyer les données collectées à un VD par exemple. --[[ %% properties %% globals %% killOtherInstances --]] local idg=json.decode((fibaro:getGlobal('idTable'))) local client_id = 'xxxxxxxxxxxxxxxxxxxxxxxx' local client_secret = 'xxxxxxxxxxxxxxxxxxxxxx' local username = 'xxxxxxxxxxxxx' local password = 'xxxxx' --local homeId = 'xxxxxxxxxxxxxxxxxxxxxx' -- homeId trouver sur site : https://my.netatmo.com/app/camera -- a droite profil puis survol maison regarder sur barre chrome local relay_idDefault="xx:xx:xx:xx:xx:xx" --Relay -- Relay trouvé sur site : https://my.netatmo.com/app/energy -- Il suffit de remplacer le g par 70:ee:50. --Par example g002460 a pour adresse MAC 70:ee:50:00:24:60 local device_idDefault="xx:xx:xx:xx:xx:xx" --Thermostat -- Thermostat trouvé sur site : https://dev.netatmo.com/resources/technical/reference/thermostat/getthermostatsdata -- try it et dans le resultat aller à body devices _id modules _id local debug = 1 local token = '' local request_body = '' Debug = function ( color, message ) if (debug == 1) then fibaro:debug(string.format('<%s style="color:%s;">%s', "span", color, message, "span")) elseif (debug == 0) then end end DebugChange = function ( color, message ) fibaro:debug(string.format('<%s style="color:%s;">%s', "span", color, message, "span")) end DebugError = function ( color, message ) fibaro:debug(string.format('<%s style="color:%s;">%s', "span", color, message, "span")) end local sourceTrigger = fibaro:getSourceTrigger(); function oAuth(nextFunction) local request_body = 'grant_type=password&client_id=' .. client_id .. '&client_secret=' .. client_secret .. '&username=' .. username .. '&password=' .. password .. '&scope=read_thermostat' getResponseData('https://api.netatmo.net/oauth2/token', request_body, function(data) if (data.access_token ~= nil) then token = data.access_token getDatas() else DebugError( "red", "oAuth-API-Call n'a donné aucune valeur de retour"); end end ) end function getResponseData(url, body, func) local http = net.HTTPClient() http:request(url, { options = { method = 'POST', headers = { ['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' }, data = body }, success = function(response) func(json.decode(response.data)) end }) end function getDatas() DebugChange( "green", "Get Datas") request_body = 'access_token=' ..token.. '&device_id='..relay_id getResponseData('https://api.netatmo.net/api/getthermostatsdata', request_body, function(getData) Debug( "white", 'Status checking') if (getData.body ~= nil) then tDevices=getData.body.devices for w, relays in pairs(tDevices) do Debug( "white", 'Id Relay : '..relays._id) if relays._id==relay_id then for a, devices in pairs(relays.modules) do Debug( "white", 'Id Thermostat : '..devices._id) if devices._id==device_id then --pour les autres datas voir -- https://dev.netatmo.com/en-US/resources/technical/reference/thermostat/getthermostatsdata curtemp=devices.measured.temperature Debug( "white", 'Temperature courante : '..curtemp) end end end end end end ) end --recupération des arguments local params = fibaro:args() if (params) then for k, v in ipairs(params) do if (v.relay_id) then relay_id = v.relay_id end if (v.device_id) then device_id = v.device_id end end end if relay_id==nil then relay_id=relay_idDefault end --Required mac address of the relay if device_id==nil then device_id=device_idDefault end --Required mac address of the thermostat DebugChange( "green", "device_id : "..device_id) oAuth()
  16. Titof_44

    Plugin Netatmo

    Pour récupérer les valeurs du thermostat, j'ai gardé le plugin pour lire ses valeurs : (attention au polling du thermostat) exemple : bModeAway=fibaro:getValue(idg["THERMOSTATNETATMO"], "ui.Away_Switch.value") --idg["THERMOSTATNETATMO"]=id du vd thermostat du plugin si bModeAway="1" alors on est en mode absence je pense que pour le t° c'est tempcur=fibaro:getValue(idg["THERMOSTATNETATMO"], "ui.Current__Temperature_Value_Label.caption") pour connaitre toutes les propriétés du plugin thermostat : http://IP/docs/#!/devices/getDevice sinon la scène est que pour écrire &scope=write_thermostat et pas lire &scope=read_thermostat
  17. Titof_44

    Plugin Netatmo

    pour cette scène je me suis inspiré de la scène présence de la welcome de boomx normalement il n'i a plus de variable de welcome sauf en commentaire. Pour ma part la welcome marche du tonnerre avec la reconnaissance des personnes (idéal pour des message personnalisé : arrivée, anniversaire, ...) et le flux video.
  18. Bizarre, les derniers avis sur le vendeur date de 2012 et aucun avis sur les 6 derniers mois ! Aussi les fgk-101 Zw5 sont à 19,20 du même vendeur. Bizarre !
  19. Titof_44

    Plugin Netatmo

    oui cela fait la même chose que ton script mais sans php et web server , sans vd et sans plugin et sans jeedom. la scène est autonome. exemple d'utilisation : sur une plage de confort, le week end par exemple et si on part de l'habitation et qu'il n' y plus personne j'utilise cette scène pour passer en mode absence (17°). des qu'on arrive je repasse en confort.
  20. Titof_44

    Plugin Netatmo

    cette scène est indépendante du plugin. un autre exemple : pour repasser en mode programmation standard : fibaro:startScene(idg["SCN_SETTHERMOSTAT"],{ {setpoint_mode="program"} }) et c'est tout Les possibilités sont détaillées dans la scène. Il faut évidement mettre les bons paramètres au début de la scène
  21. Titof_44

    Plugin Netatmo

    @Sakkhho et @sebcbien, merci pour vos réponses. Comme j'aime bien mon thermostat et ma HC2 et que mon besoin est de jouer avec le thermostat sur des actions précises, je vais garder le plugin et je poste ici une petite scène pour gérer le thermostat : Utilisation : fibaro:startScene(idg["SCN_SETTHERMOSTAT"],{ {setpoint_mode="away"} }) --exemple pour le mode absent. (idg["SCN_SETTHERMOSTAT"]= id de la scène) Vu que je n'ai qu'un thermostat je ne passe pas le device_id et module_id car ils sont mis par défaut dans la scène sinon il faudrait les passer en paramètres. Code de la scène SCN_SETTHERMOSTAT : --[[ %% properties %% globals %% killOtherInstances --]] local idg=json.decode((fibaro:getGlobal('idTable'))) --ids de mes modules local client_id = 'XXXXXXXXXXXXXXXXXXXX' local client_secret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' local username = 'xxxxxxxxxxxxxxx' local password = 'xxxxxxxxxxxxxxxxxxxxx' --local homeId = 'xxxxxxxxxxxxxxxxxxxxxxx' -- homeId trouver sur site : https://my.netatmo.com/app/camera -- a droite profil puis survol maison regarder sur barre chrome local device_idDefault="xx:xx:xx:xx:xx:xx" --Relay -- Relay trouvé sur site : https://my.netatmo.com/app/energy -- Il suffit de remplacer le g par 70:ee:50. --Par example g002460 a pour adresse MAC 70:ee:50:00:24:60 local module_idDefault="xx:xx:xx:xx:xx:xx" --Thermostat -- Thermostat trouvé sur site : https://dev.netatmo.com/resources/technical/reference/thermostat/getthermostatsdata -- try it et dans le resultat aller à body devices _id modules _id local debug = 1 local token = '' local request_body = '' Debug = function ( color, message ) if (debug == 1) then fibaro:debug(string.format('<%s style="color:%s;">%s', "span", color, message, "span")) elseif (debug == 0) then end end DebugChange = function ( color, message ) fibaro:debug(string.format('<%s style="color:%s;">%s', "span", color, message, "span")) end DebugError = function ( color, message ) fibaro:debug(string.format('<%s style="color:%s;">%s', "span", color, message, "span")) end local sourceTrigger = fibaro:getSourceTrigger(); function oAuth(nextFunction) local request_body = 'grant_type=password&client_id=' .. client_id .. '&client_secret=' .. client_secret .. '&username=' .. username .. '&password=' .. password .. '&scope=write_thermostat' getResponseData('https://api.netatmo.net/oauth2/token', request_body, function(data) if (data.access_token ~= nil) then token = data.access_token SetAction() else DebugError( "red", "oAuth-API-Call n'a donné aucune valeur de retour"); end end ) end function getResponseData(url, body, func) local http = net.HTTPClient() http:request(url, { options = { method = 'POST', headers = { ['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' }, data = body }, success = function(response) func(json.decode(response.data)) end }) end function SetAction() DebugChange( "green", "Action : "..setpoint_mode) request_body_cam = 'access_token=' ..token.. '&device_id='..device_id ..'&module_id='..module_id ..'&setpoint_mode='..setpoint_mode --Not Required if setpoint_endtime~=nil then request_body_cam =request_body_cam ..'&setpoint_endtime='..setpoint_endtime end if setpoint_temp~=nil then request_body_cam =request_body_cam ..'&setpoint_temp='..setpoint_temp end getResponseData('https://api.netatmo.net/api/setthermpoint', request_body_cam, function(getData) end ) end --recupération des arguments local params = fibaro:args() if (params) then for k, v in ipairs(params) do if (v.device_id) then device_id = v.device_id end if (v.module_id) then module_id = v.module_id end if (v.setpoint_mode) then setpoint_mode = v.setpoint_mode end if (v.setpoint_endtime) then setpoint_endtime = v.setpoint_endtime end if (v.setpoint_temp) then setpoint_temp = v.setpoint_temp end end end if setpoint_mode==nil then fibaro:debug("Abort") fibaro:abort() end if device_id==nil then device_id=device_idDefault end --Required mac address of the relay if module_id==nil then module_id=module_idDefault end --Required mac address of the thermostat --setpoint_mode --Required --program : Currently following a weekly schedule --away : Currently applying the "away" temperature as defined by the user --hg : Frost-guard --manual : Currently applying a manually set temperature setpoint --off : Currently off --max : eating continuously --setpoint_endtime --Not Required --If setpoint_mode is max or manual, defines the validity period of the setpoint. Default is null. --setpoint_temp --Not Required --If setpoint_mode is manual, returns the temperature setpoint in °C. DebugChange( "green", "device_id : "..device_id) DebugChange( "green", "module_id : "..module_id) DebugChange( "green", "setpoint_mode : "..setpoint_mode) oAuth()
  22. Titof_44

    Plugin Netatmo

    Avec le thermostat, Comment faire pour effectuer les actions du plugin en code LUA (pour une gestion de fenêtres ouvertes). J'ai bien vu turnOff, turnOn, setVolume, ... J'aurais aimé passé en mode absence ou hors gel, voir modifier la t° courante par LUA. J'ai fait plein de test mais rien. . Quelqu'un a réussi sans passer par le VD de Steven ?
  23. C'est Page 40 Moi j'ai fait un bouton par playlist dédié dans le VD de Krikroff. Pour mon besoin je reset la Liste à chaque changement de playList en fin de code. Voici le code du bouton Juste à changer : list_nbr = 6 -- playlist number on jffs system of SONOS, You need test it for find interesting list, (j'ai fait au pif en incrémentant de 1 à chaque essai, je pense que j'avais mis les radios avant c'est pour cela que je suis à 6 pour la première liste) uid = "RINCON_B8EXXXXXXXXXX1400" -- find by http://SONOS_IP:1400/status/upnp : clicker Incoming Subscriptions et copier coller l'uid. -- SONOS Play playlist, v.0.1 ------------------------------------------------------------------------------------------- ---made on source of:----------------------------------------------------------------------- -- SONOS Play stream... -- Copyright © 2014 Jean-Christophe Vermandé ------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------- ---------------------------------- -- User Settings ---------------------------------- selfId = fibaro:getSelfId(); ip = fibaro:get(selfId, 'IPAddress'); port = fibaro:get(selfId, 'TCPPort') or 1400; list_name = "Sonos Playlist Vanessa" --not implemented list_nbr = 6 -- playlist number on jffs system of SONOS, You need test it for find interesting list uid = "RINCON_B8EXXXXXXXXXX1400" -- find by http://SONOS_IP:1400/status/upnp FileVol = 40 PlayUnlimited = "Yes" -- si <> Yes, arrêt après 30s environ --duration = ---------------------------------- -- DO not change bellow this line ---------------------------------- currentTransportState = ""; lastTransportState = ""; currentVolume = 0; lastVolume = 0; ttsVolumeIsDifferent = false; 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 clear_last_que = function() -- without this album is added after play song/query 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 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 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 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) if (duration ~= nil) then fibaro:debug("play sent for " .. duration .. " seconds"); fibaro:sleep(duration); stop(); else fibaro:debug("play sent"); local n = 0; currentTransportState = "TRANSITIONING"; while (currentTransportState == "TRANSITIONING") do if (n > 10) then break end; getTransportState(); fibaro:debug(currentTransportState); fibaro:sleep(5000); n = n + 1; end local i = 0; currentTransportState = "PLAYING"; while (currentTransportState == "PLAYING") do if (i > 10 and PlayUnlimited ~= "Yes") then break end; getTransportState(); fibaro:debug(currentTransportState); fibaro:sleep(2000); i = i + 1; end fibaro:sleep(1000); stop(); end -- update volume with value before tts if different if (ttsVolumeIsDifferent == true) then setVolume(lastVolume); ttsVolumeIsDifferent = false; end 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 que = function() 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>&lt;DIDL-Lite xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot; xmlns:r=&quot;urn:schemas-rinconnetworks-com:metadata-1-0/&quot; xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot;&gt;&lt;item id=&quot;SQ:1&quot; parentID=&quot;SQ:&quot; restricted=&quot;true&quot;&gt;&lt;dc:title&gt;".. list_name .."&lt;/dc:title&gt;&lt;upnp:class&gt;object.container.playlistContainer&lt;/upnp:class&gt;&lt;desc id=&quot;cdudn&quot; nameSpace=&quot;urn:schemas-rinconnetworks-com:metadata-1-0/&quot;&gt;RINCON_AssociatedZPUDN&lt;/desc&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</EnqueuedURIMetaData>,<DesiredFirstTrackNumberEnqueued>1</DesiredFirstTrackNumberEnqueued>,<EnqueueAsNext>1</EnqueueAsNext>", -- callback (options) function(response) fibaro:debug("que"); 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 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>", -- zestawienie playlist -- control url --"/MediaServer/ContentDirectory/Control", -- service type --"urn:schemas-upnp-org:service:ContentDirectory:1", -- action --{ name = "Browse", service = "urn:schemas-upnp-org:service:ContentDirectory:1" }, -- soap body data (options) --"<ObjectID>Q:0</ObjectID>,<BrowseFlag>BrowseDirectChildren</BrowseFlag>,<Filter>dc:title,res,dc:creator,upnp:artist,upnp:album,upnp:albumArtURI</Filter>,<StartingIndex>0</StartingIndex>,<RequestedCount>100</RequestedCount>,<SortCriteria></SortCriteria></u:Browse>", -- 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 clear_last_que(); que(); -- en paramètres: le fichier, puis le volume... playFile(FileVol);
  24. Super @drboss pour lire les PlayLists. Ca marche au top et merci évidement à @Krikroff. J'ai créé des boutons supplémentaires dans le VD V1. On avait les radios et maintenant les PlayLists.
  25. J'utilise cela comme code pour tous les 6 boutons dans une scène. Je n'ai pas encore activé les double et triple click des paramètres 21 à 26. --[[ %% properties %% globals %% events 563 CentralSceneEvent 1 563 CentralSceneEvent 2 563 CentralSceneEvent 3 563 CentralSceneEvent 4 563 CentralSceneEvent 5 563 CentralSceneEvent 6 %% killOtherInstances --]] function actions(button,action) if button=="1" then if action=="Pressed" then fibaro:debug("Appui Carre Simple") elseif action=="HeldDown" then fibaro:debug("Appui Carre long") elseif action=="Released" then fibaro:debug("Appui Carre relache") end elseif button=="2" then if action=="Pressed" then fibaro:debug("Appui rond Simple") elseif action=="HeldDown" then fibaro:debug("Appui rong long") elseif action=="Released" then fibaro:debug("Appui rond relache") end elseif button=="3" then if action=="Pressed" then fibaro:debug("Appui Croix Simple") elseif action=="HeldDown" then fibaro:debug("Appui Croix long") elseif action=="Released" then fibaro:debug("Appui Croix relache") end elseif button=="4" then if action=="Pressed" then fibaro:debug("Appui triangle Simple") elseif action=="HeldDown" then fibaro:debug("Appui triangle long") elseif action=="Released" then fibaro:debug("Appui triangle relache") end elseif button=="5" then if action=="Pressed" then fibaro:debug("Appui Moins Simple") elseif action=="HeldDown" then fibaro:debug("Appui Moins long") elseif action=="Released" then fibaro:debug("Appui Moins relache") end elseif button=="6" then if action=="Pressed" then fibaro:debug("Appui Plus Simple") elseif action=="HeldDown" then fibaro:debug("Appui Plus long") elseif action=="Released" then fibaro:debug("Appui Plus relache") end end end local trigger = fibaro:getSourceTrigger() local action = "" local button = "" fibaro:debug("Source : "..trigger["type"]) if (trigger["type"] == "other") then action="" else local pressSource = fibaro:getSourceTrigger() button = tostring(pressSource.event.data.keyId) action = pressSource.event.data.keyAttribute end if action ~= "" then fibaro:debug("button : "..button.." / Action : "..action) actions(button,action) end
×
×
  • Créer...