#.js Lovelace Coding question

1 messages · Page 1 of 1 (latest)

river tinsel
#

this is a snippet of some .js code that allows multiple Alexa timers to be displayed in Lovelace. We're trying to populate some sensors with the resulting timer info. Lovelace is tough.. I'm not seeing any errors anywhere, but when we add the stuff for the sensors, it won't load the card. How on earth do you debug this .js stuff in Lovelace???

#
     let table = "<table border='0' width='100%'>";
      for(let i = 0; i < this.alarms.length; i++) {
          let name = this.alarms[i].label;
          if(name === null) {
              name = getNameFromDuration(this.alarms[i].originalDurationInMillis);
          }
          let timeLeft = this.alarms[i].hours + ":" + addLeadingZero(this.alarms[i].minutes) + ":" + addLeadingZero(this.alarms[i].seconds);
          table += "<tr>";
          table += "<td>" + name + "</td>";
          table += "<td>" + timeLeft + "</td>";
          table += "</tr>";
//add populating the first 3 timers into HA entities
          if(i == 0) {
            this.hass.states[input_text.alexa_timer_0_name] = name;
            this.hass.states[input_number.alexa_timer_0_timeleft] = timeLeft;
            }
#

I figured a thread would be much easier.. HA channel is busy today!