bt-mqtt-gateway
bt-mqtt-gateway copied to clipboard
Home Assistant auto discovery
Is your feature request related to a problem? Please describe. Since Home Assistant is moving towards UI configuration and away from yaml files, having devices as entities in the UI would be nice.
Describe the solution you'd like I'd love to get the mqtt entities automatically discovered by home assistant.
Describe alternatives you've considered configuring them manually.
Additional context
Hmm they should be auto discovered by mqtt ? Do you have mqtt autodiscovery on, and enabled in gateway ?
They are visible in mqtt, but not as device in home assistant. Maybe i misconfigured the prefixes?
Auto discovery works for me, devices are detected in Home Assistant, but the values are never received for some reason.
@lepinkainen can you share your config?
config.yaml:
mqtt:
host: 192.168.1.12
port: 1883
client_id: bt-mqtt-gateway
availability_topic: lwt_topic
manager:
sensor_config:
topic: homeassistant
retain: true
topic_subscription:
update_all:
topic: homeassistant/status
payload: online
command_timeout: 35
workers:
ruuvitag:
args:
devices:
livingroom: c3:b3:40:aa:71:23
bedroom: d9:0b:7c:9c:56:2b
balcony: fa:13:e6:13:62:aa
topic_prefix: ruuvitag_ha
update_interval: 30
docker-compose.yml:
version: '3.7'
services:
bt-mqtt-gateway:
image: zewelor/bt-mqtt-gateway
container_name: bt-mqtt-gateway
restart: always
# Uncomment to enable debug
environment:
- DEBUG=true
volumes:
- ./config.yaml:/config.yaml
privileged: true
cap_add:
- NET_ADMIN
- NET_RAW
network_mode: host
Alternating between privileged: true and the cap_add options seems to do nothing of value.
With this setup, everything appears on HA as they should, but the statuses never update. No messages are received in ruuvitag_ha/#. Running with debug=true doesn't log any errors at all.
The tags do work, I've got a similar system built by myself, but can't be arsed to code the HA autodiscovery part, so I'm trying this one. (Also this would allow me to combine the Xiaomi BLE meters in the same setup)
Using mqtt-explorer for debugging MQTT is really helpful. One can easily see the published autodiscover configuration as well as the published sensor data. I suspect a miss-match regarding the MQTT topic prefixes.
@twsl, not every worker currently supports autodiscovery, which one are you trying?
What code do you need in the worker to support auto discovery? I found the code for inkbird IBS-TH1 posted in the issues section, and it works as a worker, but Home assistant does not auto discover. I also could not use docker container because I didn't know how to add it to the container before it was loaded....so i had to use venv. I see the data getting pulled (probably correctly) and published to MQTT, but so far i haven't pulled it into HA yet.
@andrey-yantsen I tried this with miscale
Well, yeah, both inkbord & miscale workers do not have the auto-discovery implemented. You need to implement something like https://github.com/zewelor/bt-mqtt-gateway/blob/master/workers/am43.py#L35-L86 there.