Pi-hole automation in Homeassistant

Maybe like this:

automation:
  - alias: "Disable Pi-hole for 5 minutes"
    triggers:
      - trigger: event
        event_type: pi_hole_disable_5_min
    actions:
      - action: rest_command.pihole_authenticate
        response_variable: response
      - if: "{{ response['status'] == 200 }}"
        then:
          - alias: "Parse data"
            variables:
              sid: "{{ response['content']['session']['sid'] }}"
          - action: rest_command.pihole_disable_5_min
            data:
              sid: "{{ sid }}"
          - service: rest_command.pihole_logout
            data:
              sid: "{{ sid }}"
        else:
          - service: persistent_notification.create
            data:
              message: "Failed to authenticate with Pi-hole API"
              title: "Pi-hole API Error"

rest_command:
  pihole_authenticate:
    url: http://192.168.2.11/api/auth
    method: POST
    payload: '{ "password" : "your_password" }'
    content_type:  'application/json; charset=utf-8'
    verify_ssl: false
  pihole_logout:
    url: http://192.168.2.11/api/auth
    method: DELETE
    verify_ssl: false
    headers:
      sid: "{{ sid }}"
  pihole_disable_5_min:
    url: http://192.168.2.11/api/dns/blocking
    method: POST
    payload: '{ "blocking" : false, "timer" : 300 }'
    content_type:  'application/json; charset=utf-8'
    verify_ssl: false
    headers:
      sid: "{{ sid }}"

It needs to be added to your configuration.yaml