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

Question: Help understanding Encoding of Rooms #5

Closed
TheChrisTech opened this issue Jan 16, 2021 · 1 comment
Closed

Question: Help understanding Encoding of Rooms #5

TheChrisTech opened this issue Jan 16, 2021 · 1 comment

Comments

@TheChrisTech
Copy link

Hello,

I'm working on my own integration into Hubitat, and am looking through your code. I'm not a professional at python, so I was hoping you could help explain the following method to me:

def _encode_room_list(self, rooms: List[str]):
    """Base64 encode the list of rooms to clean"""
    if not rooms:
        raise ValueError('Room list must not be empty')
    if len(rooms) > 3:
        raise ValueError('At most three rooms may be given')
    # These are a mystery to me, but they seem constant
    header = b'\x80\x01\x0b\xca\x02'
    footer = b'\x1a\x08155B43C4'

I do notice some unusual encoding around a possible value:
Calling "SET_Areas_To_Clean" via the App, it's sending this as the payload:

{"datapoint": {"value": "gAELygIXCgtMaXZpbmcgUm9vbRoINzZBODA1OEE="}}

Which base64 decodes to:

��ハ��
�Living Room��76A8058A

Any tips? I'm essentially going to be making a simple string to pass this on to the API using Groovy.

@TheChrisTech
Copy link
Author

I did end up figuring this out. Mine was a bit different in terms of footer, but was able to make it work.

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

No branches or pull requests

1 participant