Skip to content

Commit 9838e33

Browse files
committed
Clean up toggle check usage (#160)
1 parent a01197e commit 9838e33

File tree

2 files changed

+2
-11
lines changed

2 files changed

+2
-11
lines changed

src/index.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
import { handleClick, secondsToDuration } from 'custom-card-helpers';
22
import { checkEntity, entityName, entityStateDisplay, entityStyles, entityUnit, entityValue } from './entity';
3-
import {
4-
getEntityIds,
5-
hasConfigOrEntitiesChanged,
6-
hasGenericSecondaryInfo,
7-
hasToggle,
8-
isObject,
9-
hideUnavailable,
10-
} from './util';
3+
import { getEntityIds, hasConfigOrEntitiesChanged, hasGenericSecondaryInfo, isObject, hideUnavailable } from './util';
114
import { style } from './styles';
125

136
const LitElement =
@@ -125,7 +118,7 @@ class MultipleEntityRow extends LitElement {
125118
}
126119

127120
renderValue(stateObj, config) {
128-
if (hasToggle(stateObj, config)) {
121+
if (config.toggle === true) {
129122
return html`<ha-entity-toggle .stateObj="${stateObj}" .hass="${this._hass}"></ha-entity-toggle>`;
130123
}
131124
if (config.format) {

src/util.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ export const hideUnavailable = (stateObj, config) =>
1616
config.hide_unavailable &&
1717
(isUnavailable(stateObj) || (config.attribute && stateObj.attributes[config.attribute] === undefined));
1818

19-
export const hasToggle = (stateObj, config) => config.toggle === true;
20-
2119
export const hasGenericSecondaryInfo = (config) => typeof config === 'string' && SECONDARY_INFO_VALUES.includes(config);
2220

2321
export const getEntityIds = (config) =>

0 commit comments

Comments
 (0)