Skip to content

aijkl/open-weight

Repository files navigation

OpenWeight

Fit8sと通信して体重を自動取得します

image image

デーモンコマンド

AA:89:5E:18:DA:91はFit8sのマックアドレスです、hcitoolで調べる必要があります
sudo hcitool -i hci0 lescan --duplicatesでキャプチャできます、ベンダーコードは同じなので見つけやすいと思います

hci0はBluetoothのアダプタ名です

Exmaple

dotnet OpenWeight.Cli.dll daemon AA:89:5E:18:DA:91 hci0 --connection-string "Data Source=weight.db"

--connection-string

このオプションを有効にするとDBに体重を記録しまう dotnet OpenWeight.Cli.dll daemon AA:89:5E:18:DA:91 hci0 --connection-string "Data Source=weight.db"

--discord-settings-path

このオプションを有効にすると設定ファイルに基づいてユーザーのニックネームを変更します
ニックネームの変更にはBOTにニックネームの変更権限が与えられている必要があります
dotnet OpenWeight.Cli.dll daemon AA:89:5E:18:DA:91 hci0 --connection-string "Data Source=weight.db" --discord-settings-path ./discord.json

{
  "token": "",
  "guildUsers": [
    {
      "guildId": 836823009527332884,
      "userId": 536802665498411013,
      "scribanPattern": "みかん@{{event_data.data.weight}}キロ"
    }
  ],
  "intervalMs": 10000,
  "errorIntervalMs": 300000
}

image

通信について

BLE (Bluetooth Low Energy)のアドバタイズパケットとしてブロードキャストで体重が飛んできます
特に認証とか暗号化とかはありません、体重なので重要ではないとの認識でブロードキャストしてる見たいです

アドレスが10-12までです、リトルエンディアンで送られてくるのでビックエンディアンに変換してあげる必要があります
image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages