Fortnite Home-Assistant Custom Component

September 15, 2020

fortnite-logo

Fortnite Home-Assistant Custom Component

This is a Custom Component to integrate with fortnite.

Project Maintenance BuyMeCoffee
GitHub Release GitHub Activity
License hacs
Discord Community Forum

Fortnite Stats

This 'fortnite' component is a Home Assistant custom sensor which shows you various stats accumulated while playing the very popular F2P game, Fortnite: Battle Royale.

Why?

It can show you how well you're playing the game with stats like:

  • How many kills you've earned
  • Kill/Death Ratio
  • Kills Per Game
  • Total Matches Played Per Mode
  • Your Fortnite Score
  • Your Score Earned Per Match
  • Your Win Ratio

And how many times you finish in the:

  • Top 1
  • Top 3
  • Top 5
  • Top 6
  • Top 10
  • Top 12
  • Top 25

Purpose

This is my first Home-Assistant Custom Component, so it's been a fun learning experience for me contributing to Open Source Software! This wouldn't been possible without the help from @xcodinas for building the fortnite-python library and from @clyra for helping refine my initial script and idea by further developing it towards a more finished product. From there I've added some extra tweaks, wrote the documentation, and published it in the Home-Assistant Community Store (HACS).

Screenshots

Fortnite-Stats-Overview-Kills-Screenshot

Fortnite-Stats-Solo-Screenshot

Fortnite-Stats-Duo-Screenshot

Fortnite-Stats-Squads-Screenshot

This component will set up the following platforms:

Platform Description
sensor Show stats pulled from fortnite API on https://fortnitetracker.com

Manual Installation

Download the fortnite.zip file from the latest release. Unpack the release and copy the custom_components/fortnite directory into the custom_components directory of your Home Assistant installation. Configure the fortnite sensor. Restart Home Assistant.

Installation via HACS (Preferred Method)

Ensure that HACS is installed. Search for and install the "fortnite" integration. Configure the fortnite sensor in configuration.yaml. Restart Home Assistant.

Configuration is done in YAML -> configuration.yaml

My username is Captain_Crunch88 and I play on the Nintendo Switch (use "GAMEPAD" in the config) if you want to test out the sensor. You'll need to register for an api key at https://fortnitetracker.com/site-api

sensor:
  - platform: fortnite
    name: Fortnite Solo Stats
    api_key: 12345678-90ab-cdef-ghij-lmnopqrstuvw
    player_id: Captain_Crunch88
    game_platform: "GAMEPAD"
    game_mode: "SOLO"
  - platform: fortnite
    name: Fortnite Duo Stats
    api_key: 12345678-90ab-cdef-ghij-lmnopqrstuvw
    player_id: Captain_Crunch88
    game_platform: "GAMEPAD"
    game_mode: "DUO"
  - platform: fortnite
    name: Fortnite Squads Stats
    api_key: 12345678-90ab-cdef-ghij-lmnopqrstuvw
    player_id: Captain_Crunch88
    game_platform: "GAMEPAD"
    game_mode: "SQUAD"

If you play on multiple platforms, you'll need to create multiple sensors for each platform you play on. For example if you play on the PC and Nintndo Switch, you'd use PC in one sensor and GAMEPAD in the other sensor. At this time there is no aggregate sensor, but you can always use a template sensor in home assistant to aggregate the values or submit a pull request!

Game Platform Config Value (ALL CAPS!)
PC PC
Xbox XBOX
PlayStation PSN
iPad & iPhone TOUCH
Nintendo Switch GAMEPAD
KBM KBM

This custom-component (v0.1.2) was last tested on version 2021.10.6 of Home-Assistant

Full Changelog & Releases

Contributions are welcome!

If you want to contribute to this please read the Contribution guidelines


Share: