[solved with a template] Different transition/time/delay for switching a light on and off: is this possible?

As the title says: is this possible?

Thanks for any help/suggestion!

Yes, it’s possible. How are you operating the light?

Hi Troon, with a motion sensor/automation.

service: light.turn_on
data:
  transition: 2
  brightness_pct: >-
    {{ 0 if trigger.to_state.state == 'off' else 1 if
    is_state('input_boolean.bedtime', 'on') or is_state('input_boolean.i_sleep',
    'on') else 90 }}
target:
  entity_id: light.kitchen

Please post the whole automation and explain what you would like to happen.

Is this what you want?

service: light.turn_on
data:
  transition: "{{ 5 if trigger.to_state.state == 'off' else 2 }}"
  brightness_pct: >-
    {{ 0 if trigger.to_state.state == 'off' else 1 if
    is_state('input_boolean.bedtime', 'on') or is_state('input_boolean.i_sleep',
    'on') else 90 }}
target:
  entity_id: light.kitchen
1 Like

Hi Taras, that is exactly what I was looking for: THANX a million, again!

The only thing is that 1 light doesn’t seem to support delays in switching on/off, is that possible?
I tried it with only that light in a script and there is no delay.

The transition option assumes the light’s underlying integration supports the option. If the integration doesn’t support transition it simply ignores it (and the light turns on/off without a brightening/dimming effect).

‘Integration’ => the way the device is working/constructed OR z2m?

It’s not a big thing but I was wondering why this one doesn’t seem to follow the transition setting.
It is configured to switch on/off with another light and at first I thought that it was a problem of the automation.

It’s this one Lidl HG06104A control via MQTT | Zigbee2MQTT (just looked it up now)
The options mention the transition and I have played with it in z2m but nothing changes.

The ZigBee standard supports transition but ultimately it depends on whether the manufacturer of the ZigBee-based light implemented it.

1 Like

OK, I get it.
Thanks!

1 Like