A Home Assistant integration that fetches Clash Royale player statistics using the official Clash Royale API.
- 🏆 Player Statistics: Track trophies, wins, losses, and more
- 👑 Clan Information: View clan membership and role
- 📊 Real-time Updates: Configurable update intervals
- 🎮 Multiple Players: Support for multiple player accounts
- ⚙️ Easy Configuration: Simple setup through Home Assistant UI
- Open HACS → Integrations → Search for "Clash Royale"
- Install and restart Home Assistant
- Go to Settings → Devices & Services → Add Integration
- Download the latest release from the releases page
- Copy the
clash_royalefolder to yourconfig/custom_components/directory - Restart Home Assistant
- Visit the Clash Royale Developer Portal
- Create an account or log in
- Click on My Account
- Create a new API key
- Important: Add your Home Assistant IP address to the allowed IPs list
- Go to Settings → Devices & Services in Home Assistant
- Click Add Integration
- Search for "Clash Royale"
- Enter your API token when prompted
- Enter your player tag (format:
#28g0j92jyor28g0j92jy) - Click Submit
Your player tag can be found in the Clash Royale app:
- Open Clash Royale
- Tap on your profile
- Your player tag is displayed at the top (e.g.,
#28g0j92jy)
The integration supports the following configuration options:
| Option | Description | Default |
|---|---|---|
| Update Interval | How often to fetch data (seconds) | 300 (5 minutes) |
To change options:
- Go to Settings → Devices & Services
- Find your Clash Royale integration
- Click Configure
- Adjust the update interval as needed
The integration creates a sensor for each configured player with the following information:
- Trophies: Current trophy count
-
Player Information:
- Player name
- Player tag
- Level
- Current trophies
- Best trophies
-
Battle Statistics:
- Wins
- Losses
- Battle count
- Three crown wins
-
Tournament & Challenge Data:
- Challenge cards won
- Challenge max wins
- Tournament cards won
- Tournament battle count
-
Clan Information:
- Clan name
- Clan tag
- Clan role
- Clan badge ID
-
Donations:
- Current season donations
- Donations received
- Total donations
type: entities
title: Clash Royale Stats
entities:
- entity: sensor.clash_royale_28g0j92jy
name: "Current Trophies"
- type: attribute
entity: sensor.clash_royale_28g0j92jy
attribute: player_name
name: "Player Name"
- type: attribute
entity: sensor.clash_royale_28g0j92jy
attribute: clan_name
name: "Clan"
- type: attribute
entity: sensor.clash_royale_28g0j92jy
attribute: wins
name: "Total Wins"automation:
- alias: "Clash Royale Trophy Milestone"
trigger:
- platform: numeric_state
entity_id: sensor.clash_royale_28g0j92jy
above: 5000
action:
- service: notify.mobile_app_your_phone
data:
message: "🏆 Congratulations! You've reached {{ states('sensor.clash_royale_28g0j92jy') }} trophies!"-
"Invalid API token" error
- Verify your API token is correct
- Check that your Home Assistant IP is in the allowed IPs list on the developer portal
- Make sure the API key hasn't expired
-
"Player not found" error
- Double-check your player tag format
- Ensure the player tag exists and is spelled correctly
-
Data not updating
- Check your internet connection
- Verify the Clash Royale API status
- Review Home Assistant logs for error messages
This integration is NOT affiliated with, endorsed, or sponsored by Supercell or Clash Royale. This is an unofficial third-party integration that uses the publicly available Clash Royale API.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Check the troubleshooting section
- Search existing issues
- Create a new issue with detailed information