Formula 1 Racing sensor

Hi everyone. Newbie here so apologies if I have missed it but I’ve setup the F1 Sensor and setup to change colour of lights and also post selected changes to a group chat using the Telegram Bot.

The area I’m struggling with is where to find, within HA, the race control event messages - any ideas please?

I’ve seen them mentioned about but still cannot find them anywhere.

the integration provides a sensor for Track Status (Clear, Yellow, Red, etc)…is that maybe what you are looking for

edit…post below prob more what you are after, thanks Niklas

Hi @rob30

Race Control messages are only emitted as events right now, not as entities.

Look for the event type f1_sensor_race_control_event.

  • To inspect them: Developer Tools → Events → “Listen to events” and enter f1_sensor_race_control_event.
  • To forward them to your phone/Telegram, trigger an automation on that event and send the message[‘Message’] field.
alias: F1 – Race Control → notify
mode: queued

trigger:
  - platform: event
    event_type: f1_sensor_race_control_event

action:
  - service: notify.mobile_app_your_phone   # or notify.telegram / your notify service
    data:
      message: "{{ trigger.event.data.message['Message'] }}"

Note: the keys are capitalized (Message, Category, etc.), so use the bracket syntax [‘Message’].

This way, every time a Race Control message is received (like a flag or steward note), it will be sent to your phone as a notification.

1 Like

Is it possible to use the sensors in ESPHome? I tried to use them like I do for openweathermap, but no data is coming through. Any hints for me?

F1 Sensor is a Home Assistant integration, not an ESPHome component. So you cannot use it in ESPHome like openweathermap. If you want F1 data on an ESPHome device, mirror the HA entities via the Home Assistant API.

Many thanks, just installed the latest release and the error is no more, today will be the first time I really get to try this addon out in all its glory, Amazon has just delivered my new Tapo RGB LED lights, so off to the mancave I go to replace my Govee RGB LEDs lol. Again, thanks for all your time and effort which you put into this project. I’m sure everyone in the community appreciates it. :clap:

That´s awsome! Don´t forget to dial in the delay so you get a perfect timing on the light and you stream! Let us know how it turned out!

Thank you, that makes sense will give it a go.

Do I have to manually go into events and start listening each time or will it run constantly?

If I start listening and then go back to the events page later it’s not listening.

Oh, this is actually awesome. Just started with Home Assistant and I love motorsport. This will be added to the list. Thanks!

1 Like

The automation will always listen to events, you just need to do it manually if you want to se them

1 Like

Is there a way to adjust the delay at runtime / programmatically without having to reconfigure the integration in Settings?

No, it’s not. But it’s simple to reconfigure, you do not need to restart.

1 Like

I want to show: Lap [current] of [Total laps] but if I use “F1_race_lap_count” I get the current lap correctly but attribute “Total laps” is “unknown”. Is this a bug or am I doing something wrong? Or is there another sensor I should use?

The integration worked absolutely perfectly for the lighting at our Austin GP watch party today, thank you again for all the work on this.

1 Like

This isn’t something I can reproduce. What version are you on, and has it always been like this?

I’m on v2.2.2. But don’t get me wrong, let me rephrase my question: F1_race_lap_count provides me with correct “current lap”, but where/how can I get total laps so I can construct e.g. “Lap 12 of 56”?

It is an attribute to the sensor

OK, sorry for the confusion. I thought I used that but something went wrong. I will monitor it next race :slight_smile:
I use this piece of yaml code to display it (left out card stuff, etc.). Should this work?

  - type: custom:button-card
    entity: sensor.f1_race_lap_count
    name: Lap Count
    show_name: true
    show_label: true
    label: |
      [[[
        const current = entity.state || "0";
        const total = entity.attributes.total_laps || "?";
        return `${current} of ${total}`;
      ]]]

Many thanks for the support and for the awesome integration.

Yesterday i made this tiny f1 card for in overview mode er where ever ya want it
Here it is…

type: entities
entities:
  - type: custom:multiple-entity-row
    entity: sensor.f1_track_status
    icon: mdi:flag-checkered
    show_state: false
    entities:
      - entity: sensor.f1_track_status
        name: Track Status
      - entity: sensor.f1_session_status
        name: F1 Sessie Status
      - entity: sensor.f1_race_lap_count
        name: Rondes
      - entity: binary_sensor.f1_safety_car
        name: Safety Car
    card_mod:
      style:
        hui-generic-entity-row $: |
          .info {
            display: none;
          }
        .: |
          .entities-row {
           width: 100%;
           justify-content: space-evenly !important;
           }
          .entities-row div.entity:nth-child(1) {
          color:
          {% if is_state('sensor.f1_track_status', 'GREEN') %} #32cd32;
          {% elif is_state('sensor.f1_track_status', 'YELLOW') %} #ffd700;
          {% elif is_state('sensor.f1_track_status', 'VSC') %} #ffffc5;
          {% elif is_state('sensor.f1_track_status', 'CLEAR') %} #2a9df4;
          {% elif is_state('sensor.f1_track_status', 'RED') %} #ff4500;
          {% else %} light-grey;
          {% endif %}
          }
          .entities-row div.entity:nth-child(2) {
          color:
          {% if is_state('sensor.f1_session_status', 'ended') %} #b777f6;
          {% elif is_state('sensor.f1_session_status', 'pre') %} #ff1d8d;
          {% elif is_state('sensor.f1_session_status', 'live') %} #8a6642;
          {% elif is_state('sensor.f1_session_status', 'break') %} #90ee90;
          {% elif is_state('sensor.f1_session_status', 'finalised') %} #2a9df4;
          {% elif is_state('sensor.f1_session_status', 'finished') %} #3b83bd;
          {% else %} light-grey;
          {% endif %}
          }
          .entities-row div.entity:nth-child(4) {
          color:
          {% if is_state('binary_sensor.f1_safety_car', 'False') %} #32cd32;
          {% elif is_state('binary_sensor.f1_safety_car', 'True') %} #ff4500;
          {% else %} light-grey;
          {% endif %}
          }
state_color: false
card_mod:
  style: |
    .card-content {
      padding: 1px 2px 2px 2px; 
      spacing: -10px !important;
      }
     :host {
     --card-mod-icon-color:#2a9df4;
     }
     ha-card {
     height: 40px !important;
     }


The look depends ofcourse on what themes ya use…

The colors and names changes when states changes…
Example…
Ya see in the code …
Thanks for making this addon

2 Likes

Awesome, post a screen shot for of the card