Skip to content

TheRealWaldo/thermal

Repository files navigation

Thermal Vision

hacs GitHub Release GitHub Activity License

The Thermal Vision integration allows for the use of Thermal Imaging sensors in Home Assistant.

These can be used to detect humans much more reliably than motion sensors as do not require the subject to be moving. They also produce a pretty thermal camera image!

Me, waving

This is a rework of eyalcha/thermal that corrects a number of issues, makes it compatible with HA 2016.6 forward, and adds new functionality.

Differences

This is may not be a complete list:

Installation

There is three options to install this integration; HACS is the easiest.

INSTALLATION VIA HACS

Just go into the HACS Integrations section, search for the "Thermal Vision" repository, then click Install!

MANUAL INSTALLATION VIA HACS

Follow the instructions at https://hacs.xyz/docs/faq/custom_repositories/ using the URL https://github.com/TheRealWaldo/thermal

MANUAL INSTALLATION

  1. Download the zip file from latest release.
  2. Unpack the release and copy the custom_components/thermal_vision directory into the custom_components directory of your Home Assistant installation.
  3. Configure the thermal_vision sensor and/or camera.
  4. Restart Home Assistant.

Configuration

Camera

# Example configuration.yaml entry

camera:
  - platform: thermal_vision
    host: http://192.168.0.10

Main Options

Parameter Required Description
platform Yes Platform name thermal_vision
name No Friendly name Default: Thermal Vision
host Yes IP address or hostname of your Thermal sensor server
pixel_sensor Required if host is not set; sensor containing the base64 encoded pixels
verify_ssl No Verify SSL or not Default: false
width No Image width in pixels Default: 640
height No Image height in pixels Default: 640
preserve_aspect_ratio No Preserve aspect ratio (ignores height) Default: true
rotate No Rotate image Default: 0
mirror No Mirror image true / false Default: false
format No Camera image format (jpeg, png) Default: jpeg
min_temp No Min temperature Default: 26
max_temp No Max temperature Default: 32
auto_range No Rather than use a static minimum and maximum temperature, auto adjust based on the content Default: false
min_diff No Minimum difference when auto-ranging. Favors cold. Default: 4
sensor No Sensor related configurations (see below)
interpolate No Interpolation related configurations (see below)
cold_color No Cold color Default: indigo
hot_color No Hot color Default: red
session_timeout No Timeout in seconds for polling Thermal sensor server Default: 2
overlay No Add an overlay to the image to visualize min/max temperature Default: false

Interpolate

Parameter Required Description
method No Interpolation method (bicubic, linear, disabled) Default: bicubic
rows No Number of rows in interpolated data Default: 32
cols No Number of columns of interpolated data Default: 32

Sensor

Parameter Required Description
rows No Number of rows in sensor data Default: 8
cols No Number of columns in sensor data Default: 8

State and Attributes

Attributes
Attribute Description
fps Approximate frames per second based on response time of sensor
min Minimum value represented by the cold_color in the image
max Maximum value represented by the hot_color in the image

Sensor

# Example configuration.yaml entry

sensor:
  - platform: thermal_vision
    host: http://192.168.0.10

Main Options

Parameter Required Description
platform Yes Platform name thermal_vision
name No Friendly name Default: Thermal Vision
host Yes IP address of your Thermal sensor server
verify_ssl No Verify SSL or not Default: false
scan_interval No Get raw data interval in seconds Default: 60
sensor No Sensor related configurations (see below)
roi No Sensor region of interest (see below)
state No Sensor state type (average, max, min, sensor_temp, person_detected (deprecated, use binary_sensor)) Default: average

Sensor

Parameter Required Description
rows No Number of rows in sensor data Default: 8
cols No Number of columns in sensor data Default: 8

ROI

Parameter Required Description
left No Left pixel index [0:cols-1] Default: 0
top No Top pixel index [0:rows-1] Default: 0
right No Right pixel index [0:cols-1] Default: 7
bottom No Bottom pixel index [0:rows-1] Default: 7

State and Attributes

State

The sensor state can be either average, max, min, or person_detected based on state in the configuration. It defaults to average.

Attributes

All values are affected by the ROI configuration.

Attribute Description
average Average temperature of all pixels in current capture
max Maximum temperature of all pixels in current capture
min Min temperature of all pixels in current capture
min_index The index where the min temperature was detected (1 Dimensional)
max_index The index where the max temperature was detected (1 Dimensional)
sensor_temp The temperature of the sensor itself (if the sensor provides it)
person_detected A boolean representing whether the sensor detected a person or not. Must use latest firmware! (deprecated, use binary_sensor)

Binary Sensor

# Example configuration.yaml entry

binary_sensor:
  - platform: thermal_vision
    host: http://192.168.0.10

Main Options

Parameter Required Description
platform Yes Platform name thermal_vision
name No Friendly name Default: Thermal Vision
host Yes IP address of your Thermal sensor server
verify_ssl No Verify SSL or not Default: false
scan_interval No Get raw data interval in seconds Default: 60

State and Attributes

State

Returns on when the sensor claims to detect a person, off when it does not. Device class is occupancy.

Sensor Hardware and Firmware

Sensors are based on a simple JSON interface.

Sensor Firmware
AMG8833 Firmware for a simple sensor using an ESP8266 (I'm using a D1 Mini) can built using TheRealWaldo/esp8266-amg8833. This firmware is still under development!

Also, there's an experimental implementation using ESPHome at TheRealWaldo/AMG8833-ESPHOME. You can leverage this by setting pixel_sensor to the sensor created by ESPHome and not using host. Note: this only works with the camera at this time.
MLX90640 Another PlatformIO project using an ESP32 and the MLX90640 cab be found at pixelsquared/thermal_vision-ESP32-MLX90640.

Known Issues

Interpolation only works with sensors that have even dimensions (i.e. 8x8, 64x64, etc.). A work-around is to disable interpolation:

camera:
  - platform: thermal_vision
    host: http://192.168.0.10
    sensor:
      rows: 24
      cols: 32
    interpolate:
      method: disabled