# Hardwario Home Assistant integration

**URL:** <https://forum.hardwario.com/t/hardwario-home-assistant-integration/683>\
**Category:** TOWER\
**Created:** [January 3, 2022, 4:28pm UTC](https://forum.hardwario.com/t/hardwario-home-assistant-integration/683 "2022-01-03T16:28:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarianRychtecky](https://forum.hardwario.com/user_avatar/forum.hardwario.com/marianrychtecky/32/626_2.png) [@MarianRychtecky](https://forum.hardwario.com/u/MarianRychtecky)\
**Post date:** [January 3, 2022, 4:28pm UTC](https://forum.hardwario.com/t/hardwario-home-assistant-integration/683/1 "2022-01-03T16:28:21Z")

</div>

Hi all,  
I started developing a simple add-on module for Home Assistant, able to use a USB radio gateway for Hardwario products.  
The kick-off version is available on my [GitHub](https://github.com/MarianRychtecky/ha-hardwario).

What I would like to discuss here, where is the best place for HA MQTT “autodiscovery” feature.

Here is how it works:  
HA is expecting MQTT special topic with JSON as configuration.

The autodiscovery topic

> \<discovery\_prefix\>//[\<node\_id\>/]\<object\_id\>/config

In my case I use:

> homeassistant/sensor/air-quality-monitor0-co2/monitor1/config

JSON payload

> { “name”: “CO2 Climate monitor 1”, “device\_class”: “carbon\_dioxide”, “state\_topic”: “node/air-quality-monitor:0/co2-meter/-/concentration”, “unique\_id”: “air-quality-monitor0-co2”, “unit\_of\_measurement”: “ppm” }

- The device class for sensors is [listed here.](https://www.home-assistant.io/integrations/sensor/)
- Unique\_id has to he unique identification of the element
- state\_topic is the MQTT topic as it is being sent to the MQTT broker

This MQTT message must be sent with the “retain” option set.

For me, it would make sense to build a custom script to send all auto-discover MQTT messages to the broker after startup, however, “state\_topic” needs to be known from the USB radio dongle for all paired devices. How we can get information from USB dongle about all paired devices and it’s topics including device type? Each device type can have hardcoded device classes and units of measurement, that could be used for auto-discover JSON build.

---

<div class="post-metadata">

**Author:** ![hub.martin](https://forum.hardwario.com/user_avatar/forum.hardwario.com/hub.martin/32/631_2.png) [@hub.martin](https://forum.hardwario.com/u/hub.martin)\
**Post date:** [January 4, 2022, 9:32am UTC](https://forum.hardwario.com/t/hardwario-home-assistant-integration/683/2 "2022-01-04T09:32:26Z")

</div>

Hi Marian,

there are few options how to get device type.

In the USB dongle’s EEPROM there is a list of paired nodes, and also aliases are saved there.  
Alias looks like `lcd-thermostat:0`, `lcd-thermostat:1`,… so it gives you some info what type of device you have. However if user renames this alias, you have no idea what this device is.

But `bcg` also displays `firmware`. This information is handled by `bcg` and it is cached in `bcg` config/cache. This firmware information is send after power-up of the node together with pairing command. So to have this information in `bcg` you have to at least once pair or reboot the node while the `bcg` is running so it will catch firmware type and save it.

You can get nodes by sending this mqtt command with null (or any) topic

```auto
2022-01-04 10:25:31.06 gateway/usb-dongle/nodes/get null

```

and you get response including `firmware` and `version`.

```auto
2022-01-04 10:25:31.07 gateway/usb-dongle/nodes [{"id": "294b9f639a4f", "alias": "lcd-thermostat:0", "firmware": "kit-lcd-thermostat", "version": "v1.4.0"}]

```

Unfortunately the node or dongle does not report or remembers what topics device responds. So this will have to be handled by your script. Most probably the script will have to look for firmware and based on that it will have table of topics that firmware reports and units.

---

<div class="post-metadata">

**Author:** ![MarianRychtecky](https://forum.hardwario.com/user_avatar/forum.hardwario.com/marianrychtecky/32/626_2.png) [@MarianRychtecky](https://forum.hardwario.com/u/MarianRychtecky)\
**Post date:** [January 4, 2022, 3:15pm UTC](https://forum.hardwario.com/t/hardwario-home-assistant-integration/683/3 "2022-01-04T15:15:43Z")

</div>

Excellent, thank you Martin.

Is there any list of available “firmware” and its corresponding values? This would make sense to implement an external script and send auto-discovery based on a static library.

---

<div class="post-metadata">

**Author:** ![hub.martin](https://forum.hardwario.com/user_avatar/forum.hardwario.com/hub.martin/32/631_2.png) [@hub.martin](https://forum.hardwario.com/u/hub.martin)\
**Post date:** [January 10, 2022, 8:21pm UTC](https://forum.hardwario.com/t/hardwario-home-assistant-integration/683/4 "2022-01-10T20:21:52Z")

</div>

There is no list of topics in firmwares. You have to check code for every project.

---

<div class="post-metadata">

**Author:** ![system](https://forum.hardwario.com/uploads/default/original/1X/02118f8ea2fa092e1079c087a048a84eb8a2b371.png) [@system](https://forum.hardwario.com/u/system)\
**Post date:** [April 12, 2022, 2:22am UTC](https://forum.hardwario.com/t/hardwario-home-assistant-integration/683/5 "2022-04-12T02:22:11Z")

</div>

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.
