FitX Gym Utilization via RESTful Sensor in Home Assistant

Hello everyone,

I’ve been a member of FitX gyms for a while now, and I was frustrated by the lack of a straightforward way to check gym utilization without having to provide user credentials. So, I decided to build my own automation that fetches the studio utilization data every 10 minutes - without requiring any user data.

Why I Built This
I initially tried using the existing HACS integration for FitX, but I ran into several issues:

  • It required user credentials, which I wasn’t comfortable sharing.
  • When trying to monitor more than five gyms, adding the sixth and beyond always caused errors.

To solve these problems, I analyzed the FitX API and discovered an endpoint that works seamlessly without needing authentication. Now, everything runs smoothly!

How It Works
Here’s the RESTful sensor configuration I use in Home Assistant:

  - platform: rest
    name: "FitX Essen-Bergerhausen"
    unique_id: "fitx_essen_bergerhausen"
    resource: "https://mein.fitx.de/nox/public/v1/studios/1484699660/utilization"
    headers:
      x-tenant: fitx
    value_template: >
      {% set val = value_json['items']  | selectattr('isCurrent', 'equalto', true) | map(attribute='percentage') | list | first | default(0) %}
      {{ val | round(0) }}
    scan_interval: 600
    unit_of_measurement: "%"
    state_class: measurement
    icon: mdi:dumbbell

To find your gym’s studio ID, you can use this tool: https://fitx-proxy.daniel-stefan.dev/. The ID is listed under “Magicline” and may occasionally change. If it does, you might need to update it manually or create a routine to keep it current.

Dashboard Setup
I’ve also created a dynamic dashboard that sorts gyms by their current utilization percentage. This makes it easy to see which gym is least crowded at any given time. Here’s a screenshot of my dashboard:

image

type: custom:auto-entities
card:
  type: entities
  title: Auslastungen 🚗 (sortiert nach %)
  state_color: false
filter:
  include:
    - entity_id: sensor.fitx*
sort:
  method: state
  numeric: true

Final Thoughts
This setup has been working flawlessly for me, and I’m happy to share it with anyone facing similar challenges. If you notice frequent changes in studio IDs or have suggestions for improvements, feel free to share!

Cheers! :blush: