Open wrobelda opened 8 months ago
The Valetudo RE manual is equally confusing: there's id
attribute, but the position
one is missing: https://github.com/PiotrMachowski/lovelace-xiaomi-vacuum-map-card/blob/master/docs/templates/rand256ValetudoRe.md#going-to-a-predefined-point-vacuum_goto_predefined
Use the following config:
- template: vacuum_goto_predefined
selection_type: PREDEFINED_POINT
predefined_selections:
- id: 1
position:
- 2638
- 2533
icon:
name: mdi:delete-empty
x: 2638
'y': 2533
label:
text: Emptying
x: 2638
'y': 2533
offset_y: 35
Still no go. The service call now is:
{
"domain": "mqtt",
"service": "publish",
"serviceData": {
"topic": "valetudo/BlindHarmlessChimpanzee/GoToLocationCapability/go/set",
"payload": "{ \"coordinates\": { \"x\": \"2638\", \"y\": \"2533\" } }"
}
}
Comparing it to a "Pin & Go" call, the only difference is that the coordinates are sent as strings vs integers in the latter.
Edit: Sorry, below comment seems duplicate of #662, see https://github.com/PiotrMachowski/lovelace-xiaomi-vacuum-map-card/issues/662#issuecomment-1741713714.
I can confirm a similar issue with vacuum_clean_zone_predefined
; it requires an id
while it's not mentioned in the documentation. Furthermore, it seems to try to interpret the value of id
as the zone coordinates.
Error: i.id is undefined
type: custom:xiaomi-vacuum-map-card
map_source:
camera: camera.valetudo_camera
calibration_source:
camera: true
entity: vacuum.valetudo_dreame
vacuum_platform: Hypfer/Valetudo
internal_variables:
topic: valetudo/dreame
map_modes:
- template: vacuum_clean_zone_predefined
predefined_selections:
- zones:
- - 3402
- 3009
- 3783
- 3172
icon:
name: mdi:silverware-fork-knife
x: 3580
'y': 3090
- template: vacuum_clean_zone
- template: vacuum_goto
map_locked: true
In the HA logs (when I add id: "1"
to the config to allow the widget to display):
Template variable warning: str object has no element 1 when rendering '{"topic":"valetudo/dreame/ZoneCleaningCapability/start/set","payload":"{\"zones\": [{%for s in ('[\"1\"]')|from_json %}{ \"points\": {\"pA\": { \"x\": {{s[0]}}, \"y\": {{s[1]}} }, \"pB\": { \"x\": {{s[2]}}, \"y\": {{s[1]}} }, \"pC\": { \"x\": {{s[2]}}, \"y\": {{s[3]}} }, \"pD\": { \"x\": {{s[0]}}, \"y\": {{s[3]}} } }, \"iterations\": 1}{%if not loop.last%},{%endif%}{%endfor%}]}"}'
Template variable warning: str object has no element 2 when rendering '{"topic":"valetudo/dreame/ZoneCleaningCapability/start/set","payload":"{\"zones\": [{%for s in ('[\"1\"]')|from_json %}{ \"points\": {\"pA\": { \"x\": {{s[0]}}, \"y\": {{s[1]}} }, \"pB\": { \"x\": {{s[2]}}, \"y\": {{s[1]}} }, \"pC\": { \"x\": {{s[2]}}, \"y\": {{s[3]}} }, \"pD\": { \"x\": {{s[0]}}, \"y\": {{s[3]}} } }, \"iterations\": 1}{%if not loop.last%},{%endif%}{%endfor%}]}"}'
Template variable warning: str object has no element 3 when rendering '{"topic":"valetudo/dreame/ZoneCleaningCapability/start/set","payload":"{\"zones\": [{%for s in ('[\"1\"]')|from_json %}{ \"points\": {\"pA\": { \"x\": {{s[0]}}, \"y\": {{s[1]}} }, \"pB\": { \"x\": {{s[2]}}, \"y\": {{s[1]}} }, \"pC\": { \"x\": {{s[2]}}, \"y\": {{s[3]}} }, \"pD\": { \"x\": {{s[0]}}, \"y\": {{s[3]}} } }, \"iterations\": 1}{%if not loop.last%},{%endif%}{%endfor%}]}"}'
Checklist
The problem
I am configuring a Valetudo Map Card and everything seems to work fine, including the imported segments. However, when adding a Predefined Goto, using the example from the manual, I am getting a
undefined is not an object (evaluating 'i.id.toString')
error. This is because of a missingid
attribute, which the manual does not actually mention. However, after adding said attribute, I am getting no reaction from the robot itself. Again, the predefined rooms work just fine.Relevant config piece:
The service call for the Goto location defined as above is:
As you can notice, the coordinates are empty. I am not sure if this is related to the
id
thing or is a different issue altogether. Also note that while I am passing the- position: [ 28006, 28036 ]
in YAML editor, its format gets changed to what you see above upon saving.What version of a card has described problem?
v2.2.2
What was the last working version card?
No response
What vacuum model do you have problems with?
roborock.s5
Which integration do you use to control your vacuum (link)?
https://www.home-assistant.io/integrations/mqtt/
What browser (browsers/apps) does have this problem?
Safari
What version of Home Assistant do you use?
2024.3.3
What type of installation are you running?
Home Assistant OS
Card's configuration
Javascript errors shown in the browser's console (if applicable)
No response
Additional information
No response