1、首次推出ddnsto、mi-scale、mpd、portainer;

2、完善emby及samba-easy-nas的docs及config。
This commit is contained in:
waxgourd
2024-01-02 11:11:49 +08:00
parent 58cf00c560
commit ee0ccc8071
37 changed files with 710 additions and 10 deletions

2
mi-scale/CHANGELOG.md Normal file
View File

@@ -0,0 +1,2 @@
## [0.3.6] - 2022-10-10
- 首次提交

100
mi-scale/DOCS.md Normal file
View File

@@ -0,0 +1,100 @@
# 支持的电子秤
支持类型:
Name | Model | Picture
--- | --- | ---
[Mi Smart Scale 2](https://www.mi.com/global/scale) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | 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">
急着出,汉化后续调整!!!(冬瓜备注)
# Setup
1. Retrieve the scale's MAC address from the [Xiaomi Mi Fit app](https://play.google.com/store/apps/details?id=com.xiaomi.hm.health&hl=en&gl=US), or alternatively, you can also use the `bluetoothctl` tool on Linux and type `scan on` to scan for BLE devices (`sudo hcitool lescan` might also work). The device should be named `MIBFS` or similar.<br/>
<img alt="Showing the MAC address in the Xiaomi Mi Fit app" src="https://raw.githubusercontent.com/lolouk44/xiaomi_mi_scale/master/Screenshots/MAC_Address.png" width="250">
1. Open Home Assistant and navigate to the "Add-on Store". Click on the 3 dots (top right) and select "Repositories".
2. Enter `https://github.com/lolouk44/hassio-addons` in the box and click on "Add".
3. You should now see "Lolouk44 Add-Ons" at the bottom list.
4. Click on "Xiaomi Mi Scale", then click "Install".
5. Under the "Configuration" tab, change the settings appropriately (at least MQTT parameters, user properties, and MAC address), see [Parameters](#parameters).
6. Start the Add-on.
## Important:
If using the Add-On outside of Home Assistant Operating System / through a docker container, make sure the dbus is shared with the container running Home Assistant. This is typically done by adding the following line in your docker run command:
`-v /var/run/dbus/:/var/run/dbus/:ro`
or the following lines in your docker-compose file:
```
volumes:
- /var/run/dbus/:/var/run/dbus/:ro
```
## Parameters
Option | Type | Required | Description
--- | --- | --- | ---
HCI_DEV | string | No | Bluetooth hci device to use. Defaults to `hci0`
BLUEPY_PASSIVE_SCAN | bool | No | Try to set to true if getting an error like `Bluetooth connection error: Failed to execute management command le on` on a Raspberry Pi. Defaults to `false`
MISCALE_MAC | string | Yes | MAC address of your scale
MQTT_PREFIX | string | No | MQTT topic prefix, defaults to `miscale`
MQTT_HOST | string | Yes | MQTT server, defaults to `127.0.0.1`
MQTT_USERNAME | string | No | Username for MQTT server (comment out if not required)
MQTT_PASSWORD | string | No | Password for MQTT (comment out if not required)
MQTT_PORT | int | No | Port of your MQTT server, defaults to 1883
MQTT_DISCOVERY | bool | No | Whether you want MQTT discovery for Home Assistant, defaults to `true`
MQTT_DISCOVERY_PREFIX | string | No | MQTT discovery prefix for Home Assistant, defaults to `homeassistant`
DEBUG_LEVEL | string | No | Logging level. Possible values: 'CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'. Defaults to 'INFO'
USERS | List | Yes | List of users to add, see below
Auto-gender selection/config: this is used to create the calculations such as BMI, Water/Bone Mass, etc.
Here is the logic used to assign a measured weight to a user:
- If the weight is within the range of a user's defined values for GT and LT, then it will be assigned (published) to that user.
- If the weight matches two separate user ranges, it will only be assigned to the first user that matched. So don't create overlapping ranges!
User Option | Type | Required | Description
--- | --- | --- | ---
GT | int | Yes | Greater Than - Weight must be greater than this value; this will be the lower limit for the weight range of the user
LT | int | Yes | Less Than - Weight must be less than this value; this will be the upper limit for the weight range of the user
SEX | string | Yes | Gender of the user (male / female)
NAME | string | Yes | Name of the user
HEIGHT | int | Yes | Height (in cm) of the user
DOB | string | Yes | Date of Birth of the user (in yyyy-mm-dd format)
Note: the weight definitions must be in the same unit as the scale (kg, Lbs, or jin).
# Home Assistant Setup
In the `mqtt:` block, enter as many blocks as users configured in your environment variables.
If you already have an `mqtt:` and/or `sensor:` block, do not create another one but simply add the "missing" bits under the relevant block header.
Note: Only weight entities are automatically added via the MQTT discovery.
```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">
# Acknowledgements
Thanks to @syssi (https://gist.github.com/syssi/4108a54877406dc231d95514e538bde9) and @prototux (https://github.com/wiecosystem/Bluetooth) for their initial code. Special thanks to [@ned-kelly](https://github.com/ned-kelly) for his help turning a "simple" Python script into a fully fledged Docker container. Thanks to [@bpaulin](https://github.com/bpaulin), [@fabir-git](https://github.com/fabir-git), [@snozzley](https://github.com/snozzley), [CodeFinder2](https://github.com/CodeFinder2) [@MariusHerget](https://github.com/MariusHerget) for their PRs and collaboration.

15
mi-scale/README.md Normal file
View 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
View 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
View File

@@ -0,0 +1,96 @@
{
"name": "Xiaomi Mi Scale",
"version": "0.3.6",
"slug": "xiaomi_mi_scale",
"description": "通过蓝牙BLE读取小米体脂秤的测量值",
"url": "https://github.com/alexbelgium/hassio-addons",
"image": "wghaos/mi-scale",
"arch": ["armhf", "armv7", "aarch64", "amd64", "i386"],
"startup": "application",
"boot": "auto",
"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

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
mi-scale/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB