Skip to content

Commit

Permalink
Merge pull request #299 from custom-cards/dev
Browse files Browse the repository at this point in the history
3.2.2
  • Loading branch information
RomRider authored Mar 17, 2020
2 parents 1ff4a66 + 0514666 commit 605e42f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "button-card",
"version": "3.2.1",
"version": "3.2.2",
"description": "Button card for lovelace",
"main": "dist/button-card.js",
"pre-commit": [
Expand Down
13 changes: 12 additions & 1 deletion src/button-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
secondsToDuration,
durationToSeconds,
createThing,
DOMAINS_TOGGLE,
} from 'custom-card-helpers';
import { BUTTON_CARD_VERSION } from './version-const';
import {
Expand Down Expand Up @@ -855,7 +856,6 @@ class ButtonCard extends LitElement {
}
template.state = mergedStateConfig;
this.config = {
tap_action: { action: 'toggle' },
hold_action: { action: 'none' },
double_tap_action: { action: 'none' },
layout: 'vertical',
Expand All @@ -870,6 +870,17 @@ class ButtonCard extends LitElement {
show_live_stream: false,
...template,
};
if (this.config!.entity && DOMAINS_TOGGLE.has(computeDomain(this.config!.entity))) {
this.config = {
tap_action: { action: 'toggle' },
...this.config,
};
} else {
this.config = {
tap_action: { action: 'more-info' },
...this.config,
};
}
this.config.lock = {
enabled: false,
duration: 5,
Expand Down
1 change: 1 addition & 0 deletions src/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { css } from 'lit-element';
export const styles = css`
:host {
position: relative;
display: block;
}
ha-card {
cursor: pointer;
Expand Down
2 changes: 1 addition & 1 deletion src/version-const.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const BUTTON_CARD_VERSION = '3.2.1';
export const BUTTON_CARD_VERSION = '3.2.2';

0 comments on commit 605e42f

Please sign in to comment.