Milight Hub Automation using Remote


Hope someone can please help? after a few days i managed to get this working

I can control my milights from :slight_smile: without the official flakey milght hub

When i got to this

I am stuck! i cannot get the remote to update can anyone please tell me where i am going wrong?

My automations.yaml

โ€˜โ€™โ€™ - alias: MiLight Forwarder
initial_state: True
platform: mqtt
#0x21B is the esp8266 controller
#0x539A is the milight remote
topic: milight/updates/0x539A/rgbw/+
- service: mqtt.publish
topic: โ€œmilight/commands/0x21B/rgbw/{{ trigger.topic.split(โ€™/โ€™)[4] }}โ€
payload_template: โ€˜{{ trigger.payload }}โ€™โ€™โ€™โ€™

my configuration.yaml


  • platform: mqtt_json
    name: โ€˜Milight 4โ€™
    state_topic: milight/state/0x21B/rgbw/4
    command_topic: milight/commands/0x21B/rgbw/4
    update_topic: milight/update/0x21B/rgbw/4
    brightness: true
    flash: true
    rgb: true
    white_value: true
    effect: true
    effect_list: [colorfade_slow, colorfade_fast, flash]
    optimistic: false

Hi, please when you post code use code blocks the </> icon.

I only emulate hubโ€™s to the bulbs I donโ€™t have remote.
All the bulbs I use the remote I use their device ID on Hass so I donโ€™t need extra automation to have the state sync.

All you need to configure in the esp is the mqtt_topic_pattern this will be the command topic in Hass , mqtt_update_topic_pattern this will be the command topic used by the remote, mqtt_state_topic_pattern this is the state topic which is updated from mqtt_topic_pattern and mqtt_update_topic_pattern

  - platform: mqtt_json
    name: 'Table'
    state_topic: "milight/state/0x354A/rgbw/1"
    command_topic: "milight/commands/0x354A/rgbw/1"
    brightness: true
    color_temp: false
    computed_color: true
    flash: true
    rgb: true
    optimistic: false

This is a working version of mine being update from the remote.
At the esp hub configurations I use:

mqtt_topic_pattern = milight/commands/:device_id/:device_type/:group_id
mqtt_update_topic_pattern = milight/updates/:device_id/:device_type/:group_id
mqtt_state_topic_pattern = milight/state/:device_id/:device_type/:group_id