[REST] How to control two REST endpoints via one Switch?

Hey community,

yesterday I started fiddeling around with REST to integrate my secondary AdGuard Home instance into HA. My primary instance is the Addon of frenck.
Things were evolving quite good until I reached a point where the AdGuard Home REST API uses two endpoints for enabling and disabling e.g. the Parental Control Feature.

From my newbyish perspective I wish I had a REST-Switch that can handle something like ressource_on / ressource_off but that seems to be unavailable probably due to some reason!?

My current “solution” is quite awkward.
I defined:

  1. a rest command to enable Parental Control
  2. a rest command to disable Parental Control
  3. a rest sensor to get the status in an interval of 5 mins
  4. a template switch that uses the rest commands and the rest sensor

Due to the fact that the rest sensor is not updated by the switch actuation, like it is when using a rest switch, the template switch e.g. returns to off after switching on until the scan_interval polls a new sensor value.

There might be hacks to overcome the situation but I’m pretty sure I’m just lacking the knowledge how to do that properly.

  1. call rest.reload upon each switch actuation but that polls all rest sensors
  2. setting the scan_interval to a rather low value but that means polling repeatedly also if no switch was actuated
  3. set the switch to optimistic:true but come on …

Here comes the related yaml:

    url: ''
    method: POST
    payload: "sensitivity=EARLY_CHILDHOOD"
      Authorization: !secret adguard_key
      Content-Type: text/plain
      User-Agent: Home Assistant

    url: ''
    method: POST
    payload: ""
      Authorization: !secret adguard_key
      Content-Type: text/plain
      User-Agent: Home Assistant

  - platform: template
        friendly_name: AdGuard Home Parental Control
        icon_template: mdi:shield-check
        value_template: "{{ state_attr('sensor.adguard_home_parental_status_api', 'enabled')}}"
          service: rest_command.adguard_home_parental_enable_rest
          service: rest_command.adguard_home_parental_disable_rest

  - platform: rest
    name: AdGuard Home PARENTAL STATUS API
    method: GET
      Authorization: !secret adguard_key
      Content-Type: application/json
      User-Agent: Home Assistant
    scan_interval: 300
    value_template: 'PARENTAL STATUS API'
      - enabled
      - sensitivity

Hope someone has a solution or pointer for me!

Thank you in advance,