From 9eadf4f73da4f4952c3a19701271cd56622fb2c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Tomak?= Date: Fri, 5 Apr 2024 10:19:52 +0200 Subject: [PATCH] Allow to overwrite template settings in entity config (#317) 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 +}