Hi all,
I’m using PiotrMachowski/lovelace-xiaomi-vacuum-map-card for controlling my vacuum cleaner.
One of the options of that card is to define cleanup zones in the card’s lovelace configuration so that you can tell the vacuum to only clean a certain area.
I’m trying to define the cleanup zones using the data from an input_text
entity .
The goal is to be able to define the zones in input_texts
and then use them both in the vacuum card and in different automations.
I managed to do it using a custom:config-template-card
which works great other than the fact that the vacuum card doesn’t update when staying focused on the dashboard (for example the location of the vacuum on the map doesn’t update until I switch to a different dashboard and then switch back).
Here’s a code example -
type: custom:config-template-card
variables:
breakString: |
temp => {
var find = ' ';
var re = new RegExp(find, 'g');
temp = temp.replace(re, '');
temp = temp.replace('[', '').replace(']', '').split(',')
return temp
}
ZONE_KITCHEN: states['input_text.zone_kitchen'].state
ZONE_DINNING_ROOM: states['input_text.zone_dinning_room'].state
entities:
- input_text.zone_kitchen
- input_text.zone_dinning_room
card:
type: custom:xiaomi-vacuum-map-card
entity: vacuum.xiaomi_vacuum_cleaner
map_source:
camera: camera.xiaomi_cloud_map_extractor
calibration_source:
camera: true
map_modes:
- template: vacuum_clean_zone_predefined
predefined_selections:
- zones:
- ${ breakString(ZONE_KITCHEN) }
icon:
name: mdi:pot-mix
x: 25500
'y': 24800
- zones:
- ${ breakString(ZONE_DINNING_ROOM) }
icon:
name: mdi:silverware
x: 29700
'y': 24300
- template: vacuum_clean_zone
- template: vacuum_goto
Any suggestions of a different way of importing data from input_text
into the lovelace configuarion?