Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add active state for cover, input_boolean, group and device_tracker #2431

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/components/entity/state-badge.js
Expand Up @@ -29,7 +29,11 @@ class StateBadge extends PolymerElement {
ha-icon[data-domain="light"][data-state="on"],
ha-icon[data-domain="switch"][data-state="on"],
ha-icon[data-domain="binary_sensor"][data-state="on"],
ha-icon[data-domain="input_boolean"][data-state="on"],
Copy link
Member

@iantrich iantrich Jan 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alphabetize on data-domain

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

ha-icon[data-domain="fan"][data-state="on"],
ha-icon[data-domain="cover"][data-state="open"],
ha-icon[data-domain="device_tracker"][data-state="home"],
ha-icon[data-domain="group"][data-state="on"],
ha-icon[data-domain="sun"][data-state="above_horizon"] {
color: var(--paper-item-icon-active-color, #fdd835);
}
Expand Down Expand Up @@ -92,7 +96,7 @@ class StateBadge extends PolymerElement {
if (typeof brightness !== "number") {
errorMessage = `Type error: state-badge expected number, but type of ${
newVal.entity_id
}.attributes.brightness is ${typeof brightness} (${brightness})`;
}.attributes.brightness is ${typeof brightness} (${brightness})`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this change

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

// eslint-disable-next-line
console.warn(errorMessage);
}
Expand Down
22 changes: 13 additions & 9 deletions src/panels/lovelace/cards/hui-entity-button-card.ts
Expand Up @@ -96,33 +96,33 @@ class HuiEntityButtonCard extends hassLocalizeLitMixin(LitElement)
.longPress="${longPress()}"
>
${
!stateObj
? html`
!stateObj
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file shouldn't have been changed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file or just those lines? My editor (vscode) decided to "fix" that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vscode lied to you. Get the 'Prettier - Code formatter' extension. There are some recommended plugins for this project that should be suggested when you open vscode at search @recommended

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just fixed it by hand.

? html`
<div class="not-found">
Entity not available: ${this._config.entity}
</div>
`
: html`
: html`
<paper-button>
<div>
<ha-icon
data-domain="${computeStateDomain(stateObj)}"
data-state="${stateObj.state}"
.icon="${this._config.icon || stateIcon(stateObj)}"
style="${
styleMap({
filter: this._computeBrightness(stateObj),
color: this._computeColor(stateObj),
})
}"
styleMap({
filter: this._computeBrightness(stateObj),
color: this._computeColor(stateObj),
})
}"
></ha-icon>
<span>
${this._config.name || computeStateName(stateObj)}
</span>
</div>
</paper-button>
`
}
}
</ha-card>
`;
}
Expand Down Expand Up @@ -151,7 +151,11 @@ class HuiEntityButtonCard extends hassLocalizeLitMixin(LitElement)
ha-icon[data-domain="light"][data-state="on"],
ha-icon[data-domain="switch"][data-state="on"],
ha-icon[data-domain="binary_sensor"][data-state="on"],
ha-icon[data-domain="input_boolean"][data-state="on"],
Copy link
Member

@iantrich iantrich Jan 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alphabetize on data-domain

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

ha-icon[data-domain="fan"][data-state="on"],
ha-icon[data-domain="cover"][data-state="open"],
ha-icon[data-domain="device_tracker"][data-state="home"],
ha-icon[data-domain="group"][data-state="on"],
ha-icon[data-domain="sun"][data-state="above_horizon"] {
color: var(--paper-item-icon-active-color, #fdd835);
}
Expand Down