# You don't need to add the MQTT details for Home Assistant with the add-on installation, it will be auto-discovered!
global:
instanceName: changeme
integrations:
- homeAssistant
- bluetoothClassic
bluetoothClassic:
hciDeviceId: 0
scanTimeLimit: 6
timeoutCycles: 2
interval: 10
inquireFromStart: true
preserveState: true
minRssi:
'FC:*******:E3': -10
default: -20
addresses:
- 'FC:********:E3'
entityOverrides:
'FC:**************:E3':
id: edifier_bluetooth
name: edifier bluetooth
配置文件配置好以后,重启下“room-assistant”加载项,如果顺利的话,mqtt里会多出2个实体,1个是控制实体(好像是开启扫描的开关和查询设备的数量,不想扫描了。关了就行),另外1个是蓝牙音响的存在追踪传感器(我们要用这个),如下图这样,有个“edifier bluetooth Tracker”传感器实体,以后我们用这个传感器实体,就可以判定蓝牙音响有没有开机,离家就是关机,在家就是开机,但是有个延迟,因为“room-assistant”加载项10秒扫描1次,可能开机了15-20秒才会有状态反馈,但是影响不大。
bluetoothctl
# note no SUDO available on HA VM
list
# Controller XXXXXX mydevice [default]
power on
agent on
default-agent
scan on
# [NEW] Device AA:BB:CC:DD:EE:FF XYZ
# Now I Press the pairing button on the device (disabling bluetooth on any nearby devices)
pair AA:BB:CC:DD:EE:FF
connect AA:BB:CC:DD:EE:FF
trust AA:BB:CC:DD:EE:FF
exit