JGAguado / 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

Home Page:https://github.com/michaellunzer/Home-Assistant-Custom-Component-Fortnite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  • 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 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


About

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

License:MIT License


Languages

Language:Python 100.0%