Skip to content

getConfigForm example in documentation - simple editor for a custom cards #24100

Answered by Misiu
Misiu asked this question in Dashboard
Discussion options

You must be logged in to vote

I was able to create a simple card that uses this method. https://community.home-assistant.io/t/getconfigform-configure-editor-for-custom-card/845004

class ProgressBarCard extends HTMLElement {
  // Called whenever Home Assistant updates the state
  set hass(hass) {
    // Get the sensor state object
    const entityId = this.config.entity;
    const stateObj = hass.states[entityId];
    const newStateStr = stateObj ? stateObj.state : "unavailable";

    // If the state has not changed, do nothing.
    if (this._lastState === newStateStr) {
      return;
    }
    this._lastState = newStateStr;

    // Build the card DOM if it hasn't been built yet.
    if (!this.content) {

      this.in…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Misiu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant