dylandoamaral / uptime-card

Minimalistic uptime card for Home Assistant Lovelace UI
266 stars 11 forks source link

Uptime average is not showing when value is 0 #149

Closed h3llrais3r closed 1 year ago

h3llrais3r commented 1 year ago

When the uptime is 0, the average template is never rendered.

image

average_template: >-
  [[[
  let date = new Date(0);
  seconds = Math.trunc((configuration.hours_to_show * 3600) * variables.uptime / 100);
  date.setSeconds(seconds);
  return date.toISOString().substr(11, 8) + ' (' + variables.uptime.toFixed(2) + '%)';
  ]]]

Code indicates that it's only rendered when value > 0: image

dylandoamaral commented 1 year ago

Thanks it will be available for the next release.