From fd9de52e7f0a15044b6bae487de1305faceffb1a Mon Sep 17 00:00:00 2001 From: Niklas Schumacher Date: Tue, 23 Jan 2024 21:32:31 +0100 Subject: [PATCH] Designate 0.3.6 --- README.md | 1 + shutter-row.js | 21 ++++++++++++++------- src/const.js | 2 +- src/editor/editor_schema.js | 1 + src/localization/de.json | 1 + src/localization/en.json | 1 + src/shutter-row.js | 16 ++++++++++------ 7 files changed, 29 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 533a414..24d2991 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,7 @@ preset_buttons: | `rtl_position` | `boolean` | false | Switches direction of the position slider to right to left | | `state_color` | `boolean` | false | Enables icon coloring if the shutter is not fully closed | | `group` | `boolean` | false | Removes outer card styling, use if card is part of entities card | +| `ignore_state` | `boolean` | false | Always enable moving buttons, independent of state | | `title_template` | [`template`](https://www.home-assistant.io/docs/configuration/templating/) | Optional | Overwrites card title with a rendered template | | `position_template` | [`template`](https://www.home-assistant.io/docs/configuration/templating/) | Optional | Overwrites position with a rendered template | | `move_down_button` | [`action`](https://www.home-assistant.io/dashboards/actions/) | Optional | Custom action for the move down button (overwrites default functions) | diff --git a/shutter-row.js b/shutter-row.js index 01312b8..a02c33c 100644 --- a/shutter-row.js +++ b/shutter-row.js @@ -136,7 +136,7 @@ var mdiStop = "M18,18H6V6H18V18Z"; const HASSIO_CARD_ID = "shutter-row"; const HASSIO_CARD_EDITOR_ID = HASSIO_CARD_ID + "-editor"; const HASSIO_CARD_NAME = "Shutter Row"; -const VERSION = "0.3.5"; +const VERSION = "0.3.6"; // SVG PATHS const PATH_SHUTTER_100 = @@ -160,6 +160,7 @@ var editor$1 = { disable_position: "Hide position slider", rtl_position: "Switch direction of the position slider", group: "Group", + ignore_state: "Enable always move buttons", title_template: "Title template", position_template: "Position label template", move_down_button: "Move down button action", @@ -188,6 +189,7 @@ var editor = { disable_position: "Verstecke Positionslider", rtl_position: "Vertausche Richtung des Positionslider", group: "Gruppe", + ignore_state: "Aktiviere immer Bewegungsbuttons", title_template: "Titel template", position_template: "Positionswert template", move_down_button: "Runter Button Aktion", @@ -290,6 +292,7 @@ const getRootSchema = (hass) => [ { name: "rtl_position", selector: { boolean: {} } }, { name: "state_color", selector: { boolean: {} } }, { name: "group", selector: { boolean: {} } }, + { name: "ignore_state", selector: { boolean: {} } }, ], }, { name: "title_template", selector: { template: {} } }, @@ -836,6 +839,7 @@ class ShutterRow extends s { rtl_position: getConfigAttribute("rtl_position", false), state_color: getConfigAttribute("state_color", false), group: getConfigAttribute("group", false), + ignore_state: getConfigAttribute("ignore_state", false), title_template: getConfigAttribute("title_template", false), position_template: getConfigAttribute("position_template", false), move_down_button: { @@ -1049,16 +1053,19 @@ class ShutterRow extends s { renderFirstRow() { let moveUpDisabled = () => { if (this.stateDisplay == "unavailable") return true; + if (this.config.ignore_state) return false; if (this.upReached() || this.currentMoving() == "up") return true; return false; }; let moveStopDisabled = () => { if (this.stateDisplay == "unavailable") return true; + if (this.config.ignore_state) return false; if (this.state.attributes.moving == "STOP") return true; return false; }; let moveDownDisabled = () => { if (this.stateDisplay == "unavailable") return true; + if (this.config.ignore_state) return false; if (this.downReached() || this.currentMoving() == "down") return true; return false; }; @@ -1113,15 +1120,15 @@ class ShutterRow extends s {
${this.getPositionLabel()} @@ -1300,7 +1307,7 @@ class ShutterRow extends s { return; } // Run default action - if (this.upReached()) return; + if (this.upReached() && !this.config.ignore_state) return; this.hass.callService("cover", "open_cover", { entity_id: this.entityId, }); @@ -1328,7 +1335,7 @@ class ShutterRow extends s { return; } // Run default action - if (this.state.attributes.moving == "STOP") return; + if (this.state.attributes.moving == "STOP" && !this.config.ignore_state) return; this.hass.callService("cover", "stop_cover", { entity_id: this.entityId, }); @@ -1356,7 +1363,7 @@ class ShutterRow extends s { return; } // Run default action - if (this.downReached()) return; + if (this.downReached() && !this.config.ignore_state) return; this.hass.callService("cover", "close_cover", { entity_id: this.entityId, }); diff --git a/src/const.js b/src/const.js index 456c191..d1c4978 100644 --- a/src/const.js +++ b/src/const.js @@ -2,7 +2,7 @@ export const HASSIO_CARD_ID = "shutter-row"; export const HASSIO_CARD_EDITOR_ID = HASSIO_CARD_ID + "-editor"; export const HASSIO_CARD_NAME = "Shutter Row"; -export const VERSION = "0.3.5"; +export const VERSION = "0.3.6"; // SVG PATHS export const PATH_SHUTTER_100 = diff --git a/src/editor/editor_schema.js b/src/editor/editor_schema.js index 788b1f0..a1a00c0 100644 --- a/src/editor/editor_schema.js +++ b/src/editor/editor_schema.js @@ -36,6 +36,7 @@ export const getRootSchema = (hass) => [ { name: "rtl_position", selector: { boolean: {} } }, { name: "state_color", selector: { boolean: {} } }, { name: "group", selector: { boolean: {} } }, + { name: "ignore_state", selector: { boolean: {} } }, ], }, { name: "title_template", selector: { template: {} } }, diff --git a/src/localization/de.json b/src/localization/de.json index 361dc56..861d525 100644 --- a/src/localization/de.json +++ b/src/localization/de.json @@ -5,6 +5,7 @@ "disable_position": "Verstecke Positionslider", "rtl_position": "Vertausche Richtung des Positionslider", "group": "Gruppe", + "ignore_state": "Aktiviere immer Bewegungsbuttons", "title_template": "Titel template", "position_template": "Positionswert template", "move_down_button": "Runter Button Aktion", diff --git a/src/localization/en.json b/src/localization/en.json index 295fe78..3f0ab9a 100644 --- a/src/localization/en.json +++ b/src/localization/en.json @@ -5,6 +5,7 @@ "disable_position": "Hide position slider", "rtl_position": "Switch direction of the position slider", "group": "Group", + "ignore_state": "Enable always move buttons", "title_template": "Title template", "position_template": "Position label template", "move_down_button": "Move down button action", diff --git a/src/shutter-row.js b/src/shutter-row.js index 5b5a4d4..4e567a2 100644 --- a/src/shutter-row.js +++ b/src/shutter-row.js @@ -88,6 +88,7 @@ class ShutterRow extends LitElement { rtl_position: getConfigAttribute("rtl_position", false), state_color: getConfigAttribute("state_color", false), group: getConfigAttribute("group", false), + ignore_state: getConfigAttribute("ignore_state", false), title_template: getConfigAttribute("title_template", false), position_template: getConfigAttribute("position_template", false), move_down_button: { @@ -301,16 +302,19 @@ class ShutterRow extends LitElement { renderFirstRow() { let moveUpDisabled = () => { if (this.stateDisplay == "unavailable") return true; + if (this.config.ignore_state) return false; if (this.upReached() || this.currentMoving() == "up") return true; return false; }; let moveStopDisabled = () => { if (this.stateDisplay == "unavailable") return true; + if (this.config.ignore_state) return false; if (this.state.attributes.moving == "STOP") return true; return false; }; let moveDownDisabled = () => { if (this.stateDisplay == "unavailable") return true; + if (this.config.ignore_state) return false; if (this.downReached() || this.currentMoving() == "down") return true; return false; }; @@ -365,15 +369,15 @@ class ShutterRow extends LitElement {
${this.getPositionLabel()} @@ -552,7 +556,7 @@ class ShutterRow extends LitElement { return; } // Run default action - if (this.upReached()) return; + if (this.upReached() && !this.config.ignore_state) return; this.hass.callService("cover", "open_cover", { entity_id: this.entityId, }); @@ -580,7 +584,7 @@ class ShutterRow extends LitElement { return; } // Run default action - if (this.state.attributes.moving == "STOP") return; + if (this.state.attributes.moving == "STOP" && !this.config.ignore_state) return; this.hass.callService("cover", "stop_cover", { entity_id: this.entityId, }); @@ -608,7 +612,7 @@ class ShutterRow extends LitElement { return; } // Run default action - if (this.downReached()) return; + if (this.downReached() && !this.config.ignore_state) return; this.hass.callService("cover", "close_cover", { entity_id: this.entityId, });