Tuya Automation not working

Hi All,

Apologies if this is the wrong forum to ask this. I have been running home assistant for a short while and have slowly been getting my automations in place. I’m having an issue with 2 of my automations to turn on my evening lights. According to the logbook and also the trace the automation is running as planned but is not switching on the lights during it. If I run actions manually it switches them on. The automation is using the Tuya v2 integration for lights. There are no errors in the logs that I can see. Attached is a screenshot showing the trace and also the config for the automation.


alias: 'Light: Evening lights on'
description: ''
trigger:
  - platform: sun
    event: sunset
    offset: '-00:20:00'
condition:
  - condition: state
    entity_id: alarm_control_panel.yale_smart_alarm
    state: disarmed
  - condition: or
    conditions:
      - condition: device
        device_id: c56b1886681a81f27ddefad4c46d22a9
        domain: device_tracker
        entity_id: device_tracker.gregiphone
        type: is_home
      - condition: or
        conditions:
          - condition: device
            device_id: 281fd90c3f30c115ac2fbe886569757a
            domain: device_tracker
            entity_id: device_tracker.sarahsiphone
            type: is_home
action:
  - type: turn_on
    device_id: d5a057bd768fc2c8f83ffe33663f5682
    entity_id: switch.cupboardlights
    domain: switch
  - service: light.turn_on
    target:
      device_id:
        - 4bc4d298e41b2652791213dddf34b9db
        - f79cea983dc4dcf655349a471e2fe85d
  - service: switch.turn_on
    target:
      device_id:
        - d5a057bd768fc2c8f83ffe33663f5682
        - 8cfaa3aae2da1771b3658233aa2d3609

What are you trying to achieve with this ? Turn_on a switch ? but that’s what you are doing in step 3:

  - service: switch.turn_on
    target:
      device_id:
        - d5a057bd768fc2c8f83ffe33663f5682
        - 8cfaa3aae2da1771b3658233aa2d3609

Sorry that’s my fault. I’d been playing with various different things over the past few days to get it to work. I changed from calling a device to calling the service and just forgot to delete the device entry.