Moode audio intergration

I took a different approach. moOdeAudio is really a full-featured UI over MPD, as well as a handy way to organize a music library, create playlists and manage favorite streaming channels. So I decided to create a separate tab to display the moOde UI directly in an iframe:

- cards:
    - aspect_ratio: 55%
      type: iframe
      url: 'http://192.168.1.100'
  icon: 'mdi:music-circle-outline'
  panel: true
  title: moOde Audio

This way, I can interact with moOde within the context of HA. I let HA handle my AV receiver to control the volume, as well as whether music plays in other zones.

I did find it handy to use the mpd component to expose buttons for starting/stopping/ffwd/rew operations within HA.

3 Likes

@tomplums did you install lms on the HA server? how?
Iā€™m been using moodeaudio for years and messing around with picoreplayer and lms feels like a step back into the 90s!
I canā€™t even work out how to get a bbc radio 6 stream running :roll_eyes:
how do you deal with selecting a particular album to play?
thanks!

Hello - no I run LMS from a docker container on my server. It can look a little old fashioned until you install this skin https://github.com/CDrummond/lms-material

Adding plugins for spotify, mixcloud, tunein radio, soundcloud etc brings it right up to date. I use it daily and itā€™s perfect with picoreplayer.

Hereā€™s the docker container I use: https://github.com/apnar/docker-image-logitech-media-server

1 Like

ok cheers Iā€™ll persevereā€¦
what flavour server are you using?
Iā€™ve just set up HA on an Odroid C2 but Iā€™ve got an old intel motherboard kicking around that I could use to set up a ā€˜proper serverā€™ā€¦
I think this HA software has a slightly confused ā€˜existenceā€™ :laughing:
I read only Debian servers are supported but then this image that I just downloaded yesterday is running aarch64ā€¦great I thought cos Iā€™m familiar with arch but this weird config on the Odroid doesnā€™t let you properly get at the base OS and now I discovered aarch64 just means ARM 64 bit architecture so christ knows what OS it is running :crazy_face:
Yours confused!

Hello I also have a similar setup, I am using a few pis with PiCorePlayer and a mac based LMS server and a HA os on a rpi4.
Care to elaborate on your setup, I currently am able to do multi-room audio but I control it mainly from Picoreā€™s Materialā€™s web interface. Although i see it in HA i havenā€™t been able to find a way to build a card that would automatically switch to say the Main living room player that has a Great DAC attached to it or the use the audio from itā€™s HDMI when i want 5.1 or squeeze-cast while showing just that entityā€¦ I would like not to have to show/see all 5 possible entities for a single playerā€¦ I mean see only the one thatā€™s playing currently.

Iā€™d like to see your card for audio!
Here what mine currently looks like, It works but iā€™m not satisfied.

how can I configure Moode audio in HA to see when it render airplay or BT?

I have the same issue.
I think I will do it similar to this solution but rather use mqtt instead of ifttt
https://moodeaudio.org/forum/showthread.php?tid=2935
Basically it gives you a trigger when the speakers get active independent of the audio source

Did you ever accomplish this? Would love to do something similar.

Did you ever figure this out?

I detect the audio-output with this simple python script which sends the current state to home assistant. In Home assistant I switch on/off the power for my speakers.

The script is not very elegant but works flawless since some time now.


import time
import paho.mqtt.client as mqtt
import socket

MQTT_SERVER = "YOUR MQTT BROKER IP"
STATUS_UNKNOWN, STATUS_CLOSED, STATUS_OUTPUT = range(3)
status = STATUS_UNKNOWN

def on_connect(client, userdata, flags, rc):
  print('connected')

def on_disconnect(client, userdata, rc):
  print('disconnected')
  connect()

client = mqtt.Client()
client.username_pw_set(username="MQTT USER",password="MQTT PASSWORD")
client.on_disconnect = on_disconnect
client.on_connect = on_connect

def connect():
  for i in range(120000): # wait for HA to start
    try:
      client.connect(MQTT_SERVER, 1883, 60)
    except socket.error:
      pass
    else:
      print('needed %i attempts'%i)
      break
    time.sleep(1)
  else:
    sys.exit('could not connect')
connect()
time.sleep(2) # give the client time to connect


client.publish('moode/wohnzimmer', 'Start')
counter = 0
while True:
    with open('/proc/asound/Headphones/pcm0p/sub0/hw_params') as f:
        lines = f.read()
        first = lines.split('\n',1)[0]
       # print(first)
        if first == 'closed':
            if status != STATUS_CLOSED or counter > 10:
                print('send closed')
                client.publish('moode/audio_output_wz', 'OFF')
                counter = 0
            status = STATUS_CLOSED
        else:
            if status != STATUS_OUTPUT or counter > 10:
                client.publish('moode/audio_output_wz', 'ON')
                print('send out')
                counter = 0
            status = STATUS_OUTPUT
        counter += 1
    time.sleep(1)

You can auto-start it by adding this line to /etc/rc.local

python3 /PATH/TO/THE/PYTHON/SCRIPT.py &