MiczFlor / RPi-Jukebox-RFID

A Raspberry Pi jukebox, playing local music, podcasts, web radio and streams triggered by RFID cards, web app or home automation. All plug and play via USB. GPIO scripts available.
http://phoniebox.de
MIT License
1.35k stars 398 forks source link

🚀 | Add MQTT component to support control via Smart Home solution #1963

Open c0un7-z3r0 opened 1 year ago

c0un7-z3r0 commented 1 year ago

Feature Description

Add MQTT component to Future3.

What functionality would you like to see in your phoniebox v3.x?

Integration with Smart Home solutions like Home Assistant via MQTT. Similar to how it is implemented in version 2.x

How do you envision the feature to work from a users perspective?

As the user I can configure the connection to my MQTT broker via the jukebox.yml. Then the phoniebox is connecting to the broker and starts broadcasting various status messages e.g. Playerstate, Volume .... But It can also then be controlled via MQTT to allow for example via Home Assistant to mute the player. The status of the connection to the broker should be easily visible in the webapp.

Further information that might help

The features should be on par with to how version 2.x has implemented plus potentially additional features that might be useful.


I am happy to build this functionality since I already contributed to the version 2.x mqtt solution previously and would like to migrate my two phonieboxes to version 3.x (no MQTT support is blocking this currently).

s-martin commented 1 year ago

MQTT is not yet implemented https://rpi-jukebox-rfid.readthedocs.io/en/latest/featurelist.html#feature-status

But pull requests and contributors are always welcome!

@pabera @ChisSoc

pabera commented 1 year ago

Wonderful feature which could use a pull request :-)

s-martin commented 9 months ago

For anyone interested in implementing this feature, here are some thoughts how this could be done:

https://github.com/MiczFlor/RPi-Jukebox-RFID/blob/future3%2Fdevelop/src%2Fjukebox%2Fjukebox%2Fpublishing%2Fserver.py#L135-L142

c0un7-z3r0 commented 3 months ago

More then a year later. I started working on this topic. Finally. Basic mqtt updates are working already now need to see which other values I need to map and how I implement the mqtt commands. Once this is done I will add some test and open up the PR.

But this is the first time I work with zeromq. Not sure if I followed the architecture and the ideas you linked to @s-martin . So any initial thoughts or quick feedback would be appreciated.

Here is the WIP implementation https://github.com/c0un7-z3r0/RPi-Jukebox-RFID/blob/future3/add-mqtt/src/jukebox/components/mqtt/__init__.py

s-martin commented 3 months ago

Thanks for starting the work on this feature! 🎉

We will look into it.