J'ai une prise commandé via ifttt, donc on/off généré par 2 requêtes http via IFTTT.
Je viens de trouver un widget "dashboard.action.other.PriseDeCourant " qui donne l'état par une couleur rouge ou verte, et je suppose une action en cliquant sur le widget.
Je me retrouve avec ce code, comment je dois le modifier ?
En gros, mes 2 requêtes via IFTTT sont du style [Salon][Prise][On] et [Salon][Prise][Off]
Merci !
Code : Tout sélectionner
<div style="width:100px;min-height:20px;" class="cmd #history# tooltips cmd-widget cursor" data-type="info" data-subtype="numeric" data-cmd_id="#id#">
<center>
<span class='cmdName' style="font-weight:bold;font-size:10px;">#valueName#</span>
<span style="font-size:2em; font-weight:bold; margin-top:2px; margin-botton:2px;" class="action" id="iconCmd#id#"></span>
</center>
<script>
if ('#state#' == '1' || '#state#' == 1) {
$('#iconCmd#id#').append('<img src="plugins/widget/core/template/dashboard/cmd.action.other.PriseDeCourant/PriseDeCourant_Circle_On.png" height="80px" />');
if ('#name#'.toLowerCase().indexOf('on')>=0 ) {
$('.cmd[data-cmd_id=#id#]').hide();
}
} else {
$('#iconCmd#id#').append('<img src="plugins/widget/core/template/dashboard/cmd.action.other.PriseDeCourant/PriseDeCourant_Circle_Off.png" height="80px"/>');
if ('#name#'.toLowerCase().indexOf('off')>=0 ) {
$('.cmd[data-cmd_id=#id#]').hide();
}
}
$('.cmd[data-cmd_id=#id#] .action').off();
$('.cmd[data-cmd_id=#id#] .action').on('click', function() {
jeedom.cmd.execute({id: '#id#'});
});
</script>
</div>