Automation turns light off first, before sending configuration commands

If its morning, when I turn on the kitchen light, make the light cold, and brightness at 100%. And if it’s night, when I turn on the kitchen light, make the light warm and the brightness 100%. This works.

The issue is that when I turn on the kitchen light, the light turns off, and then back on, and then it sets warm/cold and brightness. When it should just set warm/cold and brightness. I want to avoid that turning off first, and then back on.

But I don’t see an option in the gui to do that.

alias: kitchen light turns on
description: ""
triggers:
  - entity_id:
      - switch.kitchen_light
    to: "on"
    trigger: state
conditions: []
actions:
  - choose:
      - conditions:
          - condition: sun
            after: sunrise
            before: sunset
        sequence:
          - delay:
              hours: 0
              minutes: 0
              seconds: 1
              milliseconds: 0
          - action: light.turn_on
            metadata: {}
            data:
              color_temp_kelvin: 6500
              brightness_pct: 100
            target:
              entity_id: light.lights_1
      - conditions:
          - condition: sun
            after: sunset
            before: sunrise
        sequence:
          - delay:
              hours: 0
              minutes: 0
              seconds: 1
              milliseconds: 0
          - action: light.turn_on
            metadata: {}
            data:
              color_temp_kelvin: 2000
              brightness_pct: 100
            target:
              entity_id: light.lights_1
mode: single

Really depends on the lights, not all integrations/brands handle changing color/brightness on turn on that well.

But isn’t there a way to just send the infrared commands? Instead of also sending the turn on command?

Infrared commands? What is the device brand/type you are trying to adjust?

I’m using a linknlink eremote to send commands to a light that came with an infrared remote. the eremote is connected via mqtt to home assistant

What options do you see when you select the device in the MQTT integration

Home Assistant | LinknLink Smart Home?


Go to settings, select Devices and Services, then MQTT and finally the eRemote device. You’ll see the commands available to control the light if they are available.

its just this

Review the IR instructions for HA here

it seems there’s a way to set up a custom remote with whatever IR commands you want. I’ll give that a try. Thanks

Yes, it is in the LinkLink setup vs HA.

*To control your lR device using both the app and HA, select “Add for HA”. *
Follow the wizard to select the brand, test the lR options, and save your settings. You can then controlthe device from your phone

Yes, now it’s a button, not a switch, and it doesn’t have to turn off/on the light before setting warn, cold and brightness.

alias: kitchen light turns on
description: ""
triggers:
  - entity_id:
      - switch.kitchen_light
    to: "on"
    trigger: state
conditions: []
actions:
  - choose:
      - conditions:
          - condition: sun
            after: sunrise
            before: sunset
        sequence:
          - delay:
              hours: 0
              minutes: 0
              seconds: 1
              milliseconds: 0
          - action: button.press
            metadata: {}
            data: {}
            target:
              entity_id: button.bright_100
          - action: button.press
            metadata: {}
            target:
              entity_id: button.temp_6000
      - conditions:
          - condition: sun
            after: sunset
            before: sunrise
        sequence:
          - delay:
              hours: 0
              minutes: 0
              seconds: 1
              milliseconds: 0
          - action: button.press
            metadata: {}
            data: {}
            target:
              entity_id:
                - button.bright_100
                - button.temp_3000
mode: single

You are good to go then?

yes all good

1 Like

Glad you got it sorted.

I’ve used other work arounds in the past where I turn the bulb to 1% brightness first, before turning it off, so that when it turns on, its at 1% brightness. I then set the values I want, before then properly turning it ‘on’.