1.Requirements
- MQTT broker — e.g. Mosquitto, reachable by both METEO_P4 and Home Assistant.
- Same network — METEO_P4 and the broker must be able to reach each other.
- MQTT integration in Home Assistant — installed and configured to use the same broker.
If Home Assistant is installed as Home Assistant OS or Supervised, the easiest option is to install the official Mosquitto broker add-on from the HA add-on store. The broker and HA will already share the same network.
2.How it works
After connecting to Wi-Fi, METEO_P4 automatically:
- Connects to the MQTT broker with the configured credentials.
- Publishes MQTT Discovery configuration to topics
homeassistant/<тип>/<MAC>/<id>/config. - Starts publishing measurements periodically to
meteo_p4/<MAC>/state. - Publishes availability status to
meteo_p4/<MAC>/status.
Thanks to Discovery, you do not need to create entities in YAML manually — Home Assistant detects the device and adds all sensors automatically.
Make sure Enable MQTT Discovery is turned on in Home Assistant (it is on by default). Entities will appear within seconds after the device first connects.
3.MQTT Topics
<MAC> — the device Wi-Fi MAC address in lowercase without separators, e.g. a1b2c3d4e5f6.
Status and state
online / offline (LWT)Keys in JSON payload (state)
| Ключ | Description | Unit |
|---|---|---|
indoor_temperature | Indoor temperature | °C |
outdoor_temperature | Outdoor temperature | °C |
humidity | Indoor humidity | % |
outdoor_humidity | Outdoor humidity | % |
pressure | Atmospheric pressure | hPa |
co2 | CO₂ | ppm |
voc | VOC index (SGP41) | — |
wind | Wind speed | м/с |
forecast_temp_now | Forecast temperature | °C |
wifi_rssi | Wi-Fi signal level | dBm |
free_heap | Free RAM | bytes |
free_psram | Free PSRAM | bytes |
uptime | Uptime since boot | с |
fw_version | Firmware version | string |
Discovery topics
Published once at startup. Example for the temperature sensor:
topichomeassistant/sensor/<MAC>/indoor_temperature/config
4.Sensors in Home Assistant
Once discovered, the device appears in HA as a single METEO P4 integration with the following entities:
Climate
- Indoor temperature и на улице
- Indoor humidity и на улице
- Atmospheric pressure
- CO₂ (ppm)
- VOC index
Weather
- Wind speed
- Forecast temperature
Diagnostics
- Wi-Fi RSSI
- Free RAM и PSRAM
- Uptime
- Firmware version
5.Connection Setup
On the device open: Settings → Server → MQTT.
| Field | Value |
|---|---|
| Host | IP address of the MQTT broker, e.g. 192.168.100.40 |
| Port | 1883 (no TLS) or 8883 (TLS) |
| User | Login (if authentication is enabled) |
| Password | MQTT password |
| Interval | Publish interval, at least 10 seconds |
Press SAVE, then ENABLE MQTT. The device will connect and start publishing data.
Do not use allow_anonymous true in a production network. Never publish your MQTT password, home-network IP address or server credentials publicly.
6.Connection Check
Verify that the device is publishing data by subscribing to all its topics:
Docker (Mosquitto in a container)
bashdocker exec -it meteo_mosquitto mosquitto_sub \
-h localhost -u USER -P PASSWORD \
-t "meteo_p4/#" -v
Windows (Mosquitto installed locally)
powershellcd "C:\Program Files\mosquitto"
.\mosquitto_sub.exe -h 127.0.0.1 -p 1883 `
-u METEO_P4 -P your_password `
-t "meteo_p4/#" -v
When the connection works, messages like these will appear in the console:
outputmeteo_p4/a1b2c3d4e5f6/status online
meteo_p4/a1b2c3d4e5f6/state {"indoor_temperature":22.4,"humidity":48,...}
Check port reachability from another PC
powershellTest-NetConnection -ComputerName IP_СЕРВЕРА -Port 1883
7.Troubleshooting
| Symptom | Cause / solution |
|---|---|
| Device does not appear in Home Assistant | Check that the MQTT integration is enabled in HA and that MQTT Discovery is on. Make sure the broker matches the one configured in METEO_P4. |
Entities appeared but values show unavailable |
The device is not connected or status is offline. Check Wi-Fi and MQTT settings on the device. |
Connection refused: not authorised |
Wrong login or password, or allow_anonymous false is set but no credentials are provided in the client. |
No data arriving but status is online |
Publish interval is too long, or the sensor is not physically connected. Reduce the interval in settings. |
| METEO_P4 cannot connect via TLS (port 8883) | A CA certificate must be installed on the device or a trust-bundle enabled. The certificate CN must match the broker hostname or IP. |
| Duplicate entities in HA | Delete the old device in HA (Settings → Devices & Services → MQTT) and wait for re-discovery. |