Skip to content

Instantly share code, notes, and snippets.

@JoppeDC
Created December 1, 2025 11:20
Show Gist options
  • Select an option

  • Save JoppeDC/7356c969513e411ab9892d08787a8cd5 to your computer and use it in GitHub Desktop.

Select an option

Save JoppeDC/7356c969513e411ab9892d08787a8cd5 to your computer and use it in GitHub Desktop.
alias: F1 Lamp - Sync With Race Flags
description: "Sync the lamp with the flags"
triggers:
- entity_id:
- sensor.f1_track_status
- sensor.f1_current_session
- binary_sensor.f1_safety_car
trigger: state
actions:
- data:
name: F1 Lamp Debug
message: >
session={{ current_session }}, track={{ track_status }}, active={{
session_active }}, sc={{ sc_active }}
action: logbook.log
- choose:
- conditions:
- condition: template
value_template: "{{ session_active and track_status == 'RED' }}"
sequence:
- target:
entity_id: select.f1lamp_playlist
data:
option: "{{ playlist_red }}"
action: select.select_option
- conditions:
- condition: template
value_template: "{{ session_active and sc_active }}"
sequence:
- target:
entity_id: select.f1lamp_playlist
data:
option: "{{ playlist_sc }}"
action: select.select_option
- conditions:
- condition: template
value_template: "{{ session_active and track_status == 'VSC' }}"
sequence:
- target:
entity_id: select.f1lamp_playlist
data:
option: "{{ playlist_vsc }}"
action: select.select_option
- conditions:
- condition: template
value_template: "{{ session_active and track_status == 'YELLOW' }}"
sequence:
- target:
entity_id: select.f1lamp_playlist
data:
option: "{{ playlist_yellow }}"
action: select.select_option
- conditions:
- condition: template
value_template: "{{ session_active and track_status == 'CLEAR' }}"
sequence:
- target:
entity_id: select.f1lamp_playlist
data:
option: "{{ playlist_green_resume }}"
action: select.select_option
default:
- target:
entity_id: select.f1lamp_playlist
data:
option: "{{ playlist_idle }}"
action: select.select_option
mode: single
variables:
playlist_idle: IDLE
playlist_yellow: YellowFlag
playlist_sc: SC
playlist_vsc: VSC
playlist_red: RedFlag
playlist_green_resume: GreenFlag
playlist_finish: CHEQ
track_status: "{{ states('sensor.f1_track_status') }}"
current_session: "{{ states('sensor.f1_current_session') }}"
session_active: |
{{ current_session in [
'Practice 1', 'Practice 2', 'Practice 3',
'Qualifying', 'Sprint Qualifying', 'Sprint', 'Race'
] }}
sc_active: |
{{ is_state('binary_sensor.f1_safety_car', 'on')
or track_status == 'SC' }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment