Tuya Repeating automation

I’m looking to automate a tuya/smart life smart plug to toggle on and off every 5 min (ideally synced to the time eg 2:25 - 2:30 - 2:35 )

I’ve setup node-red as I thought I might be able to just do it from poking around but it seems a bit past my current ability.

any help would be appreciated :slight_smile:
also apologies if this is a basic question. I’m still new here

Use a time pattern trigger, see the third example here:

Then in the actions use the switch.toggle service to toggle your switch.

trigger:
  platform: time_pattern
  minutes: "/5"
action:
  service: switch.toggle
  target:
    entity_id: switch.your_switch_here

thankyou so much!

1 Like

Hey tom I had everything working wonderfully and I cant seem to get it back up again since tuya v2 I’ve setup through the new dev api. but my scripts and any edits I make don’t seem to work

I’ve pasted the script I had setup before

sequence:

  • type: toggle
    device_id: 15a3ea7544b8c8f45bb71a5d34c0ea52
    entity_id: switch.smart_socket_2
    domain: switch

  • repeat:
    while:
    - type: is_plugged_in
    condition: device
    device_id: aee5ee866614ba1cb8df484b612dcbe7
    entity_id: binary_sensor.aron_s_fire_plugged_in
    domain: binary_sensor
    for:
    hours: 0
    minutes: 0
    seconds: 0
    milliseconds: 0
    - condition: time
    after: ‘06:00:00’
    before: ‘23:59:00’
    - condition: template
    value_template: |2-

         trigger:
            - platform: time_pattern
              minutes: "/5"
    

    sequence: []
    mode: single
    alias: Kitchen plug
    icon: mdi:power-socket-au

Again thanks for any help : )

Please format your post correctly.

But from what I can see, you appear to be confusing automations and scripts. Scripts don’t have triggers.

Also you don’t use triggers in value_templates.

My apologies I was in scripts instead of automations. best not to name them so similarly.

all fixed now :sweat_smile: