michaellunzer / Home-Assistant-Custom-Component-Fortnite

This is a Home-Assistant custom component that pulls Fortnite stats using the python API library from the site fortnitetracker.com
https://github.com/michaellunzer/Home-Assistant-Custom-Component-Fortnite
MIT License
4 stars 3 forks source link
custom-component fortnite fortnite-api fortnite-stats hacs home-assistant home-assistant-custom python

Fortnite Stats Sensors

GitHub Release GitHub Activity License

hacs Project Maintenance BuyMeCoffee

Discord Community Forum

Component to integrate with fortnite.

fortnite-logo

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:

And how many times you finish in the:

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 maybe you can submit a pull request for a Template Sensor in Home Assistant to aggregate it!

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

Contributions are welcome!

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