From 34b52896e8198b07c064d00f1c310f6e5260eae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tomak?= Date: Fri, 23 Feb 2024 21:14:22 +0100 Subject: [PATCH] Allow to overwrite template settings in entity config This is fixing entity templates behaviour, where settings defined in a template couldn't be changed later in an entity using that template. --- package.json | 2 +- src/template.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 9fac145..c620d4a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "room-card", - "version": "1.08.03", + "version": "1.08.04", "description": "Show entities in Home Assistant's Lovelace UI", "keywords": [ "home-assistant", diff --git a/src/template.ts b/src/template.ts index 33a654d..013599e 100644 --- a/src/template.ts +++ b/src/template.ts @@ -15,7 +15,7 @@ export const mapTemplate = (entity: RoomCardEntity, config: RoomCardConfig) => { if(templatesWithMatchingName.length > 0) { const templateFromConfig = templatesWithMatchingName[0]; - return { stateObj: entity.stateObj, ...entity, ...templateFromConfig.template }; + return { stateObj: entity.stateObj, ...templateFromConfig.template, ...entity }; } } @@ -34,4 +34,4 @@ export const getTemplateOrAttribute = (attribute: string | number | RoomCardAttr } return attribute; -} \ No newline at end of file +}