• March 11, 2024

Integrating HibouAir with ThingsBoard

HibouAir, an advanced air quality monitoring device, offers real-time data on critical parameters including CO2 levels, particulate matter (PM 1.0, PM 2.5, PM 10), pressure, temperature, humidity, volatile organic compounds (VOCs), and noise levels. In this guide, we will explore how effortlessly HibouAir can be integrated into the ThingsBoard IoT platform, providing users with comprehensive visualization and monitoring capabilities for their indoor air quality.

Why ThingsBoard?

ThingsBoard is an open-source IoT platform that enables users to collect, store, visualize, and analyze data from connected devices in real-time. With its user-friendly interface and flexible architecture, ThingsBoard is an ideal choice for various IoT applications, including environmental monitoring. Its extensive features, such as device management, data processing, rule engine, and customizable dashboards, make it a preferred platform for building scalable and customizable IoT solutions.

Integration Process:

Hardware Requirements:

Integration Steps:

  1. Install the BleuIO Python library:
    First, we need to install the BleuIO Python library, which allows us to interact with the BleuIO USB dongle. You can install it using pip:
    pip install bleuio
  2. Scan for nearby BLE devices:
    from bleuio_lib.bleuio_funcs
    import BleuIO
    import time
    my_dongle = BleuIO()
    my_dongle.at_central()
    my_dongle.at_findscandata('220069') # Replace '220069' with the device ID time.sleep(3)
    my_dongle.stop_scan()
  3. Decode the advertised data
    last_element = my_dongle.scan_data[-1]
    data_part = json.loads(last_element[0])['data']
    last_part = data_part.split(',')[-1].strip('"}')
    decoded_env_data = adv_data_decode(last_part)
  4. Send data to ThingsBoard
    import requests api_endpoint = 'https://thingsboard.cloud/api/v1/YOUR_API_KEY/telemetry'
    response = requests.post(api_endpoint, json=decoded_env_data)
    if response.status_code == 200:
    print("Data sent successfully to ThingsBoard.")
    else:
    print("Failed to send data to ThingsBoard. Status code:", response.status_code)

Decoding Advertised Data

The advertised data contains encoded air quality data. We’ve implemented a function called adv_data_decode to decode this data based on the HibouAir datasheet. The decoded data includes parameters such as temperature, humidity, CO2 levels, etc.

Integration with ThingsBoard

We use the ThingsBoard cloud platform to visualize and monitor the air quality data. We send the decoded data to ThingsBoard via a POST request to the Telemetry API endpoint. If the request is successful, we receive a confirmation message.

ThingsBoard setup

We have created a device called HibouAir and added pressure , temperature , co2, humidity widget attribute on my dashboard and this is how my dashboard looks. we can see latest data ( data updated 1 mins ago)

Code

Complete code is available on the following repository

https://github.com/smart-sensor-devices-ab/thingsboard-ble-integration

Output

The dashboard can be visited using the following link
https://thingsboard.cloud/dashboard/d54a76c0-d150-11ee-a550-01ba59c8406a?publicId=efae7c90-d151-11ee-a922-37ae9eb95d8c

With the seamless integration of HibouAir with ThingsBoard, users can effortlessly monitor and visualize air quality data in real-time. By leveraging the power of open-source IoT platforms like ThingsBoard, environmental monitoring solutions become more accessible and scalable. Whether for residential, commercial, or industrial applications, HibouAir combined with ThingsBoard offers a robust solution for ensuring optimal indoor air quality.

Begin monitoring your indoor air quality with HibouAir and ThingsBoard today!

Share this post on :

Contact Us

Call us or simply fill out the form below, and one of our representatives will get back to you as soon as possible.