Setting brightness_pct to the value of a counter

Hey guys, I’m pretty new to home assistant. Sorry if I’m posting in the wrong section.

Right now I’ve been playing with this automation and would like to be able to adjust the brightness from my remote. I’m storing the brightness value in a counter that I can adjust from a pair of buttons. I’m running into issues setting my brightness percent to read the current value of my counter.

I realize even once this issue is resolved I still have some work to do.

alias: BR_Wall_Remote Light Cycle Key
description: ""
trigger:
  - platform: state
    entity_id:
      - counter.bedroom_light_counter
condition: []
action:
  - if:
      - condition: state
        entity_id: counter.bedroom_light_counter
        state: "0"
    then:
      - service: light.turn_off
        data:
          transition: 1
        target:
          entity_id: light.all_bedroom_lights
    else:
      - if:
          - condition: state
            entity_id: counter.bedroom_light_counter
            state: "1"
        then:
          - service: light.turn_off
            data:
              transition: 1
            target:
              entity_id: light.bedroom_desk_lamps
          - service: light.turn_on
            data:
              brightness_pct: counter.br_brightness
              color_temp: 425
              transition: 1
            target:
              entity_id: light.main_bedroom_lights
        else:
          - if:
              - condition: state
                entity_id: counter.bedroom_light_counter
                state: "2"
            then:
              - service: light.turn_off
                data:
                  transition: 1
                target:
                  entity_id: light.main_bedroom_lights
              - service: light.turn_on
                data:
                  brightness_pct: counter.br_brightness
                  color_temp: 425
                  transition: 1
                target:
                  entity_id: light.bedroom_desk_lamps
            else:
              - if:
                  - condition: state
                    entity_id: counter.bedroom_light_counter
                    state: "3"
                then:
                  - service: light.turn_on
                    data:
                      brightness_pct: counter.br_brightness
                      color_temp: 425
                      transition: 1
                    target:
                      entity_id: light.all_bedroom_lights
                else: []
mode: single

You will need to use a template to get the value of the counter entity.

brightness_pct: "{{ states('counter.br_brightness') | int }}"

Perfect! That worked exactly how I wanted, thanks so much!