forked from DigiLive/mushroom-strategy
Merge pull request #43 from AalianKhan/lock-card
Fix lock icon by adding lock domain and default domain bug
This commit is contained in:
18
README.md
18
README.md
@@ -275,6 +275,7 @@ The following domains are supported and enabled by default:
|
||||
* cover
|
||||
* switch
|
||||
* camera
|
||||
* lock
|
||||
* climate
|
||||
* media_player
|
||||
* sensor
|
||||
@@ -290,6 +291,23 @@ For these domains, the following options are supported:
|
||||
| `hidden` | boolean | Set to `true` to exclude the view from the dashboard. |
|
||||
| `order` | number | Ordering position of the domain entities in a view. |
|
||||
|
||||
#### Example
|
||||
|
||||
```YAML
|
||||
strategy:
|
||||
type: custom:mushroom-strategy
|
||||
options:
|
||||
domains:
|
||||
lights:
|
||||
title: "My cool lights"
|
||||
order: 1
|
||||
switch:
|
||||
showControls: false
|
||||
default:
|
||||
hidden: true
|
||||
views: [ ]
|
||||
```
|
||||
|
||||
### Chips
|
||||
|
||||

|
||||
|
2
dist/mushroom-strategy.js
vendored
2
dist/mushroom-strategy.js
vendored
File diff suppressed because one or more lines are too long
39
src/cards/LockCard.js
Normal file
39
src/cards/LockCard.js
Normal file
@@ -0,0 +1,39 @@
|
||||
import {AbstractCard} from "./AbstractCard";
|
||||
|
||||
/**
|
||||
* Lock Card Class
|
||||
*
|
||||
* Used to create a card for controlling an entity of the lock domain.
|
||||
*
|
||||
* @class
|
||||
* @extends AbstractCard
|
||||
*/
|
||||
class LockCard extends AbstractCard {
|
||||
/**
|
||||
* Default options of the card.
|
||||
*
|
||||
* @type {lockCardOptions}
|
||||
* @private
|
||||
*/
|
||||
#defaultOptions = {
|
||||
type: "custom:mushroom-lock-card",
|
||||
icon: undefined,
|
||||
};
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*
|
||||
* @param {hassEntity} entity The hass entity to create a card for.
|
||||
* @param {lockCardOptions} [options={}] Options for the card.
|
||||
* @throws {Error} If the Helper module isn't initialized.
|
||||
*/
|
||||
constructor(entity, options = {}) {
|
||||
super(entity);
|
||||
this.mergeOptions(
|
||||
this.#defaultOptions,
|
||||
options,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export {LockCard};
|
@@ -17,6 +17,7 @@ class MediaPlayerCard extends AbstractCard {
|
||||
*/
|
||||
#defaultOptions = {
|
||||
type: "custom:mushroom-media-player-card",
|
||||
icon: undefined,
|
||||
use_media_info: true,
|
||||
media_controls: [
|
||||
"on_off",
|
||||
|
@@ -55,6 +55,11 @@
|
||||
* @memberOf typedefs.cards
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {abstractOptions & Object} lockCardOptions Lock Card options.
|
||||
* @memberOf typedefs.cards
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {abstractOptions & Object} switchCardOptions Switch Card options.
|
||||
* @property {{tap_action: switchTapAction}} [action] Home assistant action to perform on tap.
|
||||
|
@@ -188,6 +188,7 @@ class MushroomStrategy {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Check if default is hidden
|
||||
// Create cards for any other domain.
|
||||
// Collect device entities of the current area.
|
||||
const areaDevices = Helper.devices.filter(device => device.area_id === area.area_id)
|
||||
|
@@ -86,6 +86,11 @@ export const optionDefaults = {
|
||||
showControls: false,
|
||||
hidden: false,
|
||||
},
|
||||
lock: {
|
||||
title: "Locks",
|
||||
showControls: false,
|
||||
hidden: false,
|
||||
},
|
||||
climate: {
|
||||
title: "Climates",
|
||||
showControls: false,
|
||||
|
Reference in New Issue
Block a user