eyalcha / thermal

Thermal camera for Home Assistant
Apache License 2.0
32 stars 7 forks source link

Error while setting up thermal platform for sensor #1

Open SamKr opened 4 years ago

SamKr commented 4 years ago

First off; thank you @eyalcha for sharing this great platform!

However, I can't seem to get the Home Assistant integration working. The WEMOS works, the sensor works, however after adding the custom component (I tried HACS and manual installation), the following comes up in the logs:

Error while setting up thermal platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 178, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/config/custom_components/thermal/sensor.py", line 63, in async_setup_platform
    async_add_entities([ThermalSensor(hass, config)])
  File "/config/custom_components/thermal/sensor.py", line 84, in __init__
    self._rows = sensor.get(CONF_ROWS, DEFAULT_ROWS)
AttributeError: 'NoneType' object has no attribute 'get'

This is my sensor config:

sensor thermal:
  - platform: thermal
    host: http://192.168.40.162
    scan_interval: 2

And the camera config:

- platform: thermal
  host: http://192.168.40.162

I don't see any sensors, I do see the camera but it's just an indigo square.

Any idea what's causing this?

Edit: this is the output when getting /raw:

{"sensor":"AMG8833","rows":8,"cols":8,"data":"19.00,18.75,18.50,19.50,20.50,21.00,20.50,19.50,20.25,19.75,19.50,19.25,19.25,19.50,19.00,19.75,23.50,20.50,19.25,18.75,19.25,19.50,19.50,19.50,22.25,19.50,19.25,19.00,18.50,18.25,19.25,19.25,20.75,19.50,19.25,18.75,18.50,18.75,18.50,20.00,19.50,19.00,18.75,19.00,18.50,18.00,19.00,18.00,19.00,19.25,18.75,19.00,18.50,18.50,18.25,19.00,19.25,18.75,18.00,18.25,18.25,18.00,18.00,18.25"}
SamKr commented 4 years ago

I found a workaround: the issue lies in the code trying to get settings from configuration.yaml, even though they’re not in the addon’s example minimal configuration.

After adding them, the sensor started working. This is my current config:

sensor thermal:
  - platform: thermal
    name: attic_thermal
    host: http://192.168.40.162
    scan_interval: 2
    sensor:
      rows: 8
      cols: 8
    roi:
      left: 0
      top: 0
      right: 7
      bottom: 7
    state: max