PiotrMachowski / lovelace-xiaomi-vacuum-map-card

This card provides a user-friendly way to fully control map-based vacuums in Home Assistant. Supported brands include Xiaomi (Roborock/Viomi/Dreame/Roidmi/Valetudo/Valetudo RE), Neato, Wyze, Roomba, Ecovacs (and probably more).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

select preset

guensen0 opened this issue · comments

Description

Hi,

perfect work! I have 3 presets in my vacuum card and if I selected one of the additional presets and go to another view and back the card automatically jumps back to the 1st preset (keeping the map and specific floor dependent button cards). In principle everything works, just the fact that the selection if not synchronized... for example, to get back to 1st preview, you have to go to another preview and back... kind of cosmetic issue, but still raising questions in family ;-)
I have a variable that defines which floor is loaded, so I could jump easily to the current tab, if there would be a option (or may I have overseen something?)

Solution

option to select which preset should be shown...

Alternatives

No response

Context

No response

You can configure conditions section for every preset, will this resolve your problem?

not really... as I understand that would allow to show the card page that is currently used, but how to go to another page then? Only option: 3 additional buttons that reset the variable, but the question is whether the card then reload?

Can you show your current config?

for the whole card?

Part related to switching presets should be enough

this is the main card:

cards:
          - type: custom:xiaomi-vacuum-map-card
            title: ''
            preset_name: EG
            entity: vacuum.roborock_s5_max
            activate_on_switch: true
            activate:
              service: script.vac_test
              service_data:
                map: '0'
            vacuum_platform: default
            map_locked: true
            ...

the 2nd card:

	additional_presets:
              - preset_name: Obergeschoss (Vorn)
                entity: vacuum.roborock_s5_max
                activate_on_switch: true
                activate:
                  service: script.vac_test
                  service_data:
                    map: '2'
		map_source:
                  camera: camera.xiaomi_cloud_map_extractor

that's the script that is called:

alias: Vac_Test
fields:
  map:
    description: Which Map to select
    example: 1
sequence:
  - service: vacuum.send_command
    data:
      command: load_multi_map
      params: "{{ map }}"
    target:
      device_id: xxxxxxx
  - service: python_script.set_state
    data:
      entity_id: sensor.vac_map
      state: "{{ map }}"
mode: single

i call the script with map: 0 or 2 or 3 for the different floors
it loads the corresponding map and set the sensor.vac_map to the same value
That value is used for selection of buttons and scripts on the page.
Screenshot 2023-05-03 at 20 55 06
Screenshot 2023-05-03 at 20 55 25

so far works well, but when I switch to an
Screenshot 2023-05-03 at 20 58 20
other view and back it is still shows the right floor, but the card is in 1st position.

Ok, at this moment my suggestion would be to add conditions to all 3 presets (including default one) and add 2 icons to every preset (to change a map to a different one).

Ok, at this moment my suggestion would be to add conditions to all 3 presets (including default one) and add 2 icons to every preset (to change a map to a different one).

but is the card updating automatically?

Yes, when you add conditions the preset will be chosen automatically

ok... then I will try that next days... thanks for your time.

works like a charm

Screenshot 2023-05-04 at 20 51 31

Looks good 👍