Custom Component: Thermal Vision

Thermal Vision

Thermal Vision integration (camera and sensor) which can connect to any Thermal IR sensor via simple REST API (see grideye example).

heatmap wemos_amg

Sensor Configuration Example

sensor:
  - platform: thermal
    name: Grideye
    host: http://192.168.0.10
    scan_interval: 5
    sensor:
      rows: 8
      cols: 8
    roi:
      left: 5
      top: 5
      right: 6
      bottom: 6
    state: average
4 Likes

Great work, especially with implementing it as a camera entity!

I have a few of these and I am currently just posting the 8x8 readings to HA through the websocket api with an Arduino sketch, and doing the calculations in the browser in javascript and drawing an image, but I am going to try your component now. Looks like I only need to adjust the json response a bit to your specifications.

I am using a room temperature sensor in the same room as reference for the min_temp which I feel works better than fixed values. Have you tried having the esp doing the bicubic calculation? I could only get a nearest neighbour algoritm to work.

@tjntomas THx :slight_smile:

I haven’t try to do any image interpolation on the edge at this stage although it is in my list. If you can share your nearest interpolation I can try to add it to my example scheme and extend the API. It can be used for viewing the thermal image in other tools, e.g., motion eye.

Ok, here is my code for the nearest neighbour. I am running it on a Nodemcu V3 which is a probably overkill.
https://pastebin.com/25L0zKRz

Thx!

Why the matrix is 15 and not 16?

The 16:th pixel would not have a nearest neighbour. pixels 1 and 2 are used to calculate the pixel inbetween and so on. In javascript, I loop through the algorithm 3 times and end up with a 113x113 matrix which looks quite good.

I opened a ticket here but perhaps for future reference it’s better off on these forums.


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?

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"}

Did you mod anything @tjntomas to get it to work?

In case anyone stumbles upon the same problem: the issue was 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

Where’s the arruino code for this?

It’s in the github repo in the first post, https://github.com/eyalcha/thermal/tree/master/examples/grideye

Yeah found it!

can you help me understand how to configure this sensor?

Hi, i’m very noob … and I’m trying to compile the nodemcu v3 vía ESPHome, but I don’t receive any data from the sensor ( I wired SCL to D1 and SDA to D2 ). Pls, could you explain me how did you do it work ??.

Thanks in advance, regards.

P.D: ( Sorry for my English )

Hi, pls, could you explain me how you compile the Esp8266 for integration with home assistant and get data from the AMG8833 ?.

Thanks in advance !!. Regards.

What is your experience with this component? I tested the sensor and it doesn’t seem to detect at a distance of 3-5 m. The temperature changes somewhere around 1m and less.

Would I be able to measure leaf temperatures from 0.4-2m away with this?
Or is there another good option for something like this? Regards