Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Home Assistant

lightmime can show up in Home Assistant as a device, through MQTT discovery. This is optional and off by default; without it, lightmime talks only to your bridge.

Setup

You need an MQTT broker that Home Assistant uses, such as the Mosquitto add-on, and a user for lightmime on it. Add an [mqtt] section to the config file:

[mqtt]
enabled = true
host = "homeassistant.local"
port = 1883
username = "lightmime"
password = "change-me"

For a broker with TLS, set port = 8883 and tls = true, plus ca_file if the broker uses a self-signed certificate (see [mqtt]).

Then run either the window (lightmime gui) or the headless daemon (lightmime run). Both connect to the broker. Home Assistant finds a device called lightmime (<hostname>).

Security

lightmime trusts the broker: anyone who can publish to lightmime/<node>/+/set can start and stop syncing and move the sliders, and anyone who can subscribe can read the status, including error messages. MQTT never reaches the bridge keys or anything else on the machine. To keep it that way:

  • Give lightmime its own broker user and don’t allow anonymous clients (Mosquitto 2 refuses them by default).
  • If the broker supports ACLs, limit that user to lightmime/# and homeassistant/#, and limit who else can write to lightmime/#.
  • Use TLS when the broker is reachable from anywhere but your own network; otherwise the password is sent in clear.

Entities

<node> is the machine’s hostname in lowercase, with anything but letters and digits replaced by _ (or node_id from the config). Two machines with the same <node> share entities and keep disconnecting each other from the broker, so give each one its own node_id if their hostnames match. For the same reason, enable MQTT in only one lightmime process per machine.

EntityWhat it does
switch.lightmime_<node>_syncStarts and stops syncing.
sensor.lightmime_<node>_statusidle, starting, streaming or error. Its attributes hold the area, the number of lights and the error message.
sensor.lightmime_<node>_fpsFrames per second sent to the bridge, updated every 10 seconds while syncing (diagnostic).
number.lightmime_<node>_brightnessBrightness, 0–100 %.
number.lightmime_<node>_smoothingSmoothing, 0–95 %.
number.lightmime_<node>_saturationSaturation, 0–300 %.

Slider changes from Home Assistant apply right away, show up in the window and are saved to the config file. The device becomes unavailable when lightmime stops.

Example: sync while the TV plays

automation:
  - alias: Sync the lights with the PC while it plays
    triggers:
      - trigger: state
        entity_id: media_player.living_room_pc
        to: playing
    actions:
      - action: switch.turn_on
        target:
          entity_id: switch.lightmime_htpc_sync
  - alias: Stop syncing when playback stops
    triggers:
      - trigger: state
        entity_id: media_player.living_room_pc
        from: playing
        for: "00:01:00"
    actions:
      - action: switch.turn_off
        target:
          entity_id: switch.lightmime_htpc_sync

Topics

For other MQTT clients: everything lives under <base_topic>/<node>/ (default lightmime/<hostname>/).

TopicPayload
availabilityonline or offline (retained; offline is also the last will)
sync/state, sync/setON or OFF
status/stateidle, starting, streaming or error
status/attributesJSON: {"area": …, "channels": …, "error": …}
fps/stateframes per second
brightness/state, brightness/set (and smoothing, saturation)percent

Discovery configs go to <discovery_prefix>/<component>/lightmime_<node>/<key>/config. They are sent again when lightmime reconnects and when Home Assistant reports online on <discovery_prefix>/status, so a Home Assistant restart picks the device up again.