On input of a doorsensor, turn on the light

Somewhere on this forum i found the solotion to add a ev1527 doorsensor.
I added the yalm to the configuration yaml, and it looks like the code set the input_boolean to on or off.

With this input boolean i want to turn on a light, but i can not manage it.
I think i am doing something wrong, but don’t know what?
Can somebody help?

This is the code i have placed in the configuration.yaml

binary_sensor:
  - platform: rflink
    devices:
      ev1527_0e0fb0_0a:
        name: Deur Hal Open
        off_delay: 1
      ev1527_0e0fb0_0e:
        name: Deur Hal Closed
        off_delay: 1

input_boolean:
  my_door_sensor_hal:

And this code i have placed in the automatation.yaml

alias: update_my_door_sensor_hal
description: ""
trigger:
  - platform: state
    entity_id: binary_sensor.deur_hal_open
    from: "off"
    to: "on"
  - platform: state
    entity_id: binary_sensor.deur_hal_closed
    from: "off"
    to: "on"
action:
  - service: >-
      input_boolean_turn_{% if trigger.to_state.object_id.split('_')[2] ==
      '0a'%}on{%else%}off{%endif%} entity_id: input_boolean.my_door_sensor_hal

When i open the door i can see that the input_boolean.my_door_sensor_hal is updated.

then i have to make an automation which see that the boolean is updated an than turn on a light.
I have made this automation, but it doesn’t work.

alias: lamp aan
description: ""
trigger:
  - platform: state
    entity_id:
      - input_boolean.my_door_sensor_hal
    from: "off"
    to: "on"
action:
  - service: light.turn_on
    target:
      entity_id: light.verlichting_hal_toilet
    data: {}

When i execute this uitomation by hand the lights turn on, but it is not executed by the first automation.

Does somebody what is wrong, or what i have to do?

I can’t see why the final automation won’t work but is there some reason you need the intermediate step of turning on or off the input_boolean?

Why not just turn the light on or off directly from the first automation?:

alias: update_my_door_sensor_hal
description: ""
trigger:
  - platform: state
    entity_id: binary_sensor.deur_hal_open
    from: "off"
    to: "on"
  - platform: state
    entity_id: binary_sensor.deur_hal_closed
    from: "off"
    to: "on"
action:
  - service: >-
      light.turn_{% if trigger.to_state.object_id.split('_')[2] == '0a'%}on{%else%}off{%endif%} 
    entity_id: light.verlichting_hal_toilet
alias: update_my_door_sensor_hal
description: ""
trigger:
  - id: 'on'
    platform: state
    entity_id: binary_sensor.deur_hal_open
    from: "off"
    to: "on"
  - id: 'off'
    platform: state
    entity_id: binary_sensor.deur_hal_closed
    from: "off"
    to: "on"
action:
  - service: 'input_boolean.turn_{{ trigger.id }}'
    target :
      entity_id: input_boolean.my_door_sensor_hal

Sorry for the late answer, but was a little bussy,
Both solution seems to work for me.

Thans both of you.