Problem with automation - dim in 60 sec after no movement

Hello!

I’m having problems with an automation. I hope someone is able to provide with some insight into my problem. What am I doing wrong here?

I made the following automations:

  - id: c3522a31749246a78e39565eff728bec
  alias: Beweging badkamer – geen beweging
  trigger:
  - platform: state
    entity_id: binary_sensor.tradfri_motion_sensor
    to: 'off'
    for: '0'
  action:
  - service: homeassistant.turn_off
    target:
      entity_id: light.eettafellampen
    data:
      transition: 160
- alias: Beweging WC - test uit
  trigger:
  - platform: state
    entity_id: binary_sensor.wc_beneden_sensor
    to: 'off'
    for:
      minutes: 0
  action:
  - service: homeassistant.turn_off
    target:
      entity_id: light.wc_lamp
    data:
      transition: 30
  id: 67c34029142048efa8a3778fd443c027

This works perfectly for the light.wc_lamp, but doesn’t work light.eettafellampen. I used the exact same automation, changing the entities. Sadly, the other entity doesn’t dim over 60 seconds, but dims instantly.

This is happening with the following devices:
Eco-Dim.07 Zigbee
Eco-Dim.10 Zigbee

The Eco-Dim.10 Zigbee is dimming over the course of 1 minute from 100% to 0% after the automation triggers. This is the light.wc_lamp.
The Eco-Dim.07 Zigbee dims instantly from 100% to 0% after the automation triggers. This is the light.eettafellampen.

Does anyone have any suggestions what I’m doing wrong? Or is the transition command not working for every device?

The automation appears to be mangled.

Here is how it should look:

- id: 67c34029142048efa8a3778fd443c027
  alias: Beweging WC - test uit
  trigger:
  - platform: state
    entity_id: binary_sensor.wc_beneden_sensor
    to: 'off'
  action:
  - service: homeassistant.turn_off
    target:
      entity_id: light.wc_lamp
    data:
      transition: 30   
  - service: homeassistant.turn_off
    target:
      entity_id: light.eettafellampen                   
    data:
      transition: 60
  mode: single

Hi Taras, thanks for taking the time to help me.
It seems like I didn’t post the full code for both automations, I edited my original post with the 2 automations. I don’t see what’s different in both. Yet 1 gives me a nice transition and the other doesn’t.

It seems like I wasted my time correcting them.

Are both lamps identical?

  • Same brand
  • Same model
  • Same firmware version

You earned my gratitude for helping, maybe that helps? :wink:

Both are inwall dimmer switches from EcoDim. Not same type.

The one with working automation is the EcoDim.10.
The one failing is EcoDim.07.
Different switches, different firmware.

But the transition command works for other Zigbee lights without a problem. Feels like the EcoDim.07 doesn’t support the transition feauture.

That appears to be the cause of the problem. The transition option instructs the device but it’s up to the device to correctly execute the instruction.

Is there another way to do this for the dimswitches that don’t work the transition command?

Like a script that lowers brightness? I have no idea how to use scripts tho, so I have some learning to do. But a script where I hardcode brightness after x seconds should work?

The best result is produced by devices that natively support a fade rate (i.e. automatically dimming from one brightness level to another over a specified period of time). All other techniques to emulate a fade rate are based on transmitting a stream of commands that progressively dim/brighten the light over a desired period of time. Several solutions have been created using python_script, pyscript, or scripts. Here’s one that was originally created by mrsynds that I adapted into a single script:

1 Like

Hi Taras!

Thanks for that reply.

Before you replied I came up with this:
Automation to trigger the script:

# Automation to start Dim Light script
automation:
  trigger:
    - platform: state
      entity_id: binary_sensor.gangsensor_1
      to: ‘off’
  action:
    service: script.dimlight

Script to dim light by 10% every 10 seconds:

# script.dimlight Dim light with 10% till light is off 
action:
  - alias: “Dim light by 10% every 10 seconds”
    repeat:
      sequence: 
        - delay:
            seconds: 10 
        - service: light.turn_on
          target:
            entity_id: light.eettafellampen
          data:
            brightness_step_pct: -10
      until:
        - condition: state
          entity_id: light.eettafellampen
          state: “off”

Home-Assistant doesn’t like the script though. It gives me errors. Still figuring out why. If I don’t figure it out, I’ll try to use your script! To be honest, your script kinda makes my head spin…

If your script is actually using these quotes then it won’t work:

“off”

It must use either standard single:

'off'

or double quotes:

"off"

It’s more complex because it calculates the optimal brightness_step_pct and time interval to produce a smooth transition effect; in your script the two values are hard-coded (-10 percent and 10 seconds).