ha-frontend-cdce8p/src/common/entity/compute_active_state.ts
Ian Richardson 753804f463 💄 additional active icon states (#4510)
* 💄 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
2020-01-23 09:01:18 -08:00

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;
};