更新 'repository.yaml'
This commit is contained in:
7
mi-scale/CHANGELOG.md
Normal file
7
mi-scale/CHANGELOG.md
Normal file
@@ -0,0 +1,7 @@
|
||||
### 0.3.6-1(2024-07-30)
|
||||
|
||||
- 版本升级
|
||||
|
||||
### 0.3.6(2022-10-10)
|
||||
|
||||
- 首次提交
|
||||
72
mi-scale/DOCS.md
Normal file
72
mi-scale/DOCS.md
Normal file
@@ -0,0 +1,72 @@
|
||||
# 小米体脂称
|
||||
|
||||
## 支持的电子秤
|
||||
|
||||
支持类型:
|
||||
Name | Model | Picture
|
||||
--- | --- | ---
|
||||
[Mi Smart Scale 2](https://www.mi.com/global/scale) | XMTZC04HM | <img alt="Mi Scale_2" src="https://raw.githubusercontent.com/lolouk44/xiaomi_mi_scale/master/Screenshots/Mi_Smart_Scale_2_Thumb.png" width="150">
|
||||
[Mi Body Composition Scale](https://www.mi.com/global/mi-body-composition-scale/) | XMTZC02HM | <img alt="Mi Scale" src="https://raw.githubusercontent.com/lolouk44/xiaomi_mi_scale/master/Screenshots/Mi_Body_Composition_Scale_Thumb.png" width="150">
|
||||
[Mi Body Composition Scale 2](https://c.mi.com/thread-2289389-1-0.html) | XMTZC05HM | <img alt="Mi Body Composition Scale 2" src="https://raw.githubusercontent.com/lolouk44/xiaomi_mi_scale/master/Screenshots/Mi_Body_Composition_Scale_2_Thumb.png" width="150">
|
||||
|
||||
## 配置说明
|
||||
配置项 | 类型 | 必填项 | 说明
|
||||
--- | --- | --- | ---
|
||||
HCI_DEV | string | 否 | 蓝牙地址。默认为 `hci0`
|
||||
BLUEPY_PASSIVE_SCAN | bool | 否 | 如果像在 Raspberry Pi 上出现错误 `Bluetooth connection error: Failed to execute management command ‘le on’` ,请尝试设置为 true。默认为 `false`
|
||||
MISCALE_MAC | string | 是 | 秤的 MAC 地址
|
||||
MQTT_PREFIX | string | 否 | MQTT 主题前缀,默认为`miscale`
|
||||
MQTT_HOST | string | 是 | MQTT 服务器,默认为`127.0.0.1`
|
||||
MQTT_USERNAME | string | 否 | MQTT 服务器的用户名(如果不需要,则注释掉)
|
||||
MQTT_PASSWORD | string | 否 | MQTT 服务器的密码(如果不需要,则注释掉)
|
||||
MQTT_PORT | int | 否 | MQTT 服务器的端口,默认为 1883
|
||||
MQTT_DISCOVERY | bool | 否 | 是否要 Home Assistant 的 MQTT 发现,默认为 `true`
|
||||
MQTT_DISCOVERY_PREFIX | string | 否 | Home Assistant 的 MQTT 发现前缀,默认为 `homeassistant`
|
||||
DEBUG_LEVEL | string | 否 | 日志记录级别。可能的值:`CRITICAL`、`ERROR`、`WARNING`、`INFO`、`DEBUG`,默认为`INFO`
|
||||
USERS | List | 是 | 要添加的用户列表,请参见下文
|
||||
|
||||
|
||||
自动性别选择/配置:用于创建计算,例如 BMI、水/骨量等。以下是用于为用户分配测量权重的逻辑:
|
||||
- 如果权重在用户定义的 GT 和 LT 值范围内,则会将其分配(发布)给该用户。
|
||||
- 如果权重与两个单独的用户范围匹配,则只会将其分配给匹配的第一个用户。所以不要创建重叠的范围!
|
||||
|
||||
用户选项 | 类型 | 必填项 | 说明
|
||||
--- | --- | --- | ---
|
||||
GT | int | 是 | 大于 - 权重必须大于此值;这将是用户体重范围的下限
|
||||
LT | int | 是 | 小于 - 重量必须小于此值;这将是用户体重范围的上限
|
||||
SEX | string | 是 | 用户的性别(男/女)
|
||||
NAME | string | 是 | 用户名称
|
||||
HEIGHT | int | 是 | 用户的身高(厘米)
|
||||
DOB | string | 是 | 用户的出生日期(格式 yyyy-mm-dd )
|
||||
|
||||
注意:重量定义必须与体重秤的单位相同(kg、Lbs 或 jin)。
|
||||
|
||||
|
||||
## configuration.yaml配置
|
||||
在块中 `mqtt:` ,输入与环境变量中配置的用户数一样多的块。如果您已经有一个 `mqtt:` and/or `sensor:` 块,请不要创建另一个块,而只需在相关块头下添加“缺失”位。注意:只有权重实体才会通过 MQTT 发现自动添加。
|
||||
|
||||
|
||||
```yaml
|
||||
mqtt:
|
||||
sensor:
|
||||
- name: "Example Name Weight"
|
||||
state_topic: "miscale/USER_NAME/weight"
|
||||
value_template: "{{ value_json['weight'] }}"
|
||||
unit_of_measurement: "kg"
|
||||
json_attributes_topic: "miscale/USER_NAME/weight"
|
||||
icon: mdi:scale-bathroom
|
||||
# Below lines only needed if long term statistics are required
|
||||
state_class: "measurement"
|
||||
|
||||
- name: "Example Name BMI"
|
||||
state_topic: "miscale/USER_NAME/weight"
|
||||
value_template: "{{ value_json['bmi'] }}"
|
||||
icon: mdi:human-pregnant
|
||||
unit_of_measurement: "kg/m2"
|
||||
# Below lines only needed if long term statistics are required
|
||||
state_class: "measurement"
|
||||
```
|
||||
|
||||
<img align="center" alt="Example of the Lovelace card in HA" src="https://raw.githubusercontent.com/lolouk44/xiaomi_mi_scale/master/Screenshots/HA_Lovelace_Card.png" width="250">
|
||||
|
||||
<img align="center" alt="Example of the details of the Lovelace card in HA" src="https://raw.githubusercontent.com/lolouk44/xiaomi_mi_scale/master/Screenshots/HA_Lovelace_Card_Details.png" width="250">
|
||||
15
mi-scale/README.md
Normal file
15
mi-scale/README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
# 冬瓜甄选addons:小米体脂称
|
||||
|
||||
## 关于
|
||||
|
||||
小米体脂称汉化版,通过低功耗蓝牙(BLE)连接到小米体脂秤,从设备读取体重测量值,包括体重指数(BMI)、基础代谢、内脏脂肪、瘦体重、体脂、水量、骨量、肌肉量、蛋白质含量、体型、体重类别和代谢年龄。
|
||||
|
||||
## 来源
|
||||
|
||||
汉化借鉴
|
||||
|
||||
https://github.com/5high/hassio-addons/tree/master/mi-scale
|
||||
|
||||
原版引用
|
||||
|
||||
https://github.com/lolouk44/hassio-addons
|
||||
96
mi-scale/apparmor.txt
Normal file
96
mi-scale/apparmor.txt
Normal file
@@ -0,0 +1,96 @@
|
||||
#include <tunables/global>
|
||||
|
||||
profile xiaomi_mi_scale flags=(attach_disconnected,mediate_deleted) {
|
||||
#include <abstractions/base>
|
||||
|
||||
# Capabilities
|
||||
network,
|
||||
capability,
|
||||
file,
|
||||
|
||||
# ###
|
||||
# included from https://github.com/edgexfoundry-holding/device-bluetooth-c/blob/main/docker-ble-policy
|
||||
# ###
|
||||
dbus (send, receive) bus=system peer=(name=org.bluez, label=unconfined),
|
||||
dbus (send, receive) bus=system interface=org.freedesktop.DBus peer=(label=unconfined),
|
||||
|
||||
# ###
|
||||
# included from https://github.com/jdstrand/snapd/blob/4befc00e3318a3231e96b38b575bf6e637ddad6c/interfaces/builtin/bluez.go
|
||||
# ###
|
||||
dbus (receive, send)
|
||||
bus=system
|
||||
interface=org.bluez.*
|
||||
peer=(label=unconfined),
|
||||
dbus (receive, send)
|
||||
bus=system
|
||||
path=/org/bluez{,/**}
|
||||
interface=org.freedesktop.DBus.*
|
||||
peer=(label=unconfined),
|
||||
dbus (receive, send)
|
||||
bus=system
|
||||
path=/
|
||||
interface=org.freedesktop.DBus.*
|
||||
peer=(label=unconfined),
|
||||
|
||||
|
||||
# ###
|
||||
# included from https://developers.home-assistant.io/docs/add-ons/presentation#apparmor
|
||||
# ###
|
||||
signal (send) set=(kill,term,int,hup,cont),
|
||||
|
||||
# Receive signals from S6-Overlay
|
||||
signal (send,receive) peer=*_xiaomi_mi_scale,
|
||||
|
||||
# S6-Overlay
|
||||
/init ix,
|
||||
/bin/** ix,
|
||||
/usr/bin/** ix,
|
||||
/run/{s6,s6-rc*,service}/** ix,
|
||||
/package/** ix,
|
||||
/command/** ix,
|
||||
/etc/services.d/** rwix,
|
||||
/etc/cont-init.d/** rwix,
|
||||
/etc/cont-finish.d/** rwix,
|
||||
/run/{,**} rwk,
|
||||
/dev/tty rw,
|
||||
|
||||
# Bashio
|
||||
/usr/lib/bashio/** ix,
|
||||
/tmp/** rwk,
|
||||
|
||||
# Access to options.json and other files within your addon
|
||||
/data/** rw,
|
||||
|
||||
# Access to mapped volumes specified in config.json
|
||||
/share/** rw,
|
||||
|
||||
|
||||
# ###
|
||||
# included from https://gist.github.com/disconnect3d/d578af68b09ab56db657854ec03879aa
|
||||
# (docker-default profile which would usually be used for this container)
|
||||
# ###
|
||||
signal (receive) peer=unconfined,
|
||||
signal (send,receive) peer=docker-default,
|
||||
|
||||
deny @{PROC}/* w, # deny write for all files directly in /proc (not in a subdir)
|
||||
# deny write to files not in /proc/<number>/** or /proc/sys/**
|
||||
deny @{PROC}/{[^1-9],[^1-9][^0-9],[^1-9s][^0-9y][^0-9s],[^1-9][^0-9][^0-9][^0-9]*}/** w,
|
||||
deny @{PROC}/sys/[^k]** w, # deny /proc/sys except /proc/sys/k* (effectively /proc/sys/kernel)
|
||||
deny @{PROC}/sys/kernel/{?,??,[^s][^h][^m]**} w, # deny everything except shm* in /proc/sys/kernel/
|
||||
deny @{PROC}/sysrq-trigger rwklx,
|
||||
deny @{PROC}/kcore rwklx,
|
||||
|
||||
deny mount,
|
||||
|
||||
deny /sys/[^f]*/** wklx,
|
||||
deny /sys/f[^s]*/** wklx,
|
||||
deny /sys/fs/[^c]*/** wklx,
|
||||
deny /sys/fs/c[^g]*/** wklx,
|
||||
deny /sys/fs/cg[^r]*/** wklx,
|
||||
deny /sys/firmware/** rwklx,
|
||||
deny /sys/kernel/security/** rwklx,
|
||||
|
||||
|
||||
# suppress ptrace denials when using 'docker ps' or using 'ps' inside a container
|
||||
ptrace (trace,read) peer=docker-default,
|
||||
}
|
||||
96
mi-scale/config.json
Normal file
96
mi-scale/config.json
Normal file
@@ -0,0 +1,96 @@
|
||||
{
|
||||
"name": "Xiaomi Mi Scale",
|
||||
"version": "0.3.6-1",
|
||||
"slug": "xiaomi_mi_scale",
|
||||
"description": "通过蓝牙(BLE)读取小米体脂秤的测量值",
|
||||
"url": "https://gitcode.com/waxgourd/addons",
|
||||
"image": "r.hassbus.com/wghaos/mi-scale",
|
||||
"arch": ["aarch64","amd64"],
|
||||
"startup": "application",
|
||||
"boot": "manual",
|
||||
"host_dbus": true,
|
||||
"panel_admin": false,
|
||||
"host_network": true,
|
||||
"apparmor": true,
|
||||
"privileged": ["NET_ADMIN", "SYS_ADMIN"],
|
||||
|
||||
"options": {
|
||||
"HCI_DEV": "hci0",
|
||||
"BLUEPY_PASSIVE_SCAN": false,
|
||||
"MISCALE_MAC": "00:00:00:00:00:00",
|
||||
"MQTT_PREFIX": "miscale",
|
||||
"MQTT_HOST": "127.0.0.1",
|
||||
"MQTT_USERNAME": "user",
|
||||
"MQTT_PASSWORD": "passwd",
|
||||
"MQTT_PORT": 1883,
|
||||
"MQTT_RETAIN": true,
|
||||
"MQTT_DISCOVERY": true,
|
||||
"MQTT_DISCOVERY_PREFIX": "homeassistant",
|
||||
"MQTT_TLS_CACERTS": "Path to CA Cert File",
|
||||
"MQTT_TLS_INSECURE": false,
|
||||
"DEBUG_LEVEL": "error",
|
||||
|
||||
"USERS": [
|
||||
{
|
||||
"NAME": "Bob",
|
||||
"SEX": "male",
|
||||
"GT": 60,
|
||||
"LT": 80,
|
||||
"HEIGHT": 180,
|
||||
"DOB": "1980-01-01"
|
||||
},
|
||||
{
|
||||
"NAME": "Mary",
|
||||
"SEX": "female",
|
||||
"GT": 40,
|
||||
"LT": 60,
|
||||
"HEIGHT": 160,
|
||||
"DOB": "1990-01-01"
|
||||
},
|
||||
{
|
||||
"NAME": "Timmy",
|
||||
"SEX": "male",
|
||||
"GT": 20,
|
||||
"LT": 40,
|
||||
"HEIGHT": 120,
|
||||
"DOB": "2010-01-01"
|
||||
},
|
||||
{
|
||||
"NAME": "Baby Sally",
|
||||
"SEX": "female",
|
||||
"GT": 1,
|
||||
"LT": 20,
|
||||
"HEIGHT": 50,
|
||||
"DOB": "2020-01-01"
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
"schema": {
|
||||
"HCI_DEV": "str?",
|
||||
"BLUEPY_PASSIVE_SCAN": "bool?",
|
||||
"MISCALE_MAC": "str",
|
||||
"MQTT_PREFIX": "str?",
|
||||
"MQTT_HOST": "str",
|
||||
"MQTT_USERNAME": "str?",
|
||||
"MQTT_PASSWORD": "str?",
|
||||
"MQTT_PORT": "int?",
|
||||
"MQTT_RETAIN": "bool?",
|
||||
"MQTT_DISCOVERY": "bool?",
|
||||
"MQTT_DISCOVERY_PREFIX": "str?",
|
||||
"MQTT_TLS_CACERTS": "str?",
|
||||
"MQTT_TLS_INSECURE": "bool?",
|
||||
"DEBUG_LEVEL": "str?",
|
||||
|
||||
"USERS": [
|
||||
{
|
||||
"NAME": "str",
|
||||
"SEX": "str",
|
||||
"GT": "int",
|
||||
"LT": "int",
|
||||
"HEIGHT": "int",
|
||||
"DOB": "str"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
BIN
mi-scale/icon.png
Normal file
BIN
mi-scale/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
BIN
mi-scale/logo.png
Normal file
BIN
mi-scale/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
Reference in New Issue
Block a user