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).
MIT License
1.48k stars 254 forks source link

Unable to Press Start on Tizen Browser #411

Open benchristian88 opened 2 years ago

benchristian88 commented 2 years ago

Checklist

The problem

Vacuum Card installed, and working well on Xiaomi 1C, with call_actions, for both zone and room cleanup. Works well on browsers, phone, ha app, but unable to initiate Zone or Room cleaning on Samsung Home Hub fridge browser, running Tizen 6.0. first world problem I know, but would be good if I can somehow get it working. All other buttons work, just not the button to start zone or room cleanup. All other HA buttons work, using full mushroom cards, and standard cards. they all work fine.

What version of a card has described problem?

2.0.11

What was the last working version card?

No response

What vacuum model do you have problems with?

dreame_mb1808

Which integration do you use to control your vacuum (link)?

custom

What browser (browsers/apps) does have this problem?

tizen 6.0

What version of Home Assistant do you use?

core-2022.6.2

What type of installation are you running?

Home Assistant OS

Card's configuration

type: custom:xiaomi-vacuum-map-card
map_source:
  camera: camera.xiaomi_cloud_map_extractor
calibration_source:
  camera: true
entity: vacuum.dreame_mb1808_048e_robot_cleaner
tiles:
  - label: Charging State
    entity: sensor.dreame_mb1808_048e_charging_state
    icon: mdi:vacuum
  - label: Battery
    entity: sensor.dreame_mb1808_048e_battery_level
    icon: mdi:battery
    unit: '%'
  - label: Filter time
    entity: sensor.dreame_mb1808_048e_filter_left_time
    icon: mdi:air-filter
    unit: h
  - label: Filter Life
    entity: sensor.dreame_mb1808_048e_filter_life_level
    icon: mdi:air-filter
    unit: '%'
  - label: Main Brush Left
    entity: sensor.dreame_mb1808_048e_brush_left_time
    icon: mdi:brush
    unit: h
  - label: Main Brush Life
    entity: sensor.dreame_mb1808_048e_brush_life_level
    icon: mdi:brush
    unit: '%'
  - label: Side Brush Left
    entity: sensor.dreame_mb1808_048e_brush_left_time_2
    icon: mdi:brush
    unit: h
  - label: Side Brush Life
    entity: sensor.dreame_mb1808_048e_brush_life_level_2
    icon: mdi:brush
    unit: '%'
vacuum_platform: send_command
map_locked: true
map_modes:
  - template: vacuum_clean_zone
    max_selections: 1
    repeats_type: EXTERNAL
    max_repeats: 5
    service_call_schema:
      service: xiaomi_miot.call_action
      service_data:
        entity_id: vacuum.dreame_mb1808_048e_robot_cleaner
        siid: 18
        aiid: 1
        params:
          - piid: 1
            value: 19
          - piid: 21
            value: '{"areas":[[[[selection_unwrapped]],[[repeats]],1,1]]}'
        force_params: true
  - template: vacuum_clean_segment
    max_selections: 1
    repeats_type: EXTERNAL
    max_repeats: 3
    service_call_schema:
      service: xiaomi_miot.call_action
      service_data:
        entity_id: vacuum.dreame_mb1808_048e_robot_cleaner
        siid: 18
        aiid: 1
        params:
          - piid: 1
            value: 18
          - piid: 21
            value: '{"selects":[[[[selection_unwrapped]],[[repeats]],3,3,1]]}'
        force_params: true
    predefined_selections:
      - id: 7
        label:
          text: Movie Room
          x: 4325
          'y': -10650
          offset_y: 35
        icon:
          name: mdi:movie-play
          x: 4325
          'y': -10650
      - id: 8
        label:
          text: Movie Hall
          x: 1150
          'y': -3450
          offset_y: 35
        icon:
          name: mdi:movie-roll
          x: 1150
          'y': -3450
      - id: 5
        label:
          text: Guest Room
          x: -1000
          'y': -725
          offset_y: 35
        icon:
          name: mdi:bed
          x: -1000
          'y': -725
      - id: 6
        label:
          text: Cat Wheel
          x: 1925
          'y': 5650
          offset_y: 35
        icon:
          name: mdi:ferris-wheel
          x: 1925
          'y': 5650
      - id: 4
        label:
          text: Guest Bath
          x: -1100
          'y': 3800
          offset_y: 35
        icon:
          name: mdi:shower
          x: -1100
          'y': 3800
      - id: 3
        label:
          text: Day Room
          x: -1525
          'y': 7575
          offset_y: 35
        icon:
          name: mdi:chair-rolling
          x: -1525
          'y': 7575
      - id: 2
        label:
          text: Cat Room
          x: 125
          'y': 11975
          offset_y: 35
        icon:
          name: mdi:cat
          x: 125
          'y': 11975
      - id: 1
        label:
          text: Sleigh Room
          x: 3775
          'y': 11950
          offset_y: 35
        icon:
          name: mdi:bed
          x: 3775
          'y': 11950

Javascript errors shown in the browser's console (if applicable)

unable to obtain on fridge browser

Additional information

No response

PiotrMachowski commented 2 years ago

Woah, that will be hard to reproduce on my side fridge 😃

Are you able to select anything on the map? What do you exactly mean that this button doesn't work? Does any popup appear?

By the way, I have seen that you have tried to add your config to MIoT configs list, but finally you have removed it, why? You can add it and I will adjust anything if necessary

benchristian88 commented 2 years ago

yes, can select a room, by clicking the icon, can zoom the map, can select a custom zone, everything seems to work, from a selection perspective, just when I try then to press the start button on the right hand side of the card nothing happens. No confirmation message that the service was called etc. nothing. but works fine on browser or phone/ha app.

re config, I couldnt add as code, and I wasnt happy pasting like that. noob error. added again. thx

PiotrMachowski commented 2 years ago

Can you try if anything works when you add run_immediately to your config?

    max_selections: 1
    repeats_type: EXTERNAL
    max_repeats: 3
    run_immediately: true
    service_call_schema:
    ...

No problem, I will sort everything out. Can you just provide "user-friendly name" of your vacuum as well?

benchristian88 commented 2 years ago

will give that a go

No problem, I will sort everything out. Can you just provide "user-friendly name" of your vacuum as well?

Added to miot config now.

PiotrMachowski commented 2 years ago

Added to miot config now.

Everything updated to look nice and consistent 👍

benchristian88 commented 2 years ago

Gave it a whirl. Works fine on the phone or browser, but on the tizen browser on the fridge, get a message saying no selected items, so appears that the script isn’t passing the selection to the action. Didn’t realise that the zone selection is having the same issue too. Can create a manual zone, but when attempt to press go it says there is nothing selected. There aren’t any logs I can see so can’t really get any more info. Going to be tricky I get that

PiotrMachowski commented 2 years ago

That's really, really weird... Can you check if template: vacuum_goto has the same problem?

PiotrMachowski commented 2 years ago

@benchristian88 can you check out if version from this build works?

benchristian88 commented 2 years ago

absolutely will give it a go. except i dont know how.? sorry, I am a little inexperienced at github . any tips and i will try

PiotrMachowski commented 2 years ago

Assuming that you have installed this card using HACS:

  1. Remove contents of /config/www/community/lovelace-xiaomi-vacuum-map-card (js and gz file)
  2. Download this file
  3. Unzip downloaded file and upload js file to /config/www/community/lovelace-xiaomi-vacuum-map-card
  4. Clean cache or change resources URL - add ?v=2.1.0-beta (recommended)
  5. You should be able to notice that card has been updated by checking icon for resetting map zoom (it should be changed to mdi:image-filter-center-focus) or card's editor image
PiotrMachowski commented 2 years ago

@benchristian88 Have you managed to test it?

benchristian88 commented 2 years ago

hi, have just tested now, and still doesnt work on the samsung fridge which has the tizen browser. all good elsewhere though.

chikehe commented 2 years ago

i have the same issue with my old cellphone that stuck with android9. it seems to be a webview related problem

FHeilmann commented 2 years ago

I think I'm seeing the same issue on an old fire tablet using fully kiosk. The play button in the icon list works, just the one next to the repetition selector doesn't. (the repetition button and plus button when in zone edit work fine)

PiotrMachowski commented 2 years ago

@FHeilmann can try you to check if there are some errors in console? https://developer.chrome.com/docs/devtools/remote-debugging/

FHeilmann commented 2 years ago

Unfortunately the error does not show in a reasonably up-to-date chrome (95.x), it only shows in fully-kiosk for me.

Nevermind, here's a log of the error that gets thrown when I click on the not-working play button:

(contents here:

xiaomi-vacuum-map-card.js?hacstag=193372044212:44 Uncaught (in promise) TypeError: JSON.stringify(...).replaceAll is not a function
    at Function.getDefaultVariables (xiaomi-vacuum-map-card.js?hacstag=193372044212:44)
    at vo.apply (xiaomi-vacuum-map-card.js?hacstag=193372044212:44)
    at ho._applyData (xiaomi-vacuum-map-card.js?hacstag=193372044212:44)
    at ho.getServiceCall (xiaomi-vacuum-map-card.js?hacstag=193372044212:44)
    at HTMLElement._run (xiaomi-vacuum-map-card.js?hacstag=193372044212:1052)
    at HTMLElement.<anonymous> (xiaomi-vacuum-map-card.js?hacstag=193372044212:1052)
    at Z.handleEvent (xiaomi-vacuum-map-card.js?hacstag=193372044212:17)
    at ce (xiaomi-vacuum-map-card.js?hacstag=193372044212:44)
    at xiaomi-vacuum-map-card.js?hacstag=193372044212:294
getDefaultVariables @ xiaomi-vacuum-map-card.js?hacstag=193372044212:44
apply @ xiaomi-vacuum-map-card.js?hacstag=193372044212:44
_applyData @ xiaomi-vacuum-map-card.js?hacstag=193372044212:44
getServiceCall @ xiaomi-vacuum-map-card.js?hacstag=193372044212:44
_run @ xiaomi-vacuum-map-card.js?hacstag=193372044212:1052
(anonymous) @ xiaomi-vacuum-map-card.js?hacstag=193372044212:1052
handleEvent @ xiaomi-vacuum-map-card.js?hacstag=193372044212:17
ce @ xiaomi-vacuum-map-card.js?hacstag=193372044212:44
(anonymous) @ xiaomi-vacuum-map-card.js?hacstag=193372044212:294
async function (async)
(anonymous) @ xiaomi-vacuum-map-card.js?hacstag=193372044212:1052
handleEvent @ xiaomi-vacuum-map-card.js?hacstag=193372044212:17
ce @ xiaomi-vacuum-map-card.js?hacstag=193372044212:44
(anonymous) @ xiaomi-vacuum-map-card.js?hacstag=193372044212:294
setTimeout (async)
i @ xiaomi-vacuum-map-card.js?hacstag=193372044212:294

err.log

Seems like there's an easy fix for such issues:

https://www.designcise.com/web/tutorial/how-to-fix-replaceall-is-not-a-function-javascript-error

PiotrMachowski commented 2 years ago

great, thank you

mgabor3141 commented 1 year ago

@PiotrMachowski Thank you for your work on this card. I had the same issue that others are describing on my wall mounted kiosk tablet, so I went ahead and fixed the issue and opened a PR. There should be no functional changes. Please take a look, and let me know if I can help with anything else.

PiotrMachowski commented 1 year ago

@benchristian88 @snios can you check out if v2.2.0-beta.1 works on your device?

Raabi91 commented 1 year ago

@benchristian88 @snios can you check out if v2.2.0-beta.1 works on your device?

its not working for me amazon fire hd with fully kiosk browser on android 5.1

PiotrMachowski commented 1 year ago

Does the problem still exist in v2.2.0?

Raabi91 commented 1 year ago

for me it is still present with the above device

snios commented 1 year ago

@benchristian88 @snios can you check out if v2.2.0-beta.1 works on your device?

its not working for me amazon fire hd with fully kiosk browser on android 5.1

Sorry for the late Reply. I had a temporary fix for this issue locally (not a fix that would work for everyone). And then i dicided to take my Xiaomi off the cloud and flashed it with Valetudo instead so o can't actually test this anymore I'm sad to say.