-
-
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' }} |
If you don't see Safety Car, there is a bug in the latest release 4.0, you need to download the Beta version. But yes, I've stopped using it - just need to see if it still works during the race. If not I'll need to swap out the Entity State to Safety Car Ah, didn't spotted that I hadn't used CHEQ - will need to add this to my Conditions
You can use either a Preset (easier) or a Playlist - You need a Preset for a Playlist to attach too - so just use Preset. I was showing a simple approach. Not sure I understand what you mean to "indicate the current P1 driver"...
Enjoy your party.. I have loads of LEDs configured in HA, asked the wife if I can set these up to match too... not a chance... lolP1, so who ever is currently leading race, think there in an entity for top three or something.
Did you ever figure this out? This is exactly what I want to do as well, have the 1-part of the logo indicate either P1 or P1-3. There is a seperate entity for P1, P2 and P3 I saw in the F1 Sensor docs, but I can't figure out how to add that to the automation
I ended up dedicating my F1 logo box to just race leader and I added lights behind TV for race status. Here is my code that changes logo to match P1. I have a preset for every driver on WLED named with first three of last names.

Did you ever figure this out? This is exactly what I want to do as well, have the 1-part of the logo indicate either P1 or P1-3. There is a seperate entity for P1, P2 and P3 I saw in the F1 Sensor docs, but I can't figure out how to add that to the automation