Allow empty name (#2388)

This commit is contained in:
Andrey 2019-01-03 23:46:14 +02:00 committed by Paulus Schoutsen
parent f272801253
commit 25c788871f

View File

@ -2,5 +2,6 @@ import { HassEntity } from "home-assistant-js-websocket";
import computeObjectId from "./compute_object_id";
export default (stateObj: HassEntity): string =>
stateObj.attributes.friendly_name ||
computeObjectId(stateObj.entity_id).replace(/_/g, " ");
stateObj.attributes.friendly_name === undefined
? computeObjectId(stateObj.entity_id).replace(/_/g, " ")
: stateObj.attributes.friendly_name || "";