Some ways to control Home-Assistant from Fitbit Sense

A few weeks ago I got a new FitBit Sense. Up until now I have had Fitbit Charge 2, 3 and 4. The cool thing with the Sense is that it run Fitbit OS, and with Fitbit OS it can run apps. Most apps are useless, but what I really need is a way to control Home-Assistant. Lights, TV and so on.
This was harder than expected and I have not found a perfect way to do this yet, but I will summarize the different solutions I have tested here in this article. Keep in mind that even if other Fitbit-devices also run Fitbit OS, the apps in the gallery (app store) might not be compatible with all models.

Preparations in Home-Assistant

These methods is all using the Home-Assistant API, and this needs to be activated. For this to work just add this simple code to your configuration.yaml:

api:

To authenticate with the API a Long-Lived Access Tokens is needed, this can be created at the bottom of your profile page (in Home-Assistant).
Copy and store the token securely, this will not be possible to read again at at later point. More info on that here.

Testing the API can be done using CURL (Also available for Windows).

curl -X GET -H "Authorization: Bearer ey*********Vs" -H "Content-Type: application/json" https://home-assistant.mydomain.top/api/

Reply should be:

{"message": "API running."}

It is also in a way possible to communicate with the API trough webhooks, and some of the methods are using this insted of “normal API”

You also need to have Home-Assistant accessible over the internet if you plan to use this non-local. For Home-Use a WiFi and a local IP-address should work. HTTPS might be a requirement for some or all of these app. I have not tried with just HTTP.
I am using a reverse proxy and a domain name combined with Let’s Encrypt to reach my Home-Assistant interface, so my address is https://home-assistant.<mydomain>.com/. An address like https://<ip>:<port>/ should work just as good.

I am not using Nabu Casa Remote UI, so I have not testet any of these methods with that.

Creating webhooks

A webhook is realy just a url that trigger an automation, so this is made just like a normal automation with webhook as the trigger platform.
The URL will be https:/<mydomain>.com/api/webhook/<webhook_id> or https://<ip>:<port>/api/webhook/<webhook_id>.

Example: Toggle TV on/off

alias: 'Webhook: fitbit_tv_toggle'
description: ''
trigger:
  - platform: webhook
    webhook_id: fitbit_tv_toggle
condition: []
action:
  - service: remote.send_command
    data:
      command: PowerToggle
      delay_secs: 0.1
      device: '52818462'
    target:
      entity_id: remote.livingroom
mode: single

Example: Toggle Light on (100% brightness)/off

alias: 'Webhook: fitbit_lamp_toggle'
description: ''
trigger:
  - platform: webhook
    webhook_id: fitbit_lamp_toggle
condition: []
action:
  - service: light.toggle
    data:
      brightness_pct: 100
    target:
      entity_id: light.lamp
mode: single

Apps


KAPCSOLOK (v1.0 / 23.02.2022)

URL: https://gallery.fitbit.com/details/fceb0171-32fe-4a50-b95a-c94e1ffee0a0
This app is just available in Hungarian, but with Google translate I found out how it worked, and it is actually very good.
It is possible to add up to 5 different web hooks. When clicked it will also respond if the call was successful.

Settings:

  • 1 Gomb (1. Button) (same principle below 2 Gomb, 3 Gomb, 4 Gomb and 5 Gomb)
    • Gombnév: (Button name, the title of the button) Lamp
    • URL: (The webhook url) https://home-assistant.<mydomain>.com/api/webhook/fitbit_lamp_toggle
    • Adat: (Custom data) "Content-Type:application/json"
Information
Settings

IoT Button (v0.0.1 / 29.03.2022)

URL: https://gallery.fitbit.com/details/5ce40571-a58d-4459-82e0-24fcf3fc52cb
This app works very well, it just has this one problem that is only support one single api call.

Settings:

  • HTTP
    • Method: POST
    • URL: (The url to the service that should be called) https://home-assistant.<mydomain>.com/api/services/light/toggle
    • Body: (The JSON data) {"entity_id": "light.lamp"}
  • Headers
    • Authorization: Bearer ey*********Vs
    • Content-Type:application/json
  • Appearance
    • (Select label color) Blue
  • Label
    • (the title of the button) Lamp
Information
Settings

just-webhook (v0.1.5 / 23.10.2021)

URL: https://gallery.fitbit.com/details/5ce40571-a58d-4459-82e0-24fcf3fc52cb
This app works in a little different way, on the bad side it just support one single webhook. The advantage of this app is that it transmit when the app is launched, then it closes again, so the action will be a single-click operation.

Settings:

  • Method: POST
  • Webhook URL (HTTPS only): (The webhook url) https://home-assistant.<mydomain>.com/api/webhook/fitbit_lamp_toggle
Information
Settings

Home-Assistant Specific apps

For Fitbit Sense there is two apps in the gallery that is made specifically for Home-Assistant, these are Home Butler (v2.1.0 / 23.12.2020) and HA Remote (v0.6.1 / 07.03.2022). I got Home Butler to work, but it is messy (no filter of entities) and just some of the entities works, and just sometimes. When it comes to HA Remote I did not manage to get this one working.

Summary

Until I find a better solution I think KAPCSOLOK is the app that is best for my use, and this is the one I will keep.
In the future I will try other methods, and I am also thinking about using other more supported systems as gateway for this use-case. If I find any better solution there might be a new post about it. I am also interested in solutions, so share if you have.

Share