Skip to content

Instantly share code, notes, and snippets.

@tcalmant
Created August 27, 2022 11:28
Show Gist options
  • Save tcalmant/21a9f59c335f65ec026883ea847efe15 to your computer and use it in GitHub Desktop.
Save tcalmant/21a9f59c335f65ec026883ea847efe15 to your computer and use it in GitHub Desktop.
Jeedom custom template for an ESP Easy based 6-order pilot wire heating. To be placed in `jeedom/data/customTemplates/dashboard`
<div style="width:120px;min-height:35px;margin-top:10px" class="cmd #history# tooltips cmd-widget" data-type="info"
data-subtype="numeric" data-cmd_id="#id#" title="Valeur du #valueDate#, collectée le #collectDate#">
<center>
<span style="font-size: 1.2em;" class="label label-info" id="iconCmd#id#">N/A</span>
</center>
<script>
function updateText(cmdId, state) {
let iconId = "#iconCmd" + cmdId;
if (state < 11) {
$(iconId).text("Arrêt");
} else if (state < 21) {
$(iconId).text("Hors Gel");
} else if (state < 31) {
$(iconId).text("Éco");
} else if (state < 41) {
$(iconId).text("Confort-2°C");
} else if (state < 51) {
$(iconId).text("Confort-1°C");
} else {
$(iconId).text("Confort");
}
};
jeedom.cmd.update["#id#"] = function (_options) {
updateText("#id#", _options.display_value);
}
if (is_numeric('#state#')) {
jeedom.cmd.update['#id#']({ display_value: '#state#', valueDate: '#valueDate#', collectDate: '#collectDate#' })
} else {
$("#iconCmd#id#").html('<center><span class="label label-danger">#state#</span></center>');
}
</script>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment