Skip to main content

Crowd Flow Heatmap with Home Assistant

Want a clear view of how people move through a space? With Home Assistant and a Floorplan Heatmap, you can do just that. This solution lets you overlay person-hour data onto your floor plan, making it easy to see how the space is being used at a glance.

Home Assistant not only collects and manages data from various devices but also seamlessly connects with other platforms through its powerful integration features. By integrating a heatmap plugin, you can directly use existing device data. If your devices are already connected to Home Assistant, you can easily incorporate their data into a visual chart. This simplifies the setup process and maximizes the utility of your existing smart home ecosystem.

note

A Floorplan Heatmap is a technique that visualizes data on top of a building floor plan or indoor layout. It uses a color scale from cool (like blue, green) to warm (like yellow, red) to show the intensity, density, or frequency of data in specific areas. For example, it can show how frequently a room is occupied or the temperature distribution in a particular area.

Heatmap Visualization

Person-Hour Statistics Example

You will need:

Grove Vision AI V2

  1. Go to the SenseCraft AI platform, log in, and under "Vision Workspace," click on "Grove Vision AI V2" and select Connect.
  2. In the pop-up window, choose the Grove Vision AI V2 device you want to connect.
Connect Grove Vision V2

Flashing the Model

Select an appropriate model. If you are not doing face or person detection, you might need to flash a model that can recognize human features. For example, select Face Detection and confirm to deploy it.

SenseCraft AI Model Face Detection

Double-click the model and confirm to flash and deploy it.

Configure Network Information

  1. On the main panel, click Network Configuration on the right.
  2. Enter your Home Assistant's Wi-Fi information and the MQTT server address (usually HA address:1883).
  3. Click Save.
note

Be sure to note down the Client ID (you can customize it) for later use.

SenseCraft Wi-Fi Configuration

Node-RED

Since the Grove Vision AI V2 is a non-standard device, we currently need to use Node-RED to handle device registration and data display.

First, you need to import the person-hour-statistics.json file into Node-RED, then continue with the steps below:

1
Confirm MQTT Configuration

Modify the service information in the "Publish HA Data & Discovery" node to your Home Assistant address (e.g., 192.168.101.160). If you are using the built-in Node-RED add-on in Home Assistant, connect to mqtt://localhost.

Node-RED MQTT Out Config
2
Modify Device ID

In the "Know Camera IDs" node, modify the payload JSON and add multiple client IDs if you have more than one device.

Node-RED Heatmap Device IDs
3
Register Device

Click "Trigger HA Discovery for Known Devices" to register the device. You should then see an unavailable device entity on the overview page.

Home Assistant Heatmap Device Added
4
View Data

Set the msg.topic of the "Start" node to grove_vision_ai_v2_61003e7c, then click Start. Once done, you can view the data in Home Assistant.

Home Assistant Heatmap Device Worked

Home Assistant

Install Plugin (HACS)

Go to your HACS page, for example, http://homeassistant.local:8123/hacs/dashboard:

HACS Custom Repositories

In HACS, add a Custom repository and enter the following address:

https://github.com/Seeed-Solution/lovelace-heatmap-card
HACS Add Repository

Search for "Heatmap Card" and download the plugin:

HACS Search and Download

After installation, you will need to reload your browser. Click RELOAD in the prompt.

Add Card to Dashboard

In any dashboard, add your heatmap card. For example, let's edit a dashboard named Person-Hour Statistics.

Home Assistant Edit Panel
Home Assistant Add Card

Click "Add Card," scroll down to the custom cards section, find Heatmap Card, and click to add it.

Home Assistant Choose Card

Connect Data

Lovelace Heatmap Card Config

The plugin has four configuration sections:

  • Color Style (Radius, Blur)
  • Points - Coordinates and information for different points
  • Display Options - Show data legend
  • Show Point Labels - Show labels for each point

In the card configuration, set the entity_id for one of the Points to your device entity ID (e.g., sensor.grove_vision_ai_v2_61003e7c_current_people_count).

Once done, click Save.


After completing these steps, you will be able to see the heatmap data dynamically displayed in Home Assistant.

Loading Comments...