Home Assistant

Two-way bridge

Home Assistant (HA) is a common upstream of OpenSense for prosumers with their own smart-home setup. Two integration directions:

  1. HA → OpenSense — HA reads sensors (Zigbee, Z-Wave, Matter) and forwards readings to OpenSense as the system of record.
  2. OpenSense → HA — HA reads measurements from OpenSense's API to display on its own dashboard.

This is the path the Aqara TH page walks through in detail. Summary:

  • Install Zigbee2MQTT (Z2M) in HA.
  • Pair Zigbee sensors through Z2M.
  • Configure Z2M to also publish to OpenSense's MQTT bridge.

Z2M's configuration.yaml:

mqtt:
  base_topic: opensense/aqara
  server: mqtts://mqtt.opensense.murzin.digital:8883
  user: ''
  password: '<ingest token from dashboard>'
  reject_unauthorized: true

OpenSense ingests on the bridge side. Devices auto-create channels on first message.

OpenSense → HA

Configure HA's sensor platform with our read API:

# configuration.yaml
sensor:
  - platform: rest
    name: cafe_walkin_temp
    resource: https://api.opensense.murzin.digital/v1/channels/chn_a1b2/measurements?limit=1&fn=last
    headers:
      Authorization: 'Bearer ua_live_4f3c…'
    value_template: '{{ value_json.data[0][1] }}'
    unit_of_measurement: '°C'
    scan_interval: 60

A ua_live_ API token with read-only scope is recommended:

curl -X POST https://api.opensense.murzin.digital/v1/tokens \
  -H "Authorization: Bearer ua_live_<owner>" \
  -d '{"label":"home-assistant","scope":"read"}'

The token gives HA read access only; it cannot modify rules or devices.

Use cases

  • HA as the sensor frontend, OpenSense as the compliance backend. Best for a single small operation that already has HA running.
  • OpenSense as the alarm source, HA as the dashboard. HA's Lovelace dashboards are excellent; if you want a wall-mounted fridge thermometer with custom theming, build it in HA, feed it from OpenSense.
  • OpenSense for the inspector, HA for fun. A real customer of ours does this: HA shows the inside temperature with playful graphs, OpenSense prints the boring PDF.

What we do not do

  • First-class HACS integration. Today HA reads via the rest platform. We may write a HACS integration if usage justifies it. Today it does not.
  • HA-style entity discovery. OpenSense does not push entities into HA's MQTT discovery topic. The Z2M path is what makes HA discover the underlying Zigbee sensors; OpenSense is downstream of that.

When not to use HA

If the operator does not already run HA, do not install HA just to use OpenSense. The setup overhead is several hours; OpenSense's direct ingest (Shelly H&T over WiFi) is 5 minutes. Add HA when there is an HA reason to add HA.