diff --git a/package.json b/package.json index 41147f8d..1ff54edd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiaomi-vacuum-map-card", - "version": "v2.2.0", + "version": "v2.2.1", "description": "Xiaomi Vacuum Map Card", "keywords": [ "home-assistant", diff --git a/src/components/tile.ts b/src/components/tile.ts index 0dbee0c2..02649333 100644 --- a/src/components/tile.ts +++ b/src/components/tile.ts @@ -94,6 +94,7 @@ export class Tile extends RootlessLitElement { stateObject?: HassEntity, ) { let value: ReplacedKey = ""; + const unit = this.getUnit(); const processNumber = this.config.multiplier !== undefined || this.config.precision !== undefined; if (this.config.entity && stateObject) { if (processNumber) { @@ -101,7 +102,11 @@ export class Tile extends RootlessLitElement { ? stateObject.attributes[this.config.attribute] : stateObject.state; } else { - value = localizeEntity(this.hass, this.config as EntityConfig, this.hass.states[this.config.entity]); + value = localizeEntity(this.hass, this.config as EntityConfig, stateObject); + const originalUnit = stateObject.attributes.unit_of_measurement; + if (unit !== "" && originalUnit && value.endsWith(originalUnit)) { + value = value.substring(0, value.length - originalUnit.length).trimEnd(); + } } } else if (this.config.internal_variable && this.config.internal_variable in this.internalVariables) { value = this.internalVariables[this.config.internal_variable]; @@ -116,7 +121,6 @@ export class Tile extends RootlessLitElement { if (`${value}`.toLowerCase() in translations) { value = translations[`${value}`.toLowerCase()]; } - const unit = this.getUnit(); return `${value}${unit}`; } diff --git a/src/model/generators/platform_templates/DeebotUniverse_Deebot-4-Home-Assistant.json b/src/model/generators/platform_templates/DeebotUniverse_Deebot-4-Home-Assistant.json index c5583d0d..69f965ce 100644 --- a/src/model/generators/platform_templates/DeebotUniverse_Deebot-4-Home-Assistant.json +++ b/src/model/generators/platform_templates/DeebotUniverse_Deebot-4-Home-Assistant.json @@ -50,7 +50,7 @@ "coordinates_to_meters_divider": -1, "repeats_type": "NONE", "service_call_schema": { - "service": "xiaomi_miio.vacuum_clean_zone", + "service": "vacuum.send_command", "service_data": { "entity_id": "[[entity_id]]", "command": "custom_area", diff --git a/src/model/generators/platform_templates/humbertogontijo_homeassistant-roborock.json b/src/model/generators/platform_templates/humbertogontijo_homeassistant-roborock.json index ee8ef3a5..7de9b638 100644 --- a/src/model/generators/platform_templates/humbertogontijo_homeassistant-roborock.json +++ b/src/model/generators/platform_templates/humbertogontijo_homeassistant-roborock.json @@ -9,13 +9,14 @@ "name": "map_mode.vacuum_clean_segment", "icon": "mdi:floor-plan", "selection_type": "ROOM", - "repeats_type": "REPEAT", + "repeats_type": "EXTERNAL", "max_repeats": 3, "service_call_schema": { "service": "roborock.vacuum_clean_segment", "service_data": { "segments": "[[selection]]", - "entity_id": "[[entity_id]]" + "entity_id": "[[entity_id]]", + "repeats": "[[repeats]]" } } },