Fix default formatEntityState function (#17852)

This commit is contained in:
karwosts 2023-09-08 06:54:54 -07:00 committed by GitHub
parent 7176a51fec
commit db7caf1c32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -177,10 +177,10 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
// @ts-ignore // @ts-ignore
this._loadFragmentTranslations(this.hass?.language, fragment), this._loadFragmentTranslations(this.hass?.language, fragment),
formatEntityState: (stateObj, state) => formatEntityState: (stateObj, state) =>
(state !== null ? state : stateObj.state) ?? "", (state != null ? state : stateObj.state) ?? "",
formatEntityAttributeName: (_stateObj, attribute) => attribute, formatEntityAttributeName: (_stateObj, attribute) => attribute,
formatEntityAttributeValue: (stateObj, attribute, value) => formatEntityAttributeValue: (stateObj, attribute, value) =>
value !== null ? value : stateObj.attributes[attribute] ?? "", value != null ? value : stateObj.attributes[attribute] ?? "",
...getState(), ...getState(),
...this._pendingHass, ...this._pendingHass,
}; };