Closed schnabel closed 2 years ago
Feel free to try and send a pull. As this won't be used by many users, please make sure it's disabled by default and the service will run without this. Only import additional modules if the websocket API is enabled.
Hi, thanks for your interest. My first idea was to integrate the new API with the bottle server like in this gist because python-socketio supports it. That way the footprint would be small. As I understand you, being able to disable the API and using conditional imports is a MUST. Then I would go for a new daemon thread.
As audiocontrol is already using bottle, I would not recommend to run a second server on another port. Just extend the existing server, but make sure the additional functionality needs to be enabled in the configuration file.
I am having trouble to test my code :-(. Not sure if a should open a bug report in hifiberry os or if you can help me here. I get an error when I try to build the hifiberry-os because of the python keyboard package. It seems to require root privileges because it calls dumpkeys. I tried to add the user I build with to tty and input group as suggested but that did not help. Do you have any idea what to do?
CHanges have been merged
Thanks a lot!
HI, I would like to improve the way clients can interact with hifiberry OS. In my case it is the integration into homeassistant. Polling the REST API for changes in the audiocontrol state is not the best approach. It would be great if there was an websocket API. I could try to offer an implementation using python-socketio.