Skip to content

Commit d610bf0

Browse files
Merge pull request #605 from PiotrMachowski/dev
v2.2.1
2 parents 0719cd3 + 965cf8c commit d610bf0

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xiaomi-vacuum-map-card",
3-
"version": "v2.2.0",
3+
"version": "v2.2.1",
44
"description": "Xiaomi Vacuum Map Card",
55
"keywords": [
66
"home-assistant",

src/components/tile.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,19 @@ export class Tile extends RootlessLitElement {
9494
stateObject?: HassEntity,
9595
) {
9696
let value: ReplacedKey = "";
97+
const unit = this.getUnit();
9798
const processNumber = this.config.multiplier !== undefined || this.config.precision !== undefined;
9899
if (this.config.entity && stateObject) {
99100
if (processNumber) {
100101
value = this.config.attribute
101102
? stateObject.attributes[this.config.attribute]
102103
: stateObject.state;
103104
} else {
104-
value = localizeEntity(this.hass, this.config as EntityConfig, this.hass.states[this.config.entity]);
105+
value = localizeEntity(this.hass, this.config as EntityConfig, stateObject);
106+
const originalUnit = stateObject.attributes.unit_of_measurement;
107+
if (unit !== "" && originalUnit && value.endsWith(originalUnit)) {
108+
value = value.substring(0, value.length - originalUnit.length).trimEnd();
109+
}
105110
}
106111
} else if (this.config.internal_variable && this.config.internal_variable in this.internalVariables) {
107112
value = this.internalVariables[this.config.internal_variable];
@@ -116,7 +121,6 @@ export class Tile extends RootlessLitElement {
116121
if (`${value}`.toLowerCase() in translations) {
117122
value = translations[`${value}`.toLowerCase()];
118123
}
119-
const unit = this.getUnit();
120124
return `${value}${unit}`;
121125
}
122126

src/model/generators/platform_templates/DeebotUniverse_Deebot-4-Home-Assistant.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"coordinates_to_meters_divider": -1,
5151
"repeats_type": "NONE",
5252
"service_call_schema": {
53-
"service": "xiaomi_miio.vacuum_clean_zone",
53+
"service": "vacuum.send_command",
5454
"service_data": {
5555
"entity_id": "[[entity_id]]",
5656
"command": "custom_area",

src/model/generators/platform_templates/humbertogontijo_homeassistant-roborock.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@
99
"name": "map_mode.vacuum_clean_segment",
1010
"icon": "mdi:floor-plan",
1111
"selection_type": "ROOM",
12-
"repeats_type": "REPEAT",
12+
"repeats_type": "EXTERNAL",
1313
"max_repeats": 3,
1414
"service_call_schema": {
1515
"service": "roborock.vacuum_clean_segment",
1616
"service_data": {
1717
"segments": "[[selection]]",
18-
"entity_id": "[[entity_id]]"
18+
"entity_id": "[[entity_id]]",
19+
"repeats": "[[repeats]]"
1920
}
2021
}
2122
},

0 commit comments

Comments
 (0)