Skip to content

Commit

Permalink
Rename hide_state to show_state and name_state to state_header
Browse files Browse the repository at this point in the history
  • Loading branch information
benct committed Feb 14, 2020
1 parent 7593270 commit 0e0d907
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 28 deletions.
69 changes: 43 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ This card produces an `entity-row` and must therefore be configured as an entity
| unit | string | | Override entity `unit_of_measurement`
| icon | string | | Override entity `icon`
| toggle | bool | `false` | Display a toggle (if supported) instead of state
| hide_state | bool | `false` | Hide the entity state
| name_state | string | | Show name/header above the main entity state
| show_state | bool | `true` | Set to `false` to hide the entity state
| state_header | string | | Show header text above the main entity state
| state_color | bool | `false` | Enable colored icon when entity is active
| | | |
| entities | list | *see below* | Additional entity IDs or entity object(s)
Expand Down Expand Up @@ -80,7 +80,7 @@ If `toggle` is set to `true` the default action is toggle, otherwise it is `more

| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| action | string | **Required** | Action to perform (`more-info`, `toggle`, `call-service`)
| action | string | **Required** | Action to perform (`more-info`, `toggle` or `call-service`)
| service | string | | Service to call (e.g. `light.turn_on`) when `action` is `call-service`
| service_data | object | | Optional data to include when `action` is `call-service`

Expand Down Expand Up @@ -137,8 +137,8 @@ entities:
- entity: sensor.lovelace_multiple_entity_row
type: custom:multiple-entity-row
name: Attributes (hide_state)
hide_state: true
name: Attributes (show_state=false)
show_state: false
entities:
- attribute: stargazers
name: Stars
Expand All @@ -150,7 +150,7 @@ entities:
- type: section
- entity: sensor.bedroom_temperature
type: custom:multiple-entity-row
name: Hide names
name: Hide headers (name)
entities:
- entity: sensor.bedroom_min_temp
name: false
Expand All @@ -159,8 +159,8 @@ entities:
- entity: sensor.bedroom_temperature
type: custom:multiple-entity-row
name: Main state name
name_state: current
name: Main state header
state_header: current
entities:
- sensor.bedroom_min_temp
- sensor.bedroom_max_temp
Expand All @@ -179,7 +179,7 @@ entities:
- entity: switch.livingroom_tv
type: custom:multiple-entity-row
name: Multiple toggles
name_state: main
state_header: main
toggle: true
entities:
- entity: switch.livingroom_light
Expand All @@ -190,33 +190,50 @@ entities:
toggle: true
- type: section
- entity: sensor.bedroom_temperature
- entity: light.living_room
type: custom:multiple-entity-row
name: Customization
icon: mdi:fire
unit: °F
secondary_info: last-changed
name: Toggle with tap_action
state_header: Livingroom
toggle: false
tap_action:
action: toggle
entities:
- entity: sensor.bedroom_max_temp
name: custom name
unit: temp
- entity: light.nightstand
name: Bedroom
tap_action:
action: toggle
- type: section
- entity: sensor.living_room_temperature
- entity: light.living_room
type: custom:multiple-entity-row
name: Icons (service calls)
name: Icons with tap_action
secondary_info: last-changed
entities:
- entity: light.living_room
icon: mdi:palette
- icon: mdi:lightbulb-off-outline
service: light.turn_off
service_data:
entity_id: light.living_room
tap_action:
action: call-service
service: light.turn_off
service_data:
entity_id: light.living_room
- icon: mdi:lightbulb-outline
service: light.turn_on
service_data:
entity_id: light.living_room
tap_action:
action: call-service
service: light.turn_on
service_data:
entity_id: light.living_room
- type: section
- entity: sensor.bedroom_temperature
type: custom:multiple-entity-row
name: Customization
icon: mdi:fire
unit: °F
secondary_info: last-changed
entities:
- entity: sensor.bedroom_max_temp
name: custom name
unit: temp
```

## My cards
Expand Down
4 changes: 2 additions & 2 deletions multiple-entity-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
this.checkEntity(config.secondary_info);

this.lastChanged = config.secondary_info === 'last-changed';
this.stateHeader = config.name_state !== undefined ? config.name_state : null;
this.stateHeader = config.state_header !== undefined ? config.state_header : null;
this.onRowClick = () => this.fireEvent('hass-more-info', config.entity);
this.onStateClick = this.getAction(config.tap_action, config.entity);

Expand All @@ -140,7 +140,7 @@

stateObj: mainStateObj,
name: this.entityName(this._config.name, mainStateObj),
value: this._config.hide_state !== true ? this.entityStateValue(mainStateObj, this._config.unit) : null,
value: this._config.show_state !== false ? this.entityStateValue(mainStateObj, this._config.unit) : null,
toggle: this.checkToggle(this._config, mainStateObj),

entities: this._config.entities ? this._config.entities.map(entity => this.initEntity(entity, mainStateObj)) : [],
Expand Down

0 comments on commit 0e0d907

Please sign in to comment.