Maybe try this.
function roundNumber(val, decPlaces)
if(decPlaces ~= nil and decPlaces > 0) then
return math.floor(((val * 10^decPlaces) + 0.5) / (10^decPlaces))
else
return math.floor(val + 0.5)
end
end
function convertTextInteger(val)
local n = tonumber(val)
if(n == nil) return ""
n = roundNumber(n, 0)
if(n < 0) then
return " - " .. math.abs(n)
return " + " .. n
end
local SONOS_ID = 144
local SONOS_SID = "urn:micasaverde-com:serviceId:Sonos1"
local SONOS_ZONES="Galerie"
local Temp0 = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 137)
local TempMin = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature", 138)
local TempMax1 = luup.variable_get("urn:upnp-micasaverde-com:serviceId:Weather1","Forecast.1.HighTemperature", 136)
local plug = luup.variable_get("urn:upnp-org:serviceId:SwitchPower1","Status", 15)
local volume = 60
if ((plug or "0") == "0") then
volume= 60
else
volume = 60
end
luup.call_action(SONOS_SID, "Say",
{Text= " Actuelleman, il fait, " .. convertTextInteger(Temp0) .. "degr?s , minimum se soir" .. convertTextInteger(TempMin) .." , Demain "
.. converTextInteger(TempMax1), Language="fr-CA", GroupZones=SONOS_ZONES,
Volume=volume, SameVolumeForAll="true"}, SONOS_ID)
I don't have anything to try it with but at least this is not comparing a number with a string. Also, I don't know the purpose of your volume but it was declared globally.