* 💄 additional active icon states * ♻️ sort by domain * 👌 address review comments * state_color option for entities card * fix typo * 👌 address comments extract common css properly set boolean attributes separate error states/color fix unavailable color * only make copy if necessary * remove paused timer * remove paused timer
13 lines
310 B
TypeScript
13 lines
310 B
TypeScript
import { HassEntity } from "home-assistant-js-websocket";
|
|
|
|
export const computeActiveState = (stateObj: HassEntity): string => {
|
|
const domain = stateObj.entity_id.split(".")[0];
|
|
let state = stateObj.state;
|
|
|
|
if (domain === "climate") {
|
|
state = stateObj.attributes.hvac_action;
|
|
}
|
|
|
|
return state;
|
|
};
|