Moode Forum

Full Version: gpiozero to control a remote Moode?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
For my Moode set-up I need to have a simple, physical user interface remote to the actual Moode device generating the audio. Specifically, an on and off button, volume control and one or two radio station selectors.

I was thinking of having a two Pi set-up - one running Moode and another to do the control (ie, some buttons connected to GPIO). Both would need to run gpiozero (https://gpiozero.readthedocs.io/en/stable/ ) and the signals transferred over the LAN.

Has anyone done this? Is there another, easier way?

Doing it this way, seemingly, means I would only need to ensure the daemon starts on the moode Pi so would keep code customization to a minimum, but I haven't gone to far yet in testing.
(09-03-2018, 07:08 PM)DRONE7 Wrote: [ -> ]"physical user interface remote"
LIRC I/R ?   Buttons...??? 

Yep, certainly an option, but the Pi running moode is going to be hidden along with the amplifier. So IR would be difficult and running cables to / from GPIO buttons isn't an option given the room layout.

Using a 2nd Pi (say a Pi zero) I could have a faux-kitchen-radio-type set-up (wife friendly!) which would deal with 90% of the user interactions. It could even have a screen to show the time / date / station / song etc. All communicated over the LAN.

That's the idea anyhow.
You're describing a Phone or Tablet...... Touchscreen, network control...... so another Pi seems superfluous...?
Wouldn't it be easier to have button presses on the pi zero trigger commands on moode via ssh or the web api?
You wouldn't need to customize moode at all. I think.
(09-03-2018, 08:17 PM)DRONE7 Wrote: [ -> ]You're describing a Phone or Tablet......   Touchscreen, network control......  so another Pi seems superfluous...?

Yeah, agreed - this is an unusual use case. "We" don't want "more gadgets" lying about the place... Or needing to have our phones on us to change volume etc.

(09-03-2018, 11:42 PM)FizzyTea Wrote: [ -> ]Wouldn't it be easier to have button presses on the pi zero trigger commands on moode via ssh or the web api?
You wouldn't need to customize moode at all. I think.

Ah, that's an interesting idea. My first thought was that it would work fine for 'select playlist x' but might struggle with volume control - repeated ssh connections could be very laggy. Unless I altered the increments. Hmm, I'll need to think.

That's why I thought going down a few levels and passing only the GPIO levels would be fast and, to the Moode, seamless.

I'll need to do some customization of Moode: I build my amp with a relay to control the main power - intending to feed it the signal from the Pi. Someone has posted code to do this through Moode which is cool. I was intending to watch the mpd status file and use that to trigger.
(09-04-2018, 08:21 AM)tristanc Wrote: [ -> ]
(09-03-2018, 11:42 PM)FizzyTea Wrote: [ -> ]Wouldn't it be easier to have button presses on the pi zero trigger commands on moode via ssh or the web api?
You wouldn't need to customize moode at all. I think.

Ah, that's an interesting idea. My first thought was that it would work fine for 'select playlist x' but might struggle with volume control - repeated ssh connections could be very laggy. Unless I altered the increments. Hmm, I'll need to think.

That's why I thought going down a few levels and passing only the GPIO levels would be fast and, to the Moode, seamless.

/var/www/vol.sh handles moode's volume nicely

Code:
vol.sh with no arguments will print the current volume level
vol.sh restore will set alsa/mpd volume based on current knob setting
vol.sh <level between 0-100>, mute (toggle), up <step> or dn <step>, -help

e.g.

/var/www/vol.sh up 2
/var/www/vol.sh mute
/var/www/vol.sh 55

Search the forum for lots of other nuggets like that. Also mpc is simple for play/pause, playlists etc.
(09-04-2018, 08:21 AM)tristanc Wrote: [ -> ]
(09-03-2018, 11:42 PM)FizzyTea Wrote: [ -> ]Wouldn't it be easier to have button presses on the pi zero trigger commands on moode via ssh or the web api?
You wouldn't need to customize moode at all. I think.

Ah, that's an interesting idea. My first thought was that it would work fine for 'select playlist x' but might struggle with volume control - repeated ssh connections could be very laggy. Unless I altered the increments. Hmm, I'll need to think.

That's why I thought going down a few levels and passing only the GPIO levels would be fast and, to the Moode, seamless.

http://moodeaudio.org/forum/showthread.p...87#pid2487
Even better - I hadn't realised commands could be passed by http. Thanks for the pointer! So a python script listening for GPIO events to issue http requests would be so much simpler.

I'm remote from my Moode currently, but I guess there may be a similar API call to select / play a specific playlist?
(09-04-2018, 09:33 AM)tristanc Wrote: [ -> ]Even better - I hadn't realised commands could be passed by http. Thanks for the pointer! So a python script listening for GPIO events to issue http requests would be so much simpler.

I'm remote from my Moode currently, but I guess there may be a similar API call to select / play a specific playlist?

I use mpc (via lirc) for that.