Skip to content

MQTT and Home Assistant EN

David Panusch edited this page Oct 27, 2026 · 1 revision

🇩🇪 Deutsch | 🇬🇧 English

MQTT and Home Assistant

Setup

  1. In the web interface under Smart Home, enter server, port (usually 1883), user, password, client ID and topic, and activate MQTT.
  2. The status below shows whether the connection is up or why it fails: server not found, not reachable, wrong credentials, not authorised or invalid client ID.
  3. In Home Assistant, the MQTT integration must be running with discovery enabled. The clock then registers itself; otherwise press Send HA Discovery in the web interface.

The credentials can also be preset in Configuration.

Topics

<TOPIC> is the topic from the web interface, default ESPWordclock.

Topic Direction Content
<TOPIC>/cmd to the clock JSON commands (light)
<TOPIC>/status from the clock State after every change
<TOPIC>/availability from the clock online / offline (last will)
<TOPIC>/diagnostics from the clock Lux, LED gain, sensor source, Wi-Fi signal, IP, uptime
<TOPIC>/<entity>/set and /state both Additional entities such as scrolling text, effect speed, automatic brightness and transitions

Commands

The clock uses the JSON light schema of Home Assistant. Several fields can be combined in one message.

Field Values Effect
state "ON", "OFF" LEDs on or off, uppercase is mandatory
brightness 0–255 Brightness of foreground and secondary colour together
color {"h": 0–360, "s": 0–100} Foreground colour
effect see below Display mode
scrolling_text Text Text for the scrolling text

Effects: Wordclock, Seconds, Digitalclock, Scrollingtext, Rainbowcycle, Rainbow, Fire, Color, Symbol.

Rules for brightness and colour

  • A brightness command sets foreground and secondary colour together. With Polychrome, the whole gradient including the minute LEDs gets brighter or darker; a brightness difference between the two colours set in the web interface is lost in the process.
  • If automatic brightness is active, brightness commands are ignored.
  • A colour command changes only the foreground colour. The secondary colour exists only in the web interface.
  • Switching off and on affects all colours; when switching on, the previous brightness comes back.

Note on Apple Home: Via the HomeKit bridge of Home Assistant, Apple Home sends along the colour last stored there when switching on. If you switch the clock on with an automation and then see a white foreground colour, set the colour in the automation as well.

Examples

{ "state": "ON", "brightness": 255, "color": { "h": 0, "s": 100 } }
{ "effect": "Scrollingtext", "scrolling_text": "Hello World!" }
{ "state": "OFF" }

Status

{
  "state": "ON",
  "color": { "h": 120, "s": 100 },
  "brightness": 128,
  "color_mode": "hs",
  "effect": "Wordclock"
}

color_mode: "hs" tells Home Assistant that the colour is given as hue and saturation.

Auto-discovery

The clock sends its configuration (retained) when it connects to the broker, when Home Assistant restarts and when Send HA Discovery is pressed in the web interface:

  • homeassistant/light/<MAC>/config for the light
  • homeassistant/<type>/<MAC>_<ID>/config for all further entities

<MAC> is the MAC address without colons. Home Assistant groups all entities into one device, with a link to the web interface.

Entity Type Function
Light light On/off, brightness, colour, all effects
Scrolling Text text Set scrolling text
Message notify Send text that immediately appears as scrolling text
Effect Speed number Speed 1–10
Auto Brightness switch automatic brightness on/off
Transition Type select Transition: Off, Roll Up, Roll Down, Shift Left, Shift Right, Fade, Laser, Matrix Rain, Balls, Fire, Snake, Random
Transition Colorize select Colour mode: Off (monochrome), Gradient (Polychrome), Random (random per word)
Transition Duration select Short, Medium, Long
Illuminance, LED Gain, WiFi Signal, IP Address, Uptime sensor Diagnostics

Systems that emulate the Home Assistant format (e.g. openHAB) also find the clock.

When updating from 5.0.0-rc.1, the old discovery as a single device bundle is converted once to individual entities; areas and names in Home Assistant are kept.

Clone this wiki locally