Bon finalement j'ai abandonné le sujet... car j'ai fait l'acquisition d'une HC2 !
Une bonne affaire sur Ebay (en fait c'était un coup de poker )
J'ai pu importer un VD pour un ampli Yamaha et là je peux faire tout ce que je veux !
Par contre je me lance sur un autre sujet: SONOS
J'ai effectivement des SONOS dans un peu près toutes les pièces de la maison et je voudrais faire du TTS. J'ai importé le VD SONOS de Krikroff qui fonctionne à merveille mais je n'arrive pas à lui faire annoncer la date du jour, la température extérieure et la météo qui est noté en example...
-- 239 is the Virtual Device ID
-- 28 is the Process button ID
local sid, bid = 239, 28
local cond = fibaro:getValue(3, "WeatherConditionConverted");
local tempext = fibaro:getValue(33, "value"); -- température extérieure
fibaro:debug ("Température extérieure : "..tempext)
local degre = string.gsub(tempext, '[,]' , ' degré ')
local degre = string.gsub(degre, '[.]' , ' degré ')
local degre = string.gsub(degre, '[-]' , ' moins ')
local currentDate = os.date("*t")
local jourL = {"Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"}
local jour = jourL[currentDate.wday]
fibaro:debug ("Jour : "..jour)
local moisL = {"janvier", "février", "mars", "avril", "mai", "juin",
"juillet", "aout", "septembre", "octobre", "novembre", "décembre"}
local mois = moisL[currentDate.month]
fibaro:debug ("Mois : "..mois)
local condfr ="";
if( cond == "clear" ) then condfr = "clair"; end
if( cond == "cloudy" ) then condfr = "nuageux"; end
if( cond == "rain" ) then condfr = "pluvieux"; end
if( cond == "snow" ) then condfr = "neigeux"; end
if( cond == "storm" ) then condfr = "tempete"; end
if( cond == "fog" ) then condfr = "brouillard"; end
fibaro:debug ("Conditions météorologiques : "..condfr)
fibaro:debug ("Création du TTS")
-- Create TTS params object
local params = {
-- TTS Message
message = "Bonjour a vous. Nous sommes le "..jour .." "..currentDate.day .." "..mois ..
". Il est ".. currentDate.hour .." heure et ".. currentDate.min .." minutes. "..
"Le thermomètre extérieur est a "..degre ..
", et le temps est "..condfr ..". ",
duration = 'auto', -- Duration: "auto", xx seconds
language = "fr-FR", -- Language: fr-FR
volume = 40 -- Volume
}
local _f = fibaro
local _x ={root="x_sonos_object",load=function(b)local c=_f:getGlobalValue(b.root)if string.len(c)>0 then local d=json.decode(c)if d and type(d)=="table"then return d else _f:debug("Unable to process data, check variable")end else _f:debug("No data found!")end end,set=function(b,e,d)local f=b:load()if f[e]then for g,h in pairs(d)do f[e][g]=h end else f[e]=d end;_f:setGlobal(b.root,json.encode(f))end,get=function(b,e)local f=b:load()if f and type(f)=="table"then for g,h in pairs(f)do if tostring(g)==tostring(e or"")then return h end end end;return nil end}
-- Make a request to the remote to process params object instantly
_x:set(tostring(sid), { tts = params })
_f:call(sid, "pressButton", bid)
J'ai ce message d'erreur :
[DEBUG] 15:50:45: line7: attempt to concatenate local 'tempext' (a nil value)
[DEBUG] 15:50:45: line 7: attempt to concatenate local 'tempext' (a nil value)
Quelqu'un a une idée ?