Pause and restart a device based on state change of a second device

I still need to test it, but this could work:

alias: Bautrockner restart
description: >-
  pausiert den Bautrockner, wenn der Boiler sich einschaltet, bis der Boiler
  wieder abschaltet.
trigger:
  - platform: state
    entity_id:
      - binary_sensor.boiler_status
    from: "on"
    to: "off"
  - platform: state
    entity_id:
      - binary_sensor.boiler_status
    from: "off"
    to: "on"
  - platform: state
    entity_id:
      - binary_sensor.bautrockner_status
    from: "off"
    to: "on"
condition: []
action:
  - choose:
      - conditions:
          - condition: and
            conditions:
              - condition: state
                entity_id: binary_sensor.bautrockner_status
                state: "on"
              - condition: template
                value_template: "{{trigger.id == '1'}}"
                alias: Boiler schaltet ein
        sequence:
          - service: input_boolean.turn_on
            data: {}
            target:
              entity_id: input_boolean.bautrockner_restart
          - service: switch.turn_off
            data: {}
            target:
              entity_id: switch.sonoff_100142a7d7
      - conditions:
          - condition: and
            conditions:
              - condition: state
                entity_id: input_boolean.bautrockner_restart
                state: "on"
              - condition: template
                value_template: "{{trigger.id == '0'}}"
                alias: Boiler schaltet ab
        sequence:
          - service: input_boolean.turn_off
            data: {}
            target:
              entity_id: input_boolean.bautrockner_restart
          - service: switch.turn_on
            data: {}
            target:
              entity_id: switch.sonoff_100142a7d7
      - conditions:
          - condition: and
            conditions:
              - condition: state
                entity_id: binary_sensor.boiler_status
                state: "on"
              - condition: template
                value_template: "{{trigger.id == '2'}}"
                alias: Bautrockner schaltet ein
        sequence:
          - service: input_boolean.turn_on
            data: {}
            target:
              entity_id: input_boolean.bautrockner_restart
          - delay:
              hours: 0
              minutes: 0
              seconds: 10
              milliseconds: 0
          - service: switch.turn_off
            data: {}
            target:
              entity_id: switch.sonoff_100142a7d7
mode: single

many thanks to: