Dimmer Switch light turning off sometimes when automation action is to turn on

I’m a little bit stumped by this one because the automation clearly indicates that the light should turn on, but instead sometimes the light turns off. It doesn’t happen all the time and I haven’t been able to figure a pattern to it.

If you look in the related log book entries, it clearly says that the light was turned off by the automation. However nowhere in the automation is it being told to turn off.

The device is a Tuya dimmer switch.

Maybe you’ve used this device in another automation by mistake?

Look at the log book entry, it’s saying that the light is being turned off by the automation that is only emitting the turn on command.

Can you provide the code for the automation?

Here is the full yaml on that automation:

alias: Master Bathroom - Motion Detected
description: ""
  - type: motion
    platform: device
    device_id: 78fb5c5c8a4301b45f655f4429691187
    entity_id: binary_sensor.master_bathroom_motion_sensor
    domain: binary_sensor
  - condition: state
    entity_id: timer.master_bathroom_suppression_timer
    state: idle
  - service: timer.start
      duration: "00:05:00"
      entity_id: timer.master_bathroom_suppression_timer
  - if:
      - condition: time
        after: "07:00:00"
        before: "23:00:00"
      - type: turn_on
        device_id: 1a9aea526bdea6e6f589b5116bfd8720
        entity_id: light.master_bathroom_lights_1_switch_1
        domain: light
      - type: turn_on
        device_id: 65a74a18db54c636a7f44c7545d6de17
        entity_id: light.lights_in_the_master_shower_switch_1
        domain: light
      - type: turn_on
        device_id: e13a3535c05f6f1f0430a77ad2ddab21
        entity_id: light.dimmer_switch_light
        domain: light
        brightness_pct: 100
      - type: turn_on
        device_id: 897fc4d40a10ac5d2126cdc16d45e400
        entity_id: light.elana_s_closet_light_switch_1
        domain: light
      - type: turn_on
        device_id: 46bae7a79ef466e77da077757f55ecdd
        entity_id: light.nick_s_closet_light_switch_1
        domain: light
      - type: turn_on
        device_id: 4b31bf980d9f56696b20f13e654a1e6d
        entity_id: switch.master_bathroom_vanity_plug_socket_1
        domain: switch
      - type: turn_on
        device_id: e13a3535c05f6f1f0430a77ad2ddab21
        entity_id: light.dimmer_switch_light
        domain: light
        brightness_pct: 10
      - type: turn_on
        device_id: 475ff81d27a87a50428156b01c640d82
        entity_id: light.master_bathroom_nightlight_plug_socket_3
        domain: light
mode: single

When you go to the device in the tuya integration, there you can see the automations where the device is related to, just to rule out there isn’t another automation.

I mean there is another automation it’s tied to… The automation that’s triggered when that same motion sensor stops detecting motion (for 15 minutes).

However, that automation can’t be the culprit since it turns off all of the lights in the master bathroom (using a lighting group), but the potty light dimmer switch is the only one that’s exhibiting this odd behavior. Again too, it’s happening inconsistently.

Edit: I’d normally just chalk it up to something funky on the Tuya end of things (or with the dimmer switch itself), but the log event is throwing me for a loop and making me wonder if the issue may be with either HA or the Tuya integration.

Btw, I’m using the Tuya cloud integration, not Local Tuya.

I had some time ago a Wemo device acting the same way as yours, although I can’t remember the log, not sure it reported triggered by automation.
Anyway, replacing the device fixed it in my case.
Maybe before replacing it, delete the device from the other automation first?