Light Automation from Sensor Value

Afternoon again

I have the following code

light:
  - platform: flux_led
    automatic_add: true
    devices:
      192.168.1.25:
        name: bedroom_led
      192.168.1.27:
        name: kitchen_led 
sensor:
  - platform: rest
    resource: https://willsaps.herokuapp.com/api/v1/entries/current.json
    name: Wills BG
    value_template: '{{ value_json[0].sgv }}`

This returns a BG number which I would like to control the bedroom led

< 50 - Blue
> 50 < 200 Green
> 200 blue

Not been using HASS for long so would like some pointers on how to do this?

make a automation

- alias: Turn on light with color when sensor changes
  trigger:
    - platform: state
      entity_id: sensor.wills_bg
  action:
    - service: light.turn_on
      data_template:
        entity_id: light.bedroom_led
        color_name: >
          {% set value = trigger.to_state.state | float %}
          {{ 'green' if 50 <= value <= 200 else 'blue' }}