diff --git a/README.md b/README.md index fca2303..a755533 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ This card is intended to display connections between entities with numeric state | wide | boolean | **Optional** | false | Set this to true if you see extra empty space in the right side of the card. This will expand it horizontally to cover all the available space. Enable if you see empty space on the right size. | show_icons | boolean | **Optional** | false | Display entity icons | show_names | boolean | **Optional** | false | Display entity names +| show_states | boolean | **Optional** | true | Display entity states | min_box_height | number | **Optional** | 3 | Minimum size of an entity box | min_box_distance | number | **Optional** | 5 | Minimum space between entity boxes @@ -43,6 +44,10 @@ This card is intended to display connections between entities with numeric state | children | list | **Required** | | List of entity ids describing child entities (branches). Only entities from the next section will be connected. | name | string | **Optional** | entity name from HA | Custom label for this entity | color | string | **Optional** | var(--primary-color)| Color of the box +| color_on_state | boolean | **Optional** | false | Color the box based on state value +| color_limit | string | **Optional** | 1 | State value for coloring the box based on state value +| color_above | string | **Optional** | var(--paper-item-icon-color)| Color for state value above color_limit +| color_below | string | **Optional** | var(--primary-color)| Color for state value below color_limit | remaining | [object](#remaining-object) | **Optional** | | This configures wheter to display a box for the remaining state if the sum of entity states from children is less than this entity's state. ### Remaining object diff --git a/src/ha-sankey-chart.ts b/src/ha-sankey-chart.ts index 52f551e..d9a9e1e 100644 --- a/src/ha-sankey-chart.ts +++ b/src/ha-sankey-chart.ts @@ -59,7 +59,7 @@ export class SankeyChart extends LitElement { // https://lit.dev/docs/components/properties/ @property({ attribute: false }) public hass!: HomeAssistant; @property({ attribute: false }) private entities: string[] = []; - + @state() private config!: Config; @state() public height = 200; @state() private sections: SectionState[] = []; @@ -81,6 +81,7 @@ export class SankeyChart extends LitElement { round: 0, min_box_height: 3, min_box_distance: 5, + show_states: true, ...config, }; @@ -152,11 +153,11 @@ export class SankeyChart extends LitElement { } protected renderSection(index: number): TemplateResult { - const {show_names, show_icons} = this.config; + const {show_names, show_icons, show_states} = this.config; const section = this.sections[index]; const {boxes, spacerH} = section; const hasChildren = index < this.sections.length - 1 && boxes.some(b => b.children.length > 0); - + return html`