Help needed! Using REST Command in 'choose' option

Hello all.

first of all - i’m new to home assistant and no native english speaker, so i hope i’m able to explain my problem good enough.

I’m stuck with an automation that uses the ‘choose’ option to check what to do every minute and when the right conditions pass, it shall use a REST command to write a value into my heating system.
Using the REST command from other automations, that doesn’t start a ‘sequence’, but an ‘action’ works absolutely fine. Using the REST command from the developer tools/services tab, works fine also.

But since i rewrote my automation using ‘choose’ and therefore putting the service call after a ‘sequence’, the REST command isn’t working. This is the code:

- id: heizungstatus_nach_anwesenheit
  alias: Heizungsstatus jede Minute Prüfen und nach Anwesenheit Und Zeitprogramm setzen
  trigger:
    - platform: time_pattern
      minutes: /1
  action:
    - choose:
      - conditions:
        - condition: time
          alias: "Zwischen 22:59 Uhr und 05:01 Uhr - Zeitprogramm - tue nichts"
          after: " 22:59:00"
          before: " 05:01:00"
        sequence:
        - service: homeassistant.update_entity
      - conditions:
        - condition: and
          alias: "wenn niemand zuhause und Heizung auf Komfort, setze Heizung auf reduziert"
          conditions:
          - alias: "niemand zu Hause"
            condition: state
            entity_id: sensor.jemand_zu_hause
            state: 'False'
          - alias: "Heizungsstatus auf 114 - Heizbetrieb Komfort"
            condition: state
            entity_id: sensor.bsb_lan_status_heizkreis
            state: "114 - Heizbetrieb Komfort"
        sequence:
          - service: rest_command.bsb_lan_set_parameter
            data:
              parameter: 701
              value: 1
      - conditions:
        - condition: and
          alias: "wenn jemand zuhause und Heizung auf reduziert oder nachlauf, setze Heizung auf Komfort"
          conditions:
          - condition: state
            alias: "jemand zu Hause"
            entity_id: sensor.jemand_zu_hause
            state: 'True'
          - condition: or
            conditions:
              - condition: state
                alias: "Heizungsstatus auf 120 - Absenkung Reduziert"
                entity_id: sensor.bsb_lan_status_heizkreis
                state: "120 - Absenkung Reduziert"
              - condition: state
                alias: "Heizungsstatus auf 17 - Nachlauf aktiv"
                entity_id: sensor.bsb_lan_status_heizkreis
                state: "17 - Nachlauf aktiv"
        sequence:
          - service: rest_command.bsb_lan_set_parameter
            data:
              parameter: 701
              value: 0

The REST command in configurations.yaml, but like i said, it’s working fine when started as ‘action’

rest_command:
  bsb_lan_set_parameter:
    url: http://192.168.178.109/JS
    method: POST
    username: !secret bsb_lan_user
    password: !secret bsb_lan_pass
    # Parameter "type": 1 = SET (default), 0 = INF
    payload: '{"Parameter": "{{ parameter }}", "Value": "{{ value }}", "Type": "{% if type is defined %}{{ type }}{% else %}1{% endif %}"}'
    content_type: "application/json; charset=utf-8"

Surely its just a small thing, but i searched for two days now and i do not find any solution and tbh - i really do not understand, why its not passing the values. looking into the automation path, everything looks fine for me, it picks the right path and tells me the right step details - but nothing happens.

Anyone there who can help out? Thanks very much.

Home Assistant core-2021.8.5 is installed as Docker on an Synology Diskstation

I’m still not getting it.

At least i found a solution that works but that doesn’t mean that i understand that the above isn’t working. Just to explain - i now made two automations. One to set the parameter to ‘1’ and one to set it to ‘0’. Both use the same REST command as explained above, both use the same conditions as above. Difference is just - the above isn’t working, the following is:

- id: Heizung_reduziert_bei_abwesenheit
  alias: Heizungsstatus jede Minute Prüfen und nach Anwesenheit Und Zeitprogramm auf Reduziert setzen
  initial_state: on
  trigger:
    - platform: time_pattern
      minutes: /1
  condition:
    - condition: and
      conditions:
        - condition: time
          alias: "Zwischen 05:01 Uhr und 22:59 Uhr - Zeitprogramm"
          after: " 05:01:00"
          before: " 22:59:00"
        - condition: state
          alias: "jemand zu Hause"
          entity_id: sensor.jemand_zu_hause
          state: 'False'
        - condition: state
          alias: "Heizungsstatus auf 114 - Heizbetrieb Komfort"
          entity_id: sensor.bsb_lan_status_heizkreis
          state: "114 - Heizbetrieb Komfort"
  action:
    - alias: "Heizungsstatus auf Reduziert"
      service: rest_command.bsb_lan_set_parameter
      data_template:
        parameter: 701
        value: 1

- id: Heizung_automatik_bei_anwesenheit
  alias: Heizungsstatus jede Minute Prüfen und nach Anwesenheit Und Zeitprogramm auf Automatik setzen
  initial_state: on
  trigger:
    - platform: time_pattern
      minutes: /1
  condition:
    - condition: and
      conditions:
        - condition: time
          alias: "Zwischen 05:01 Uhr und 22:59 Uhr - Zeitprogramm"
          after: " 05:01:00"
          before: " 22:59:00"
        - condition: state
          alias: "jemand zu Hause"
          entity_id: sensor.jemand_zu_hause
          state: 'True'
        - condition: or
          conditions:
            - condition: state
              alias: "Heizungsstatus auf 120 - Absenkung Reduziert"
              entity_id: sensor.bsb_lan_status_heizkreis
              state: "120 - Absenkung Reduziert"
            - condition: state
              alias: "Heizungsstatus auf 17 - Nachlauf aktiv"
              entity_id: sensor.bsb_lan_status_heizkreis
              state: "17 - Nachlauf aktiv"
  action:
    - alias: "Heizungsstatus auf Automatik"
      service: rest_command.bsb_lan_set_parameter
      data_template:
        parameter: 701
        value: 0

The only thing i recognized is that with the above solution it takes two to five attempts to set the parameter at the target right while a manual trigger of the REST command works always first time.

Could anyone please help out and explain me why the automation in my first post isn’t transferring the data to the REST target but the above one is - at least after some attempts - and, of course, why a manual trigger of the same command works always instantly??

Would definiteley help me with further understanding an future automations.

Thanks, people.