jlamendo / ha-sensor.owlet

Owlet Smart Sock v2/v3 Sensor Integration for HomeAssistant using the modern Owlet API.
MIT License
81 stars 22 forks source link

Issue on HA: 2021.6.2 #5

Open JamieP83 opened 3 years ago

JamieP83 commented 3 years ago

Hey, getting this issue, ive only just tried to set this up, never had it working before.

HA: 2021.6.2

sensor:

## https://github.com/jlamendo/ha-sensor.owlet
  - platform: owlet
    username: !secret owletuname
    password: !secret owletpassword
    region: "world"
Logger: homeassistant.components.sensor
Source: custom_components/owlet/sensor.py:145
Integration: Sensor (documentation, issues)
First occurred: 20:48:01 (1 occurrences)
Last logged: 20:48:01

Error while setting up owlet platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/owlet/sensor.py", line 286, in setup_platform
    for SmartSockDSN in Owlet.devices:
  File "/config/custom_components/owlet/sensor.py", line 193, in devices
    self.get_devices()
  File "/config/custom_components/owlet/sensor.py", line 168, in get_devices
    r = self.api_get("/devices.json")
  File "/config/custom_components/owlet/sensor.py", line 145, in api_get
    headers={"Authorization": "auth_token " + self.__OWLET_TOKEN},
TypeError: can only concatenate str (not "tuple") to str
jlamendo commented 2 years ago

This is probably a result of an authentication error. I'll admit, the error checking on this isn't up to what I'd normally do - I wrote it in the early months of my kid's life when I was sleep deprived and short on time :D I'd recommend double checking to make sure that the "username" is the email address you use to log into your account and not any actual username.

florianwedler commented 2 years ago

I double checked, it is and was the email.

wesjdj commented 2 years ago

I double checked, it is and was the email.

If you're based in Europe, as I am, then you need to change the region value on the sensor to "europe". I had the same issue and resolved it by doing that, as mentioned in the mbevand/owlet_monitor repo readme :)