diff --git a/README.md b/README.md
index a5c16bd..0413386 100644
--- a/README.md
+++ b/README.md
@@ -54,6 +54,7 @@ preset_buttons:
| `name` | `string` | Optional | Overwrites friendly name from entity |
| `invert_position` | `boolean` | false | Inverts position value (0% => 100%, 30% => 70%), forces also `invert_position_label` to `true` |
| `invert_position_label` | `boolean` | false | Inverts position label (if `false` => 0% = closed, 100% = open; if `true` => 0% = open, 100% = closed) |
+| `state_confidence` | `boolean` | true | Trust full state support (if `false` ignore state and e.g. always enables move buttons ) |
| `state_color` | `boolean` | false | Enables icon coloring if entity is active |
| `move_down_button` | [`action`](https://www.home-assistant.io/dashboards/actions/) | Optional | Custom action for the move down button (overwrites default functions) |
| `move_stop_button` | [`action`](https://www.home-assistant.io/dashboards/actions/) | Optional | Custom action for the move stop button (overwrites default functions) |
diff --git a/package.json b/package.json
index ac1e781..83463f3 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "@berrywhite/lovelace-shutter-row",
"private": true,
- "version": "0.2.0",
+ "version": "0.2.1",
"description": "Home Assistant Lovelace Shutter Row Card",
"main": "shutter-row.js",
"module": "shutter-row.js",
diff --git a/shutter-row.js b/shutter-row.js
index dafece5..846dc2f 100644
--- a/shutter-row.js
+++ b/shutter-row.js
@@ -248,7 +248,7 @@ styleInject(css_248z);
let HASSIO_CARD_ID = "shutter-row";
let HASSIO_CARD_NAME = "Shutter row";
-let VERSION = "0.2.0";
+let VERSION = "0.2.1";
class ShutterRow extends s {
@@ -283,6 +283,7 @@ class ShutterRow extends s {
name: getConfigAttribute("name", false),
invert_position: getConfigAttribute("invert_position", false),
invert_position_label: getConfigAttribute("invert_position_label", false) || getConfigAttribute("invert_position", false),
+ state_confidence: getConfigAttribute("state_confidence", true),
state_color: getConfigAttribute("state_color", false),
move_down_button: {
tap_action: getConfigAttribute("tap_action", false, getConfigAttribute("move_down_button", false)),
@@ -392,9 +393,9 @@ class ShutterRow extends s {
${this.getName()}
-
-
-
+
+
+
`;
@@ -483,8 +484,9 @@ class ShutterRow extends s {
return;
}
// Run default action
- if(this.stateDisplay == "opening" || this._getElements().controls.hasAttribute("up-reached"))
- return;
+ if(this.config.state_confidence)
+ if(this.upReached())
+ return;
this.hass.callService("cover", "open_cover", {
entity_id: this.entityId,
});
@@ -506,8 +508,9 @@ class ShutterRow extends s {
return;
}
// Run default action
- if(this.stateDisplay == "open" || this.stateDisplay == "closed")
- return;
+ if(this.config.state_confidence)
+ if(this.stateDisplay == "open" || this.stateDisplay == "closed")
+ return;
this.hass.callService("cover", "stop_cover", {
entity_id: this.entityId,
});
@@ -529,8 +532,9 @@ class ShutterRow extends s {
return;
}
// Run default action
- if(this.stateDisplay == "closing" || this._getElements().controls.hasAttribute("down-reached"))
- return;
+ if(this.config.state_confidence)
+ if(this.downReached())
+ return;
this.hass.callService("cover", "close_cover", {
entity_id: this.entityId,
});
diff --git a/src/shutter-row.js b/src/shutter-row.js
index 81568e6..8cbdc88 100644
--- a/src/shutter-row.js
+++ b/src/shutter-row.js
@@ -16,7 +16,7 @@ import style from "./style.css";
let HASSIO_CARD_ID = "shutter-row";
let HASSIO_CARD_NAME = "Shutter row";
-let VERSION = "0.2.0"
+let VERSION = "0.2.1";
class ShutterRow extends LitElement {
@@ -51,6 +51,7 @@ class ShutterRow extends LitElement {
name: getConfigAttribute("name", false),
invert_position: getConfigAttribute("invert_position", false),
invert_position_label: getConfigAttribute("invert_position_label", false) || getConfigAttribute("invert_position", false),
+ state_confidence: getConfigAttribute("state_confidence", true),
state_color: getConfigAttribute("state_color", false),
move_down_button: {
tap_action: getConfigAttribute("tap_action", false, getConfigAttribute("move_down_button", false)),
@@ -160,9 +161,9 @@ class ShutterRow extends LitElement {
${this.getName()}
-
-
-
+
+
+
`;
@@ -251,8 +252,9 @@ class ShutterRow extends LitElement {
return;
}
// Run default action
- if(this.stateDisplay == "opening" || this._getElements().controls.hasAttribute("up-reached"))
- return;
+ if(this.config.state_confidence)
+ if(this.upReached())
+ return;
this.hass.callService("cover", "open_cover", {
entity_id: this.entityId,
});
@@ -274,8 +276,9 @@ class ShutterRow extends LitElement {
return;
}
// Run default action
- if(this.stateDisplay == "open" || this.stateDisplay == "closed")
- return;
+ if(this.config.state_confidence)
+ if(this.stateDisplay == "open" || this.stateDisplay == "closed")
+ return;
this.hass.callService("cover", "stop_cover", {
entity_id: this.entityId,
});
@@ -297,8 +300,9 @@ class ShutterRow extends LitElement {
return;
}
// Run default action
- if(this.stateDisplay == "closing" || this._getElements().controls.hasAttribute("down-reached"))
- return;
+ if(this.config.state_confidence)
+ if(this.downReached())
+ return;
this.hass.callService("cover", "close_cover", {
entity_id: this.entityId,
});
@@ -337,4 +341,4 @@ class ShutterRow extends LitElement {
}
customElements.define(HASSIO_CARD_ID, ShutterRow);
-console.info("%c" + HASSIO_CARD_NAME.toLocaleUpperCase() + " " + VERSION, "color: #ffa500");
\ No newline at end of file
+console.info("%c" + HASSIO_CARD_NAME.toLocaleUpperCase() + " " + VERSION, "color: #ffa500");
\ No newline at end of file