INNER CODE UNIT · JavaScript

getConfigElement

ruudmens/LazyAdmin · Home Assistant/custom weather card/weather-card.js:100

  static async getConfigElement() {
    await import("./weather-card-editor.js");
    return document.createElement("weather-card-editor");
  }

  static getStubConfig(hass, unusedEntities, allEntities) {
    let entity = unusedEntities.find((eid) => eid.split(".")[0] === "weather");
    if (!entity) {
      entity = allEntities.find((eid) => eid.split(".")[0] === "weather");
    }
    return { entity };
  }

  setConfig(config) {
    if (!config.entity) {
      throw new Error("Please define a weather entity");
    }
    this._config = config;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…