Simpler code

Hello,

I would like to ask for help with the following code, how to make it simpler and more transparent?

description: Karácsonyi világítás
triggers:
  - at: "16:00:00"
    id: 16_ora
    trigger: time
  - at: "20:00:00"
    id: 20_ora
    trigger: time
conditions: []
actions:
  - if:
      - condition: trigger
        id:
          - 16_ora
      - condition: device
        type: is_off
        device_id: 1c18e2ae8fddb34b44a69ac25a17e3f8
        entity_id: c95a25a70fa8cd3ff75670c890460b90
        domain: switch
    then:
      - type: turn_on
        device_id: 1c18e2ae8fddb34b44a69ac25a17e3f8
        entity_id: c95a25a70fa8cd3ff75670c890460b90
        domain: switch
  - if:
      - condition: trigger
        id:
          - 20_ora
      - condition: device
        type: is_on
        device_id: 1c18e2ae8fddb34b44a69ac25a17e3f8
        entity_id: c95a25a70fa8cd3ff75670c890460b90
        domain: switch
    then:
      - type: turn_off
        device_id: 1c18e2ae8fddb34b44a69ac25a17e3f8
        entity_id: c95a25a70fa8cd3ff75670c890460b90
        domain: switch
mode: restart

type or paste code here

What is the entity name of the switch?

smart_plug_1

Things I would change to make it more readable:

  1. Your device conditions aren’t doing much of anything, you can get rid of them.
  2. You don’t need 2 If/Then actions if there are only 2 choices, just use the else key.
  3. Entity based actions are more readable than Device actions.
description: Karácsonyi világítás
triggers:
  - at: "16:00:00"
    id: 16_ora
    trigger: time
  - at: "20:00:00"
    id: 20_ora
    trigger: time
conditions: []
actions:
  - if:
      - condition: trigger
        id:
          - 16_ora
    then:
      - action: switch.turn_on
        target:
          entity_id: switch.smart_plug_1
    else:
      - action: switch.turn_off
        target:
          entity_id: switch.smart_plug_1
mode: single

Thank you very much for your help!