MagicHome Automation - light_on Brightness

I have the following action on an automation:

  action:
  - data:
      brightness_pct: 20
      color_name: red
      entity_id: light.nursery_light
    service: light.turn_on

Which when the automation runs causes the light in question to turn on at 100% brightness for a split second before dimming to 20%.

I can see the two MQTT messages in the Tasmota console:

23:27:49 MQT: stat/nurseryStripRGB/RESULT = {“POWER”:“ON”,“Dimmer”:100,“Color”:“FF0000”,“HSBColor”:“0,100,100”,“Channel”:[100,0,0]}
23:27:49 MQT: stat/nurseryStripRGB/RESULT = {“POWER”:“ON”,“Dimmer”:20,“Color”:“330000”,“HSBColor”:“0,100,20”,“Channel”:[20,0,0]}
23:27:49 MQT: stat/nurseryStripRGB/RESULT = {“POWER”:“ON”}
23:27:49 MQT: stat/nurseryStripRGB/POWER = ON (retained)

This is only for a split second, but it results in a very annoying flash in a dark room. It also seems odd that the colour changes, but that is probably irrelevant.

My configuration for the device is the following:

  - platform: mqtt
    name: "Nursery Light"
    state_topic: "stat/nurseryStripRGB/RESULT"
    command_topic: "cmnd/nurseryStripRGB/POWER"
    state_value_template: "{{ value_json.POWER }}"
    brightness_state_topic: "stat/nurseryStripRGB/RESULT"
    brightness_command_topic: "cmnd/nurseryStripRGB/Dimmer"
    brightness_scale: 100
    brightness_value_template: "{{ value_json.Dimmer }}"
    rgb_command_topic: "cmnd/nurseryStripRGB/Color"
    rgb_command_template: "{{ '%02x%02x%02x' | format(red, green, blue)}}"
    rgb_state_topic: "stat/nurseryStripRGB/RESULT"
    rgb_value_template: "{{(value_json.Channel[0]*2.55)|int}},{{(value_json.Channel[1]*2.55)|int}},{{(value_json.Channel[2]*2.55)|int}}"
    effect_state_topic: "stat/nurseryStripRGB/RESULT"
    effect_command_topic: "cmnd/nurseryStripRGB/Scheme"
    effect_list:
      - 0
      - 1
      - 2
      - 3
      - 4
    retain: false
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"

Anyone any ideas what I am doing wrong?

You need to format your code properly, use the blue link at the top of the post. Edit your original post. Do not copy from your original post and paste into a new post. The original formatting from your yaml will be lost if you do.

1 Like

How is your MQTT topic looking? I think the default for sending message is ON afyer sending the state command. Playing with the on_command_type under MQTT light helped me.

How would I go about this? Not seen any topic specific configuration for MQTT? I am using Mosquito on Hass.IO

Link:https://www.home-assistant.io/components/light.mqtt/

Add it as any other config variables for your light.

Fixed this!

Finally found this answered in a Tasmota github issue.

Solution is to change the rgb_command_topic to use Color2:

rgb_command_topic: "cmnd/nurseryStripRGB/Color2"