room-assistant
room-assistant copied to clipboard
Use MQTT to perform BT/BLE device discovery, and add/remove device to whitelist/blacklist
Is your feature request related to a problem? Please describe. I want to make my own headend for room-assistant, suitable for non-technical people to setup a device scanning environment.
Describe the solution you'd like If it would be to start a scan via MQTT (and recieve the result via MQTT), it would be easy for me to programmatically discover nearby BT and/or BLE devices.
If it would be possible to add/remove devices to the blacklist and/or whitelist via MQTT, my headend could provide an easy user setup.
Describe alternatives you've considered write my own code from scratch (but I would rather build on top of your code :) )
Additional context
I actually had it on my list to provide a better HTTP REST API for room-assistant that other tools could also hook into - would that also work for your use case?
Yes, that would definitely also work :)
I’m also really interested in this
Is there already a REST API? If so, where can I find documentation on that? And are you indeed going to extend the REST API @mKeRix ?
The groundwork for the API is there, but it only has one endpoint atm: <ip>:6415/entities
list the states for all entities as JSON. There is no documentation since the API isn't really supported yet (and there is not much you can do with it). I do want to extend it, I just have no concrete timeline for that. I'll probably make use of the OpenAPI specification for documentation then. Maybe I can start with providing endpoints for the Bluetooth use cases you mentioned above.
Super! One remark already: When using room-assistant in cluster mode, how do I know which ip address to use for the endpoint.
Or thinking about that, I think I need a second new feature to make it really easy: centralized management. At the moment I actually edit one config file, and then need to copy that over to all nodes everytime I add / remove a ble/bt device.
I've developed an Ansible playbook that gives you centralized management features - I figured it's best to leave such tasks to the tools built to do them rather than putting such a system directly into room-assistant. Works well for me, but of course I'm open for ideas/wishes there as well.
The endpoint is available on all room-assistant instances, so you would have to communicate with all of them in theory. Local entities (like GPIO, D6T...) only show up on the instance that has them configured, distributed entities (BT Classic, BLE) show up on each instance. Currently there is no way to tell which device is the leader via the API, so you would have to just pick one. The state should still by in sync for the most part though, even if you don't check the leader instance. So: if you only have distributed entities you can just pick any instance to do fire the requests at.