Page 1 sur 2

changer icone via json

Publié : 01 déc. 2016, 12:02
par jackslayter
bonjour, je voudrais savoir si l'un d'entre vous a déjà changé l'icone d'un device par une autre via le json comme on le ferait pour une valeur?
merci

Re: changer icone via json

Publié : 01 déc. 2016, 20:00
par patrice
Bonsoir
tu crois que c'est possible ?, rien dans le wiki ne laisse penser

Re: changer icone via json

Publié : 01 déc. 2016, 20:25
par jackslayter

Re: changer icone via json

Publié : 01 déc. 2016, 21:19
par patrice
Ah oui en effet on doit pouvoir chipoter avec ça dans un custom sensor

Code : Tout sélectionner

       
        if moonPhase=="Waning Crescent" then 
            moonPhaseIdx = 8
            moonPhaseIcon = 110
            moonPhase = "Afnemende halve maan" 
        end
        -- Because there is no api command available to set a custom icon a JSON call is made 
        -- This requires the following parameters:
        -- type = setused (not to be changed)
        -- idx = idxmoonphaseicon (not to be changed here)
        -- name = Maanfase (This is the Name of the control. You need to pass this value. This name will be displayd in the Domoticz GUI.
        -- description = (left empty: no need for a description in the Domoticz GUI)
        -- switchtype = 0 (not to be changed)
        -- customimage = moonPhaseIcon (not to be changed here)
        -- devoptions = 1;%20 (This is the 'axis-label'. Because only a number is sent a space (%20) is given as axis-label, resulting in no axis-label in Domoticz GUI (not to be changed)
        -- used = true (not to be changed)
        os.execute('curl -s -i -H "Accept: application/json" "http://"'..DOMO_IP..'":"'..DOMO_PORT..'"/json.htm?type=setused&idx="'..idxmoonphaseicon..'"&name=Maanfase&description=&switchtype=0&customimage="'..moonPhaseIcon..'"&devoptions=1;%20&used=true"')
        print("Phase:\t"..moonPhase)
Qq à joué avec parce que je teste sans trop de réussite !

ah oui et puis il y a cette phrase
8 custom icon sets (http://domoticz-icon.aurelien-loyer.fr/) for the moonphase icons
-- note: Only the first (or 'on') icon of a custom iconset is used, so you need 8 different sets of custom icons
-- The icons are referenced by their internal number.
dont je ne comprends pas l'histoire du internal number,je comprends bien qu'il faut faire 8 jeux d'icones mais ou trouve t'on le "internal number"

Re: changer icone via json

Publié : 02 déc. 2016, 13:38
par higgins91
je suis intéressé pour indiquer la couleur tempo de mon abonnement EDF !

Re: changer icone via json

Publié : 02 déc. 2016, 14:05
par jackslayter
higgins91 a écrit :je suis intéressé pour indiquer la couleur tempo de mon abonnement EDF !
si tu n'utilise pas le capteur "Alert" tu peux modifier les images pour mettre celle que tu veux

ou alors si c'est que 2 couleurs tu ajoutes une icône on/off avec le on en bleu et le off en blanc

Re: changer icone via json

Publié : 02 déc. 2016, 20:20
par higgins91
Je ne veux pas polluer ce topic, j'ai un dumy text dans lequel je place la couleur du jour, je vais regarder pour changer l'icone du coup ! Merci

Re: changer icone via json

Publié : 03 déc. 2016, 11:10
par higgins91
après quelques recherches je ne trouve pas, pas mal de post concernent les icônes d'interrupteur mais hélas pas les capteurs virtuel texte... :|
Je suis preneur d'un tuto si il y en a un !
merci

Re: changer icone via json

Publié : 03 déc. 2016, 11:56
par jackslayter
il y a 3 couleurs je crois ?
si oui et si tu n'utilise pas le capteur "Alert" tu peux modifier les images pour mettre celle que tu veux (bleu blanc et rouge) dans ../domoticz/www/image/alert48_1....

Re: changer icone via json

Publié : 03 déc. 2016, 11:57
par vil1driver
Commme dit plus haut essai plutot avec le widget Alert