Page 1 sur 1

[RESOLU] Pb d'affichage on/off/etat

Publié : 23 juin 2019, 10:24
par Deepcore
Bonjour,

Aléatoirement selon les mises à jour, j'ai un problème d'affichage sur mon vituel et je cherche l'explication au problème.

J'ai créer un virtuel pour savoir l'état de toutes mes lumières, rien de compliqué : 1 état et 2 commandes on/off. Les 2 commandes sont liées à un widget custom et le tout organisé sous forme de tableau :

Code du widget, copie du core light :

Code : Tout sélectionner

<div style="width:90px;min-height:100%;" class="cmd tooltips cmd-widget cursor" data-type="action" data-subtype="other" data-cmd_id="#id#" data-cmd_uid="#uid#" data-version="#version#" data-eqLogic_id="#eqLogic_id#">
    <center>
        <div style="font-weight: bold;font-size : 12px;#hideCmdName#">#valueName#</div>
        <span style="font-size: 2.5em;font-weight: bold;margin-top: 5px;" class="iconCmd"></span>
    </center>
    <script>
        jeedom.cmd.update['#id#'] = function(_options){
            if (_options.display_value == '1' || _options.display_value == 1 || _options.display_value == '99' || _options.display_value == 99 || _options.display_value == 'on') {
                if (jeedom.cmd.normalizeName('#name#') == 'on') {
                    $('.cmd[data-cmd_id=#id#]').hide();
                }else{
                    $('.cmd[data-cmd_id=#id#]').show();
                    $('.cmd[data-cmd_id=#id#] .iconCmd').empty().append('<i class="icon jeedom-lumiere-on"></i>');
                }
            } else {
                if (jeedom.cmd.normalizeName('#name#') == 'off') {
                    $('.cmd[data-cmd_id=#id#]').hide();
                }else{
                    $('.cmd[data-cmd_id=#id#]').show();
                    $('.cmd[data-cmd_id=#id#] .iconCmd').empty().append('<i class="icon jeedom-lumiere-off"></i>');
                }
            }
        }
        jeedom.cmd.update['#id#']({display_value:'#state#'});
        $('.cmd[data-cmd_uid=#uid#] .iconCmd').off().on('click', function () {
            jeedom.cmd.execute({id: '#id#'});
        });
    </script>
</div>
Comme vous pouvez le voir sur le screen du virtuel les commandes on et off ne sont plus "fusionnées".

J'ai tout testé, même la bascule sur le widget core light ne change rien.

Quelqu'un a une explication ?

Re: Pb d'affichage on/off/etat

Publié : 23 juin 2019, 10:25
par Deepcore
Complément : config du tableau

Re: Pb d'affichage on/off/etat

Publié : 23 juin 2019, 10:30
par loic
Bonjour,
Renomme les on1/off1 on2/off2 en on 1/off 1 on 2/off 2 (l'espace en plus change tout et permet a jeedom de reconnaitre la commande on de la commande off)

Re: Pb d'affichage on/off/etat

Publié : 23 juin 2019, 12:16
par Deepcore
Si simple que ça ... je n'y avais pas pensé surtout que ça marchait aléatoirement.

Merci Loic :)

Re: [RESOLU] Pb d'affichage on/off/etat

Publié : 17 sept. 2019, 00:13
par yala37
Bonjour à Tous,

SVP j'ai le même problème depuis quelques temps mais avec mon virtuel "portail", les 2 icônes des commandes restent affichées au lieu de se supplanter en fonction de l'état du portail (0 pour fermé, 1 pour ouvert) :

Code : Tout sélectionner

<div style="width:90px;min-height:80px;" class="cmd tooltips cmd-widget cursor" data-type="action" data-subtype="other" data-cmd_id="#id#" data-cmd_uid="#uid#" data-version="#version#" data-eqLogic_id="#eqLogic_id#">
    <center>
        <div style="font-weight: bold;font-size : 12px;#hideCmdName#">#name#</div>
        <span style="font-size: 2.5em;font-weight: bold;margin-top: 5px;" class="iconCmd"></span>
    </center>
    <script>
        jeedom.cmd.update['#id#'] = function(_options){
            if (_options.display_value == '1' || _options.display_value == 1 || _options.display_value == '99' || _options.display_value == 99 || _options.display_value == 'on') {
                if (jeedom.cmd.normalizeName('#name#') == 'ouvrir') {
                    $('.cmd[data-cmd_id=#id#]').hide();
                }else{
                    $('.cmd[data-cmd_id=#id#]').show();
                    $('.cmd[data-cmd_id=#id#] .iconCmd').empty().append('<i class="icon jeedom-portail_ouvert"></i>');
                }
            } else {
                if (jeedom.cmd.normalizeName('#name#') == 'fermer') {
                    $('.cmd[data-cmd_id=#id#]').hide();
                }else{
                    $('.cmd[data-cmd_id=#id#]').show();
                    $('.cmd[data-cmd_id=#id#] .iconCmd').empty().append('<i class="icon jeedom-portail_ferme"></i>');
                }
            }
        }
        jeedom.cmd.update['#id#']({display_value:'#state#'});
        $('.cmd[data-cmd_uid=#uid#] .iconCmd').off().on('click', function () {
            jeedom.cmd.execute({id: '#id#'});
        });
    </script>
</div>
J'ai tenté la manip de modifier le nom de la commande mais ça ne change rien.

merci d'avance,

Yann