Skip to content

Commit

Permalink
Designate 0.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
berrywhite96 committed Jan 23, 2024
1 parent 8e9391f commit fd9de52
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 14 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down
21 changes: 14 additions & 7 deletions shutter-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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: {} } },
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -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;
};
Expand Down Expand Up @@ -1113,15 +1120,15 @@ class ShutterRow extends s {
<div class="card-row second-row">
<ha-slider
class="exclude-on-click"
ignore-bar-touch=""
min="0"
max="100"
value=${this.getPosition()}
step="5"
pin
dir="${this.config.rtl_position ? "rtl" : "ltr"}"
role="slider"
@change="${this.onSliderChange}"
ignore-bar-touch
pin
labeled
></ha-slider>
<div class="infos">
<span class="position">${this.getPositionLabel()}</span>
Expand Down Expand Up @@ -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,
});
Expand Down Expand Up @@ -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,
});
Expand Down Expand Up @@ -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,
});
Expand Down
2 changes: 1 addition & 1 deletion src/const.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
1 change: 1 addition & 0 deletions src/editor/editor_schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {} } },
Expand Down
1 change: 1 addition & 0 deletions src/localization/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/localization/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 10 additions & 6 deletions src/shutter-row.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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;
};
Expand Down Expand Up @@ -365,15 +369,15 @@ class ShutterRow extends LitElement {
<div class="card-row second-row">
<ha-slider
class="exclude-on-click"
ignore-bar-touch=""
min="0"
max="100"
value=${this.getPosition()}
step="5"
pin
dir="${this.config.rtl_position ? "rtl" : "ltr"}"
role="slider"
@change="${this.onSliderChange}"
ignore-bar-touch
pin
labeled
></ha-slider>
<div class="infos">
<span class="position">${this.getPositionLabel()}</span>
Expand Down Expand Up @@ -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,
});
Expand Down Expand Up @@ -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,
});
Expand Down Expand Up @@ -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,
});
Expand Down

0 comments on commit fd9de52

Please sign in to comment.