Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SharkIQ new "clean_room" service uses area id to match #117277

Open
FSuman opened this issue May 11, 2024 · 3 comments
Open

SharkIQ new "clean_room" service uses area id to match #117277

FSuman opened this issue May 11, 2024 · 3 comments

Comments

@FSuman
Copy link

FSuman commented May 11, 2024

The problem

When trying to use the new service clean_room introduced in 2511a9a, it will try to match the desired areas (list of Home Assistant areas) against the room list set up in Shark Clean app, but it uses the area id instead of using the area name.

Example:
I have a Home Assistant area: id="kitchen" name="Kitchen". And the name in the Shark Clean app is "Kitchen". It will only work if I rename it in Shark Clean to "kitchen", lowercase.
Same thing happens with "Master Bedroom", which needs to be renamed to "master_bedroom" in Shark Clean for it to work.

What version of Home Assistant Core has the issue?

core-2024.5.3

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

SharkIQ

Link to integration documentation on our website

https://www.home-assistant.io/integrations/sharkiq/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

Hey there @JeffResc, @funkybunch, mind taking a look at this issue as it has been labeled with an integration (sharkiq) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of sharkiq can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign sharkiq Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


sharkiq documentation
sharkiq source
(message by IssueLinks)

@FSuman
Copy link
Author

FSuman commented May 11, 2024

I now see that there was a lot of discourse in #89350 about this already.

Have you considered simply checking if the area name is in the rooms list if the area id is not found

Something like

    async def async_clean_room(self, rooms: list[str], **kwargs: Any) -> None:
        """Clean specific rooms."""
        areas = AreaRegistry(self.hass)

        rooms_to_clean = []
        valid_rooms = self.available_rooms or []
        for room in rooms:
            if room in valid_rooms:
                rooms_to_clean.append(room)
                continue

            # Check if area name matches
            if room_area := areas.async_get_area(room):
                if room_area.name in valid_rooms:
                    rooms_to_clean.append(room)
                    continue

            raise ServiceValidationError(
                translation_domain=DOMAIN,
                translation_key="invalid_room",
                translation_placeholders={"room": room},
            )

        LOGGER.debug("Cleaning room(s): %s", rooms_to_clean)
        await self.sharkiq.async_clean_rooms(rooms_to_clean)
        await self.coordinator.async_refresh()

Not sure if it actually works, but can take it further if there is interest to support this.

@grainsoflight
Copy link

Im having a similar issue, but I am unable to change the names in the Shark app, it simply provides me with pre-created labels, so I am unable to get rooms to work at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants