jcgoette / baby_buddy_homeassistant

This custom integration provides sensors for Baby Buddy API endpoints.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error while setting up babybuddy platform for sensor

JmactheAttack opened this issue · comments

Any ideas why my home assistant integration isn't connecting well with my babybuddy install? My babybuddy install was pulled via docker-compose yesterday (April 14th). Here are the stats of my HA install:

Home Assistant Version

Installation Version: core-2021.4.4
Installation Type: Home Assistant OS

HA configuration.yaml

sensor:
  - platform: babybuddy
    address: baby-dev.*********
    api_key: !secret babybuddy_api_key
    sensor_type:
    - sleep

HA Log Output

Logger: homeassistant.components.sensor
Source: custom_components/babybuddy/sensor.py:173
Integration: Sensor (documentation, issues)
First occurred: 11:17:39 AM (1 occurrences)
Last logged: 11:17:39 AM`

`Error while setting up babybuddy platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 205, 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/babybuddy/sensor.py", line 56, in setup_platform
    for entity in baby_buddy_data.entities_get():
  File "/config/custom_components/babybuddy/sensor.py", line 173, in entities_get
    children = session.get("children/").json()
  File "/usr/local/lib/python3.8/site-packages/requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.8/site-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python3.8/site-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

After adjusting the config some more I managed to find some success with this config in HA:

  - platform: babybuddy
    address: 192.168.3.56:8000
    api_key: !secret babybuddy_api_key
    ssl: false

Any idea why the original one wasn't working? The FQDN/hostname I used in the original config was valid and had a proper certificate.

I'm going to guess something wasn't correct with the address. It gave me NGINX denial when visiting, but I guess you could have IP filtering on.

FYI, I see you edited your post to hide the full address, but you should know the audit trail is still there.