# node-red-contrib-ha-mqtt

> Generate MQTT entities in HomeAssistant

Latest version **1.4.0** (published 2026-11-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install node-red-contrib-ha-mqtt
pnpm add node-red-contrib-ha-mqtt
yarn add node-red-contrib-ha-mqtt
bun add node-red-contrib-ha-mqtt
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2026-11-19 |
| First published | 2021-07-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12 |
| Dependencies | 2 |
| Unpacked size | 275.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 47 |
| Author | shaonianzhentan |
| Maintainers | jiluxinqing |
| Keywords | node-red, ha-mqtt, homeassistant, home-assistant |

## Links

- npm: https://www.npmjs.com/package/node-red-contrib-ha-mqtt
- Repository: https://github.com/shaonianzhentan/node-red-contrib-ha-mqtt
- Homepage: https://github.com/shaonianzhentan/node-red-contrib-ha-mqtt#readme
- Issues: https://github.com/shaonianzhentan/node-red-contrib-ha-mqtt/issues
- npm.io page: https://npm.io/package/node-red-contrib-ha-mqtt

## Dependencies (2)

- [gcoord](https://npm.io/package/gcoord.md) ^1.0.5
- [node-pinyin](https://npm.io/package/node-pinyin.md) ^0.2.3

## Recent versions

- 1.4.0 (latest) — 2026-11-19
- 1.2.17 — 2026-02-07
- 1.2.16 — 2025-10-20
- 1.2.15 — 2025-01-16
- 1.2.14 — 2024-01-27
- 1.2.13 — 2023-10-09
- 1.2.12 — 2023-09-12
- 1.2.11 — 2023-09-11
- 1.2.10 — 2023-07-03
- 1.2.9 — 2022-11-25
- 1.2.8 — 2022-10-24
- 1.2.7 — 2022-05-14
- 1.2.6 — 2022-05-13
- 1.2.5 — 2022-04-16
- 1.2.4 — 2022-03-25
- … 14 more at https://npm.io/package/node-red-contrib-ha-mqtt/versions

## README

# ha-mqtt
Generate MQTT entities in Home Assistant

[![platform](https://img.shields.io/badge/platform-Node--RED-red)](https://flows.nodered.org/node/node-red-contrib-ha-mqtt)
[![home-assistant](https://img.shields.io/badge/Home-Assistant-%23049cdb)](https://www.home-assistant.io/)
[![NPM version](https://img.shields.io/npm/v/node-red-contrib-ha-mqtt.svg?style=flat-square)](https://www.npmjs.com/package/node-red-contrib-ha-mqtt)

![visit](https://visitor-badge.laobi.icu/badge?page_id=shaonianzhentan.node-red-contrib-ha-mqtt&left_text=visit)
![forks](https://img.shields.io/github/forks/shaonianzhentan/node-red-contrib-ha-mqtt)
![stars](https://img.shields.io/github/stars/shaonianzhentan/node-red-contrib-ha-mqtt)
![license](https://img.shields.io/github/license/shaonianzhentan/node-red-contrib-ha-mqtt)

English | [简体中文](README.zh.md)

Reference document: https://www.home-assistant.io/integrations/mqtt#mqtt-discovery

Example：https://github.com/shaonianzhentan/node-red-contrib-ha-mqtt/wiki

## Supported languages
- ✔️ English (en-US)
- ✔️ Chinese (zh)
## Supported components
- ✔️  [alarm_control_panel](https://www.home-assistant.io/integrations/alarm_control_panel.mqtt/)
- ✔️  [binary_sensor](https://www.home-assistant.io/integrations/binary_sensor.mqtt/)
- ✔️  [button](https://www.home-assistant.io/integrations/button.mqtt/)
- ✔️  [camera](https://www.home-assistant.io/integrations/camera.mqtt/)
- ✔️  [climate](https://www.home-assistant.io/integrations/climate.mqtt/)
- ✔️  [cover](https://www.home-assistant.io/integrations/cover.mqtt/)
- ✔️  [date](https://www.home-assistant.io/integrations/date.mqtt/) (HA 2026.5+)
- ✔️  [datetime](https://www.home-assistant.io/integrations/datetime.mqtt/) (HA 2026.5+)
- ✔️  [device_tracker](https://www.home-assistant.io/integrations/device_tracker.mqtt/)
- ✔️  [device_automation](https://www.home-assistant.io/integrations/device_trigger.mqtt/)
- ✔️  [event](https://www.home-assistant.io/integrations/event.mqtt/)
- ✔️  [fan](https://www.home-assistant.io/integrations/fan.mqtt/)
- ✔️  [humidifier](https://www.home-assistant.io/integrations/humidifier.mqtt/)
- ✔️  [image](https://www.home-assistant.io/integrations/image.mqtt/)
- ✔️  [infrared](https://www.home-assistant.io/integrations/infrared.mqtt/) (HA 2026.7+)
- ✔️  [lawn_mower](https://www.home-assistant.io/integrations/lawn_mower.mqtt/)
- ✔️  [light](https://www.home-assistant.io/integrations/light.mqtt/)
- ✔️  [lock](https://www.home-assistant.io/integrations/lock.mqtt/)
- ✔️  [number](https://www.home-assistant.io/integrations/number.mqtt/)
- ✔️  [notify](https://www.home-assistant.io/integrations/notify.mqtt/)
- ✔️  [scene](https://www.home-assistant.io/integrations/scene.mqtt/)
- ✔️  [select](https://www.home-assistant.io/integrations/select.mqtt/)
- ✔️  [sensor](https://www.home-assistant.io/integrations/sensor.mqtt/)
- ✔️  [switch](https://www.home-assistant.io/integrations/switch.mqtt/)
- ✔️  [siren](https://www.home-assistant.io/integrations/siren.mqtt/)
- ✔️  [update](https://www.home-assistant.io/integrations/update.mqtt/)
- ✔️  [tag](https://www.home-assistant.io/integrations/tag.mqtt/)
- ✔️  [text](https://www.home-assistant.io/integrations/text.mqtt/)
- ✔️  [time](https://www.home-assistant.io/integrations/time.mqtt/) (HA 2026.5+)
- ✔️  [vacuum](https://www.home-assistant.io/integrations/vacuum.mqtt/)
- ✔️  [valve](https://www.home-assistant.io/integrations/valve.mqtt/)
- ✔️  [water_heater](https://www.home-assistant.io/integrations/water_heater.mqtt/)

Auto-discovery
```yaml
topic: homeassistant/status
payload: online
```

## Home Assistant compatibility
Discovery payloads follow the current HA MQTT discovery schema, including the `origin` block and per-entity availability (`online` / `offline`). `date`, `time` and `datetime` require HA 2026.5 or newer; `infrared` requires HA 2026.7 or newer. Availability can be disabled for a single entity by setting `"availability_topic": null` in its Configuration field.

### HA version selector
The device config node has a **Home Assistant version** dropdown. It defaults to **Latest**, which enables all platforms and uses current HA behavior (including remapping legacy binary sensor device classes). If you run an older HA, select the matching version:

- Discovery configs for platforms introduced in later HA versions are skipped; the affected node shows a yellow status instead of publishing a config HA cannot understand.
- Discovery attributes that only exist in newer HA versions are removed, including from hand-written JSON in the entity Configuration field.
- Legacy `binary_sensor` device class values (`cool`, `warm`, `carbon_monoxide`) are remapped to `cold`, `heat`, `gas` from HA 2022.9 onward; older versions keep the original value.

This is a manual setting. After upgrading HA, update the selection to enable newly supported platforms.

## If this project is helpful to you, please donate a cup of <del style="font-size: 14px;">coffee</del> milk tea 😘

<a href="https://paypal.me/shaonianzhentan"><img src="https://raw.githubusercontent.com/shaonianzhentan/image/main/picture/paypal.me.png" height="300" alt="https://paypal.me/shaonianzhentan" title="https://paypal.me/shaonianzhentan"></a>

## Reference Projects

- https://github.com/toobug/pinyin
- https://github.com/hujiulong/gcoord

---
_Source: https://npm.io/package/node-red-contrib-ha-mqtt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
