-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remote control with MQTT #581
Comments
Awesome idea! Would love to use this as well with my openHAB setup. |
@codegrau @andreasbrett |
I'll see if I can contribute to this feature. I need to dig into the phoniebox infrastructure first and see how and where to insert the mqtt stuff. @codegrau any ideas on what exact features we would need to control/monitor via mqtt? |
Smart Home remote control with MQTT See wiki: https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/Smart-Home-remote-control-with-MQTT #584 #581
@codegrau |
Sorry for my late response, but what you've achieved @andreasbrett is incredible! This is exactly what I meant! Thank you for this one! |
@codegrau thanks, it was easier than I thought. Let me know if there's something else that could be done with regards to MQTT. |
Hey @ all i had massive problems with Openhab and Mosquito to get and read States (Commands are without Errors and i have it run till google Home can control my Box :-) , thats so awesome), so test step by step and figured some errors (dont know its only me on rasbian buster?) : Hope this help someone Thanks to dev for this awesome script and Idea of Mqtt |
Fixed the typo in the wiki, thanks for pointing that out!
Okay, I think I found the bug with that configuration. Typically my scripts are independent from the working directory as I use the script path. Thanks to your hint I found 3 attributes where I did NOT do so. maxvolume, idletime and volstep. Did you have issues with other attributes as well? Those 3 bugs will be fixed once @MiczFlor merges the pull request (#593) into master. It contains some new features and I also added the fixes a minute ago. |
Hey, so fast :-) i couldn't drink my Pale and have to sit down for testing . PS: the new Function for Folderplay(which is incredible when i get this work as Switch and then in Google Home :-)) need some Parameters , are these the directory Path to Musicalbums ? like : /RPi-Jukebox-RFID/shared/audiofolders/Album1 or only Album1 ? thx Update: Change your Commit et voila , thumbsup all works like charm. |
You simply pass the folder name (Album1). BTW: I primarily use the Basic UI to control openHAB and therefore would implement that with a String element that is linked to the MQTT topic "phoniebox/cmd/playfolder" and make a dropdown in the sitemap with pre-set folder names. Something like that:
So if I select the Slipknot album from that dropdown the value "Album2" would be sent to the
Great! |
Hi, I still have an issue with the MQTT function. I have connected the Phoniebox to my MQTT server of my IPSymcon system, but only 4 entries are created: The phoniebox/get/all attribute gets updated every 10 seconds when a music file is playing. However no data is written to this attribute. In the log files I can see that the payload for this attribute is NULL. Any idea why no information is forwarded to this attribute? Thx for your help... Kai |
@KingKahn123 /get/$attributeName only triggers phoniebox to publish that attribute to /attribute/$attributeName. That's only used if you want to receive the updates quicker or at a specific time rather than waiting for the next interval. What you will have to do though is set your smart home tool to monitor each attribute separately (via e.g. /attribute/volume). |
Oh and I see that you're using the Spotify edition. Haven't tested that yet as I'm not using it. Let me know if it works like I described above. |
In addition, as far as I understand the MQTT function from the Phoniebox is that all attributes are refreshed at a predefined interval, correct? That means during playback of any music file, the attributes are sent to the server every 10 seconds (depending on the config file). This would be recognized by my SmartHome system and the attributes would be created automatically. But only the four are created. So I assume that no data is transferred to my SmartHome system. |
Hey, in Mqtt you have to subscribe to an Topic to receive an Attribute. You have to make an Status or SUB in your Software with phoniebox/attribute/Volume an no Value. It seems that you set up an public with that Topic above and an Value |
Sure ;-) because you use publish to publish plusSpotify to the Topic phoniebox/edition |
No. Please read again the documentation and my description above. The get topic NEVER is filled with payload because the topic itself will trigger an action and does not need a payload as all the necessary information is already in the subtopic (attributename). The reason why your tool detects this topic is because the periodic publishing of attributes is triggered by phoniebox sending /get/all to itself. Just ignore that. The reason you're not receiving any attributes has to do with you being on the Spotify edition. I will have to check how the management of the player (which I guess is different to the classic edition) works for the Spotify edition. |
@whenthelight He is not publishing anything. His tool just subscribed to all possible topics and phoniebox indeed is sending 4 parameters at the beginning (independent of the player attributes). Reason why he does not receive any attributes is because that function seems to crash due to some difference between the classic and Spotify edition. @MiczFlor |
This mqtt module was now integrated in IPSymcon 5.1/5.2. No need to have this module any longer ;-) When I create this attribute initially the value field is empty... After reboot of the Phoniebox the value is filled in by the MQTT publish: |
I think so as well as I now checked the log file of my IPSymcon MQTT server and I do not see anything else than the 4 parameters. The get/all is occurring every 10 seconds. But I now understood that it is ok, if it is empty ;-) Thanks for looking into it |
What is the output of journalctl -u phoniebox-mqtt-client.service there you see whats going on |
@KingKahn123 You can get it here: |
Where should I add it? Right at the end of the script after: print("result =", status) ? |
Yes, right there. |
Sorry change the first line of the script to
|
(sorry for all the hassle. I'm on my smartphone right now and can't properly help) |
Okay, that all looks very good. Could you try running the mqtt script? First stop the service with Then run the script manually with |
Okay, this looks like the subscription to the /get/# topic did not work. Which mqtt server are you using? Could you try and send to /get/volume (any payload) from your smart home software? The daemon script needs to run while you're doing it. It should output that it received something. |
Alright, I think I fixed it. Please download the script once again from latest dev (see link above). |
Awesome! Thanks for the patience and enjoy it. Let me know if there's something missing that you need/want. |
Are you kidding me?! Thanks for your patience and your help! |
I committed the last pull requests to master: |
And thanks for the lively discussion and great input! |
Thanks and sorry if we flooded your mailbox... 😜 |
Hey andreasbrett, If i select only 1 Album , i can handle this as Switch with 1 Value (Album1). |
Thank you guys a lot for this addon! I can't wait to realize a wake-up-alarm for my kids with it!
Do you guys have any idea what the problem might be? |
Show was going on with : journalctl -u phoniebox-mqtt-client.service |
Sorry for the super late reply... so much stuff going on currently and so little time for the fun stuff...
So I simply ran Again... thanks for that MQTT plugin! Love it! |
Ah I see. I had not pushed the file via git but instead pasted its contents here on github. That's why the file attributes are missing. Thanks for pointing out! |
Hi @andreasbrett can you create a pull request, please? |
Of course. It's done. |
Description for MQTT in https://github.com/MiczFlor/RPi-Jukebox-RFID/wiki/Smart-Home-remote-control-with-MQTT Closing this issue now. |
Hi there, thank you @MiczFlor and all contributors for this wonderful project.
Since mqtt is very common for smart home and home automation stuff I was wondering: wouldn't it be cool for phonieboxes to connect to a mqtt broker for other devices to know, which tune is playing and control phoniebox remotely?
This way you could easily integrate phoniebox to openHAB or HomeAssistant or even use cheap ESP8266 to control or visualize phoniebox contents.
Looking forward to your thoughts.
The text was updated successfully, but these errors were encountered: