mezz64 / pyEight

Python library to interface with the Eight Sleep API
MIT License
59 stars 15 forks source link

KeyError: 'rightUserId' #6

Closed ChromoX closed 5 years ago

ChromoX commented 5 years ago

Hello,

I've had the following issue for about 2 months. I was hoping it would fix itself, but it hasn't. Any ideas?

Home Assistant(v0.90.2) Config:

eight_sleep:
    username: !secret eight_username
    password: !secret eight_password
    partner: false

Error:

Traceback (most recent call last):
  File "/usr/src/app/homeassistant/setup.py", line 151, in _async_setup_component
    hass, processed_config)
  File "/usr/src/app/homeassistant/components/eight_sleep/__init__.py", line 103, in async_setup
    success = await eight.start()
  File "/usr/local/lib/python3.7/site-packages/pyeight/eight.py", line 102, in start
    await self.assign_users()
  File "/usr/local/lib/python3.7/site-packages/pyeight/eight.py", line 149, in assign_users
    if data['result']['rightUserId'] == self._userid:
KeyError: 'rightUserId'

Thanks!

mezz64 commented 5 years ago

Can you let me know if you're a single sleeper or if you have a partner and what side of the bed you sleep on? Looks like they might have changed up the API a bit depending on how things are configured.

ChromoX commented 5 years ago

I am a single sleeper. On the left side of the bed from the viewpoint of the foot of the bed. Another way to say it is the side of the sensor on my model.

EDIT: Maybe there was a right side at one point, but not anymore. Let me know any details I can provide to help you debug this.

data['result']:eight.py:149

{'ownerId': '<my id>', 'leftUserId': '<left id>'}
self._partner = True

That is the problem. On the app I have no partner. It asks if I would like to invite one.

I simply switched the side of the bed I was on one way and then the other. It seemed to have fix everything. You can close this issue.