# F1 race

**URL:** <https://community.homey.app/t/f1-race/146292>\
**Category:** Questions & Help\
**Created:** [December 2, 2025, 5:27pm UTC](https://community.homey.app/t/f1-race/146292 "2025-12-02T17:27:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benvo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/benvo/32/79462_2.png) [@Benvo](https://community.homey.app/u/Benvo)\
**Post date:** [December 2, 2025, 5:27pm UTC](https://community.homey.app/t/f1-race/146292/1 "2025-12-02T17:27:30Z")

</div>

I saw a video in which a lamp reacts to the live status of a yellow flag, safety car, or for example a red flag.

Below the video there was a link, which I will include below. In the link you can see that someone has created an F1 sensor for Home Assistant.

Does anyone know if this can be made for Homey Pro, and if so, how?

> **[Formula 1 Racing sensor](https://community.home-assistant.io/t/formula-1-racing-sensor/880842)**
>
> I have made a Formula 1 Sensor, a custom integration specifically designed to leverage Home Assistant for automations, notifications, and advanced setups based around Formula 1 race events. What does F1 Sensor provide? This integration fetches...

---

<div class="post-metadata">

**Author:** ![DaneedeKruyff](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/daneedekruyff/32/964_2.png) [@DaneedeKruyff](https://community.homey.app/u/DaneedeKruyff)\
**Post date:** [December 2, 2025, 5:57pm UTC](https://community.homey.app/t/f1-race/146292/2 "2025-12-02T17:57:04Z")

</div>

ChatGPT  
Q: “Can this code be used as an inspiration to build a Homey app that features a device that can act as a representation of the flags in a race. Green all ok, Yellow or red for caution and a stopped session: [GitHub - Nicxe/f1\_sensor: A Home Assistant Custom Integration that provides information about the next Formula 1 race and the full season calendar including Live data like race flags and Race Control messages](https://github.com/Nicxe/f1_sensor)”

A: Yes — the code from F1 Sensor could definitely serve as inspiration for building a Homey app / integration that represents race-flags via a device (lights or indicators). Here’s how and what to watch out for (both pros and cons):

* * *

## ✅ What works — why it’s a good base/inspiration

- F1 Sensor already provides live data about the race: session state (practice / qualifying / race), track status (CLEAR, YELLOW, RED, etc.), safety-car, etc. ([newreleases.io](https://newreleases.io/project/github/Nicxe/f1_sensor/release/v2.0.0?utm_source=chatgpt.com "Nicxe/f1\_sensor v2.0.0 on GitHub"))
- You could take those statuses and map them to a “virtual device” or actual light in Homey (e.g. green = all clear; yellow/red = caution/stop).
- On Homey, custom devices are modeled with _capabilities_ (e.g. on/off, color) and device classes (e.g. “light”) so a device controlling a colored light as flag-indicator fits naturally. ([homey.app](https://homey.app/en-nl/blog/a-technical-introduction-homey/?utm_source=chatgpt.com "A technical introduction to Homey – Behind the Magic | Homey"))
- If you build a Homey driver or app that either fetches the same F1 feed (or indirectly via a service like F1 Sensor + a bridge) you can create flows that trigger color changes or other behaviors when flag status changes.

* * *

## ⚠ What needs extra work / limitations & what may not work out of the box

- F1 Sensor is built for Home Assistant, not Homey. The integration uses Home Assistant APIs/events; it’s _not_ designed as a generic “flag feed to device” abstraction. ([nicxe.github.io](https://nicxe.github.io/f1_sensor/help/faq?utm_source=chatgpt.com "FAQ | F1 Sensor"))
- You cannot directly use F1 Sensor inside Homey — you’d need to port the logic: either replicate how it fetches F1 data (API calls, parsing) or have Home Assistant + a bridge/pass-through (e.g. MQTT) to feed Homey. The F1 Sensor docs explicitly state that you can mirror its output to e.g. an ESPHome device — but not directly inside another platform. ([nicxe.github.io](https://nicxe.github.io/f1_sensor/help/faq?utm_source=chatgpt.com "FAQ | F1 Sensor"))
- On the Homey side you need to implement a custom “device driver/app” (or perhaps a “virtual device/app”) that listens for the data feed and then updates the device capabilities (e.g. change light color / on-off). That requires familiarity with Homey’s SDK, capabilities, device classes, flows, etc. ([apps.developer.homey.app](https://apps.developer.homey.app/the-basics/devices?utm_source=chatgpt.com "Drivers & Devices | Homey Apps SDK"))
- Latency / synchronization: live race data (like flag change) often comes via API with some delay. If you use a broadcast video, delays may accumulate — you’d need to handle that (maybe allow offset/delay config like F1 Sensor does). ([newreleases.io](https://newreleases.io/project/github/Nicxe/f1_sensor/release/v2.0.0?utm_source=chatgpt.com "Nicxe/f1\_sensor v2.0.0 on GitHub"))

* * *

## 🎯 What you should do to use it as real inspiration / starting point

1. Review F1 Sensor’s source: especially how it fetches and exposes sensors like `f1_track_status`, `f1_session_status`, safety car, etc. It shows clearly which states exist. ([GitHub](https://github.com/Nicxe/f1_sensor "GitHub - Nicxe/f1\_sensor: A Home Assistant Custom Integration that provides information about the next Formula 1 race and the full season calendar including Live data like race flags and Race Control messages"))

2. Decide how to get data into Homey:

3. Define a Homey “device” with appropriate capabilities (e.g. on/off, color) so flows can act on it as a “flag-light”. ([apps.developer.homey.app](https://apps.developer.homey.app/the-basics/devices?utm_source=chatgpt.com "Drivers & Devices | Homey Apps SDK"))

4. In your Homey app, map the race states to the corresponding color or indicator.

5. Handle edge cases (e.g. connectivity loss, delays, session transitions, fallback when no race, etc.).

* * *

## 💡 Conclusion — Balanced view

Using F1 Sensor as inspiration is feasible and might save time understanding what data is available and how race-states can be structured. But it’s **not an easy plug-and-play** : you’ll need to adapt or reimplement data fetching and build a proper Homey driver/app on top of it.

If you want — I can draft a **rough high-level design outline** for how a Homey app based on F1 Sensor could look (data flow, device definition, error handling).

Here’s a **clean, direct high-level design outline** for a Homey app that uses F1 race-data (inspired by F1 Sensor) to drive a “race flag” device.

* * *

# **Homey App Design — F1 Race Flag Device**

## 1. **Data Source**

Replicate how F1 Sensor fetches data:

- Poll the same API (the “unofficial F1 live timing” endpoints F1 Sensor uses).

- Extract:

You do **not** need Home Assistant. Just implement the fetcher directly in the Homey app.

* * *

## 2. **Device Type in Homey**

Create a driver with one device class, e.g.:

**Device class:** `light`  
**Capabilities:**

- `onoff`
- `light_hue` (color)
- `light_saturation`
- `measure_string` (optional text capability: “Track Status: YELLOW”)

This lets flows and dashboards treat it as a color indicator.

* * *

## 3. **Mapping F1 States → Light Colors**

Implement simple state-mapping:

- **Track CLEAR → Green**
- **Track YELLOW → Yellow**
- **Track RED → Red**
- **Safety Car → Flashing yellow (or solid yellow if flashing is not practical)**
- **Session STOPPED → Red**
- **No race running → Light off**

* * *

## 4. **Flow Triggers**

Provide triggers like:

- _“Track status changed”_
- _“Session state changed”_
- _“Race started / ended”_

Useful for automations (e.g. replay lighting, TV actions).

* * *

## 5. **Settings Page**

Allow user to configure:

- Refresh interval (e.g. 3–10 seconds)
- Delay offset (to sync with TV stream)
- Turn light off outside race weekend
- Type of color mode (solid / animate)

* * *

## 6. **Update Loop**

Homey app cron task:

1. Fetch F1 data
2. Parse track state
3. Compare with previous state
4. Update device capabilities
5. Trigger flows if changed

Keep it lightweight to avoid app suspension.

* * *

## 7. **Error Handling**

- If API unavailable → set state to “UNKNOWN” (light off or white).
- If session not active → device off.
- If repeated failures → expose warning in the device (“data source offline”).

* * *

## 8. **Optional Enhancements**

- Add capabilities for:

- Add multiple devices (e.g. one global flag, one per sector).

* * *

If you want, I can provide:

- A **Homey app skeleton (SDK v3)** with the driver structure
- Example code for the **fetch loop**
- The **capabilities.json** and **driver manifest**
- A **color-mapping helper** that fits Homey’s hue values

---

<div class="post-metadata">

**Author:** ![DaneedeKruyff](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/daneedekruyff/32/964_2.png) [@DaneedeKruyff](https://community.homey.app/u/DaneedeKruyff)\
**Post date:** [December 2, 2025, 6:00pm UTC](https://community.homey.app/t/f1-race/146292/3 "2025-12-02T18:00:42Z")

</div>

LOL, this is the code it provided, haven’t checked it, but I think this can work:

Probably need to create an app skeleton with homey compose first and start from there.

But first, start here: [Getting Started | Homey Apps SDK](https://apps.developer.homey.app/the-basics/getting-started)

```auto
// Folder structure (all in one document for the skeleton)
//
// /app.json
// /drivers/f1-flag/device.js
// /drivers/f1-flag/driver.js
// /drivers/f1-flag/driver.compose.json
// /app.js
// /lib/api.js
//
// ------------------------------------------------------------
// app.json
// ------------------------------------------------------------
{
  "id": "com.example.f1flags",
  "name": {
    "en": "F1 Flags"
  },
  "version": "1.0.0",
  "compatibility": ">=12.0.0",
  "sdk": 3,
  "category": ["lights"],
  "permissions": [],
  "drivers": [
    {
      "id": "f1-flag",
      "name": { "en": "F1 Race Flag" }
    }
  ]
}

// ------------------------------------------------------------
// app.js
// ------------------------------------------------------------
'use strict';

const Homey = require('homey');

class F1FlagsApp extends Homey.App {
  async onInit() {
    this.log('F1 Flags app started');
  }
}

module.exports = F1FlagsApp;

// ------------------------------------------------------------
// drivers/f1-flag/driver.compose.json
// ------------------------------------------------------------
{
  "name": {
    "en": "F1 Flag Indicator"
  },
  "class": "light",
  "capabilities": [
    "onoff",
    "light_hue",
    "light_saturation",
    "measure_string"
  ],
  "pair": [
    {
      "id": "auto"
    }
  ]
}

// ------------------------------------------------------------
// drivers/f1-flag/driver.js
// ------------------------------------------------------------
'use strict';

const Homey = require('homey');

class F1FlagDriver extends Homey.Driver {
  async onInit() {
    this.log('F1 Flag driver init');
  }
}

module.exports = F1FlagDriver;

// ------------------------------------------------------------
// drivers/f1-flag/device.js
// ------------------------------------------------------------
'use strict';

const Homey = require('homey');
const F1Api = require('../../lib/api');

class F1FlagDevice extends Homey.Device {
  async onInit() {
    this.log('F1 Flag device ready');

    this.api = new F1Api();
    this.previousState = null;

    this.pollInterval = setInterval(() => this.updateState(), 5000);
  }

  async updateState() {
    try {
      const data = await this.api.getTrackStatus();
      if (!data) return;

      const flag = data.status; // CLEAR / YELLOW / RED

      if (flag !== this.previousState) {
        this.previousState = flag;
        await this.applyFlag(flag);
      }
    } catch (err) {
      this.log('Error updating state:', err);
    }
  }

  async applyFlag(flag) {
    // map flag → hue/saturation
    let hue = 0;
    let sat = 1;

    switch (flag) {
      case 'CLEAR': // green
        hue = 0.33;
        break;
      case 'YELLOW':
        hue = 0.15;
        break;
      case 'RED':
        hue = 0.0;
        break;
      default:
        await this.setCapabilityValue('onoff', false);
        return;
    }

    await this.setCapabilityValue('onoff', true);
    await this.setCapabilityValue('light_hue', hue);
    await this.setCapabilityValue('light_saturation', sat);
    await this.setCapabilityValue('measure_string', flag);
  }

  async onDeleted() {
    clearInterval(this.pollInterval);
  }
}

module.exports = F1FlagDevice;

// ------------------------------------------------------------
// lib/api.js
// ------------------------------------------------------------
'use strict';

const fetch = require('node-fetch');

class F1Api {
  async getTrackStatus() {
    // Replace this with actual F1 endpoint logic
    try {
      const res = await fetch('https://example.com/f1/status');
      if (!res.ok) return null;
      return await res.json();
    } catch (e) {
      return null;
    }
  }
}

module.exports = F1Api;

```

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [December 2, 2025, 6:02pm UTC](https://community.homey.app/t/f1-race/146292/4 "2025-12-02T18:02:02Z")

</div>

DaneeGPT? 😜😉

---

<div class="post-metadata">

**Author:** ![Benvo](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/benvo/32/79462_2.png) [@Benvo](https://community.homey.app/u/Benvo)\
**Post date:** [December 2, 2025, 6:16pm UTC](https://community.homey.app/t/f1-race/146292/5 "2025-12-02T18:16:34Z")

</div>

Thank you for your very detailed response.

Unfortunately, this is beyond my understanding.

---

<div class="post-metadata">

**Author:** ![DaneedeKruyff](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/daneedekruyff/32/964_2.png) [@DaneedeKruyff](https://community.homey.app/u/DaneedeKruyff)\
**Post date:** [December 2, 2025, 7:44pm UTC](https://community.homey.app/t/f1-race/146292/6 "2025-12-02T19:44:28Z")

</div>

Well, to be honest, I just asked ChatGPT (which incidentally is down now 🤔😂) and that’s where the answer comes from.

Maybe someone here will pick it up and turn it into an actual app, who’s up for the challenge?

🫣

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/f/6/f62ad3bc4e0555d9a5e37f34637e06edcef336fa.png)
