Skip to content
This repository was archived by the owner on Dec 25, 2025. It is now read-only.

Add support for targeting a specific room [Testing Help Needed!]#13

Open
Mobius5150 wants to merge 1 commit intoajmarks:masterfrom
Mobius5150:feat/clean_room
Open

Add support for targeting a specific room [Testing Help Needed!]#13
Mobius5150 wants to merge 1 commit intoajmarks:masterfrom
Mobius5150:feat/clean_room

Conversation

@Mobius5150
Copy link
Copy Markdown

@Mobius5150 Mobius5150 commented Dec 30, 2021

Hi friend! Thanks for starting this library. I just got my vacuum and want to schedule per-room cleanings with Home Assistant so I finished reverse engineering how to select specific rooms.

I've added what I think is a pretty detailed description of the format in the code, so take a look at that. The short version is that the Areas_To_Clean property is a base64 encoded instruction string specifying the rooms to clean. The format is, roughly:

[Header]
    - 0x80 Control character (purpose unknown)
    - 0x01 Start of Heading
    - 0x0B Line Tabulation (I believe indicating that newline characters act as separators in the list)
    - 0xCA Control character (purpose unknown)
    - 0x02 Start of Text
    - <Byte indicating the length (in bytes) of the rest of the paylod>
[For each room to clean:]
    - Newline character
    - <Byte indicating the length of the name of the room to clean>
    - <Name of room to clean>
[Footer]
    - 0x1A Control character (purpose unknown)
    - <Byte indicating the length of the room list identifier - seems to always by 8 characters>
    - <Room list identifier>

The Room list identifier is the first string from the property value Robot_Room_List. I don't know its exact purpose but I'm guessing it identifies the room list being referenced in the robots map.

I need some help testing, so I've prepared a little script that lets you select one or more rooms to clean - I would appreciate if a few folks could try and let me know if it works for you! If it doesn't, please send me the output of the command including the identifier and the base64 generated.

from sharkiqpy import get_ayla_api, OperatingModes, Properties, PowerModes

USERNAME = 'me@email.com'
PASSWORD = '$7r0nkP@s$w0rD'

ayla_api = get_ayla_api(USERNAME, PASSWORD)
ayla_api.sign_in()

shark_vacs = ayla_api.get_devices()
shark = shark_vacs[0]
print(shark)

rooms = shark.get_room_list()

selected_rooms = []

while True:
    print('Selected rooms: ' + (", ".join(selected_rooms) if len(selected_rooms) > 0 else "<None>" ))
    print('Available rooms: ' + (", ".join(rooms)))
    print('Enter the room number you would like to add to the cleaning list: ')
    print("\n".join([f'\t{idx}: {val}' for idx, val in enumerate(rooms)]))
    print('\tc: Start Cleaning\n\nEnter your Selection: ')
    selection = input()
    if selection == 'c':
        shark.clean_rooms(selected_rooms)
        break
    else:
        try:
            selected_rooms.append(rooms[int(selection)])
            print('\n\n')
        except:
            print('\n🚨🚨 Oops, i didn\'t get that. Make sure you input a valid room index or the character "c" 🚨🚨')

I'll remove the print() statements in the code once a few people try things out and confirm it works.

Copy link
Copy Markdown

@TheLastFrame TheLastFrame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mobius5150 Tested it, combined it with my changes for Europe products and works perfectly!

@theonlyrealcolin
Copy link
Copy Markdown

Tested and working for me. I'm excited to get this implemented in HA

@Mobius5150
Copy link
Copy Markdown
Author

Thanks folks for testing! @ajmarks are you able to review/merge/publish?

@TheLastFrame TheLastFrame mentioned this pull request Mar 28, 2022
@funkybunch
Copy link
Copy Markdown

funkybunch commented Mar 30, 2022

@Mobius5150 This repo seems to be stale. A PR is open on the Home Assistant repo to change the upstream dependency to a fork that is actively maintained. Could you resubmit your PR to this new fork so we can get it merged in and add this feature to Home Assistant? https://github.com/JeffResc/sharkiq/

Should be plug & play for the most part.

@funkybunch
Copy link
Copy Markdown

@Mobius5150 bumping this - if you're able/available to copy this PR over to https://github.com/JeffResc/sharkiq/ that would be a huge help. Otherwise we'll put it on our backlog and migrate it over manually.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants