NFC Tag - Change brightness

Hi

Trying to get an automation that does the following.

When scanned/toggled it switched the brightness from 30 to 100 or 100 to 30 of some lights.

This is what I have ATM

alias: Tag Living Room Lights is scanned
description: ""
trigger:
  - platform: tag
    tag_id: 1f78bcf6-73b6-4812-84b1-695841371d99
condition: []
action:
  - service: light.turn_on
    target:
      entity_id:
        - light.hue_go
        - light.hue_play_left
        - light.hue_play_right
        - light.hue_play_centre
    data:
      brightness_pct: "{{ 30 if trigger.to_state.state == 'off' else 100 }}"
mode: single

I think it is the triger.to state that is causing the issue but not sure how to resolve.

Thanks