Turn rpi_rf socket on or off at a certain time, what have I done wrong?

Hi all, very new here, managed to get my RF sockets working via the card, now want to automate

Not sure about the action for my switched socket, could somebody let me know what I have missed?

Re Dave

automation:
      
  - alias: 'Send notification when sun rises'
    hide_entity: False 
    trigger:
      platform: sun
      event: sunrise
      offset: '+00:00:00'
    action:
      service: notify.smtp_gmail
      data:
        title: 'PI Sender Sunrise'
        message: 'Sunrise'

  - alias: 'Send notification when sun sets'
    trigger:
      platform: sun
      event: sunset
      offset: '+00:00:00'
    action:
      service: notify.smtp_gmail
      data:
        title: 'PI Sender Sunset'
        message: 'Sunset'
        
  - alias: 'Turn On Socket after 21:00'
    hide_entity: False
    trigger:
      platform: time
      after: '21:30:00'
    condition: time
    weekday:
      - mon
      - tue
      - wed
      - thu
      - fri
    action:
      - service: switch.socket_1.turn_on
     

     



switch:
  platform: rpi_rf
  gpio: 17
  switches:
    Socket_1:
      protocol: 1
      pulselength: 184
      code_on: 349491
      code_off: 349500

split your action

service: homeassistant.turn_on
entirty_id: switch.socket_1

I think you can use switch.turn_on also but I have always used the above method.

1 Like

Thanks, manged to get it working by adding your suggestion, but I also had another error I needed another condition before condition: time

Re posted my script to help others

  - alias: 'Turn On Socket after 21:00'
    hide_entity: False
    trigger:
      platform: time
      after: '15:53:00'
    condition:
      condition: time
      weekday:
        - mon
        - tue
        - wed
        - thu
        - fri
    action:
      service: homeassistant.turn_on
      entity_id: switch.socket_1

Thanks for taking the time to reply

Regards, Dave