Hypfer / lovelace-valetudo-map-card

Display the map from a valetudo-enabled robot in a home assistant dashboard card.
MIT License
254 stars 35 forks source link

request for turning option name vacuum back to entity #110

Closed Klabost closed 2 years ago

Klabost commented 2 years ago

Hello, instead of providing the vacuum name can we go back to providing the entity name of the map itself. The getMapEntityName makes some assumptions about the naming scheme that aren't true by default (at least not for me). I posted the function below which is the culprit. getMapEntityName(vacuum_name) { return "camera." + vacuum_name + "_map_data"; } My map entity was just called camera.map_data so the card didn't display anything after the update. I got it working after changing the entity name but I only figured this out after looking at the source code which isn't the end of the world but it shouldn't be necessary.

TheLastProject commented 2 years ago

The assumption IS true by default for recent Home Assistant versions, as written in the release notes.

But yes getting the option back to override this was requested by multiple people.

Klabost commented 2 years ago

ah so home assistant and their breaking changes strike again. Thank you for letting me know. Maybe you can make it so that it uses either vacuum or entity, I do not know if that is a lot of work.

wimb0 commented 2 years ago

I'd like to have this option as well. My map entity is also still named camera.map_data, after updating the card (and vacuum).

TheLastProject commented 2 years ago

My map entity is also still named camera.map_data, after updating the card (and vacuum).

That is only the case if you didn't read the release notes.

wimb0 commented 2 years ago

I did those steps. (That is how I got here. Broken card after update, read release notes, follow steps, check issues because steps not working) Deleted the vacuum from Home Assistant. I see the vacuum and map re-appear when turning off/on mqtt on the vacuum. It always comes back as camera.map_data. As a workaround, I manually changed the entity as @Klabost wrote, that seems to work, but it still would be nice to have this option added back again.

eifinger commented 2 years ago

I also followed the instructions. I also tried:

  1. Remove device in Homeassistant
  2. Turn off MQTT on Vacuum
  3. Restart Homeassistant
  4. Turn on MQTT on Vacuum

The camera entity appears again as camera.map_data

TheLastProject commented 2 years ago

And you are both certain you are running the latest version of Valetudo? Because if so I really cannot explain that behaviour.

Anyway, as with all requested features, I may get to it eventually but if you want it faster send in a pull request.

wimb0 commented 2 years ago

I do run: Valetudo on my Roborock S5: 2022.01.0 image

Map integration: v2022.01.2 image

Unfortunately I'm not that great with Javascript, so me trying to fix this would not be a good idea :-D.

eifinger commented 2 years ago

I just repeated the steps described in the release notes again. Same result. My versions: Valetudo image Homeassistant: image Valetudo Map Card: image

wimb0 commented 2 years ago

@eifinger You need to to upgrade your vacuum to Valetudo 2022.01.0 first. The newest Map card addon does not work with Valetudo versions older than 2022.01.0 anymore. See releasenotes https://github.com/TheLastProject/lovelace-valetudo-map-card/releases/tag/v2022.01.0

eifinger commented 2 years ago

@wimb0 Thank you for pointing it out. Here is why I didn't realize it:

  1. HACS notified me that the valetudo map card has a new release
  2. I installed the new release and saw the instructions.
  3. I logged into my Valetuo and did click the button to check for new releases, I installed it and was under the impression that I am under the newest release. I didn't realize it only upgraded from 2021.11.0 to 2021.11.1
  4. Still under the impression I am on the latest release I came here
  5. I now iterated through the updater to get to the latest release, repeated all steps and can confirm it is now working
TheLastProject commented 2 years ago

Good it's working for you at least.

It's really ironic how that went, given Valetudo was changed to only update 1 release at a time because... people kept not reading the release notes properly and complaining about things being broken when they skipped releases 😓

eifinger commented 2 years ago

I understand the dilemma and am sorry I piled onto that as well. When I have an idea on how the update process can be handled "more user friendly" I will share it 😉