Aller au contenu
Ghoosti

Icones En Fonction D'une Variable

Recommended Posts

Bonjour,

Je viens de parcourir le topic et je n'ai pas vu (ou trouver) si cela était possible.

J'essaie de changer l'icone principal d'un VD en fonction du résultats de plusieurs variables.

J'ai ceci dans le main loop qui fonctionne MAIS pour 1 variable :angry:

--[[
%% autostart
%% properties
%% globals
--]]

local ID = fibaro:getSelfId()
local StatutECLCuisine = fibaro:getGlobal('StatutECLCuisine')
local StatutECLLivingTBL = fibaro:getGlobal('StatutECLLivingTBL')
local StatutECLLiving = fibaro:getGlobal('StatutECLLiving')
local StatutECLSalon = fibaro:getGlobal('StatutECLSalon')
local StatutECLTerrasse = fibaro:getGlobal('StatutECLTerrasse')


fibaro:call(ID,"setProperty","ui.Label1.value",StatutECLCuisine)
fibaro:call(ID,"setProperty","ui.Label2.value",StatutECLLivingTBL)
fibaro:call(ID,"setProperty","ui.Label3.value",StatutECLLiving)
fibaro:call(ID,"setProperty","ui.Label4.value",StatutECLSalon)
fibaro:call(ID,"setProperty","ui.Label5.value",StatutECLTerrasse)

-- ID des icones
local icoOFF = 1061
local icoON = 1062


if
	StatutECLCuisine == "OFF"
	then 
    fibaro:call(ID,"setProperty","currentIcon",icoOFF)
  	else
    fibaro:call(ID,"setProperty","currentIcon",icoON)
end

 Voici le VD en question, donc comment faire pour le second ? Living Table ?

J'essaye de ne pas passer par les boutons

image.png.78d1e9ec2d10dff47855127203d887e7.png

 

image.png.ed81f5ab4004cc8456d8f9e77052b69f.png

 

Merci ;)

 

image.png

Modifié par Ghoosti

Partager ce message


Lien à poster
Partager sur d’autres sites

hello je suppose que je ne comprends pas tout mais je suppose que tu as essayé :

if (StatutECLCuisine == "ON" or StatusLivTable = "ON" ) then

fibaro:call(ID,"setProperty","currentIcon",icoON)

else fibaro:call(ID,"setProperty","currentIcon",icoOFF) end

Ne faut il pas declarer les 2 variables dans %% Globals ?


 
Modifié par Lorenzo

Partager ce message


Lien à poster
Partager sur d’autres sites

Salut Lorenzo,

Oui c bien ce que j'essaye de faire

Ne faut il pas declarer les 2 variables dans %% Globals ?

Comme ceci ?

--[[
%% autostart
%% properties
%% globals
StatutECLCuisine
StatutECLSalon
--]]

MAIS rien ne change, les icônes ne changent pas   :15:

Partager ce message


Lien à poster
Partager sur d’autres sites

OK, ça fonctionne avec ceci

 

--[[
%% autostart
%% properties
%% globals
--]]

if Cuisine == "ON" or Salon == "ON"
	then fibaro:call(idVD,"setProperty","currentIcon",icoON)
	else fibaro:call(idVD,"setProperty","currentIcon",icoOFF)
end

Au final j'ai ceci et ça fonctionne, merci @Lorenzo

--[[
%% autostart
%% properties
%% globals
--]]

-- ID des icones
local icoOFF = 1061
local icoON = 1062

if Cuisine == "ON" 
  or LivingTable == "25" or LivingTable == "50" or LivingTable == "75" or LivingTable == "100"
  or Living == "25" or Living == "50" or Living == "75" 
  or Salon == "ON"
  or Terrasse == "ON"
	then fibaro:call(idVD,"setProperty","currentIcon",icoON)
	else fibaro:call(idVD,"setProperty","currentIcon",icoOFF)
end

 

Modifié par Ghoosti
MAJ

Partager ce message


Lien à poster
Partager sur d’autres sites

×