Moode Forum
HA integration render and others. - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7)
+--- Thread: HA integration render and others. (/showthread.php?tid=4873)

Pages: 1 2 3


RE: HA integration render and others. - Snicket - 09-18-2024

Hi,

I want to basically accomplish what the OP wanted to do but additionally I would like to determine if a renderer is actual in a playing state or not. I was thinking that I could already do that by using the APIs outrate property. Unfortunately it seems that this property is sometimes not updated properly at least for the Bluetooth renderer (Didn't test any other one because I'm not using them). During my testing it looks to me like the outrate stays on what ever value it has when first requesting the get_currentsong command.

Is this a bug or am I doing something wrong?

(07-14-2022, 01:57 PM)kuduacz Wrote: You know what?
It happend to me again!
I mean file disapear. I dont know how.
Anyone have ana idea how to do it pernament?
Or how to use new file in json format in Home Assistant?

If you still would like to know how to use the API in Home Assistant this is a way with the RESTful integration:
Code:
rest:
 - resource: "http://oraclesound.local/command/?cmd=get_currentsong"
   scan_interval: 15
   sensor:
     - name: "Moode Renderer"
       value_template: >
         {% if value_json.file == "Airplay Active" %}
           Airplay
         {% elif value_json.file == "Bluetooth Active" %}
           Bluetooth
         {% elif value_json.file == "" %}
           Brak
         {% else %}
           MPD
         {% endif %}
     - name: "Moode MPD State"
       value_template: >
         {% if value_json.state == "play" %}
           Play
         {% elif value_json.state == "pause" %}
           Pause
         {% elif value_json.state == "stop" %}
           Stop
         {% else %}
           Brak
         {% endif %}



RE: HA integration render and others. - Tim Curtis - 09-18-2024

This could be a bug in detecting outrate for Bluetooth renderer.
I'll investigate.


RE: HA integration render and others. - Snicket - 09-18-2024

(09-18-2024, 10:32 AM)Tim Curtis Wrote: This could be a bug in detecting outrate for Bluetooth renderer.
I'll investigate.

Thanks, that would be great!

I forgot to mention it but I tested with v9.0.8 and v9.1.0.


RE: HA integration render and others. - Tim Curtis - 09-18-2024

Try this patch. It addresses the following bugs:
- FIX: Manually added radio logo thumb saved to wrong directory
- FIX: Currentsong.txt file not being updated correctly for renderers
- FIX: HTML entities in metadata being displayed as text
- FIX: Remove broken Interface line in Audio section of System info


Code:
wget -q -O - https://moodeaudio.org/test/r910patch_multi.sh | sudo bash



RE: HA integration render and others. - Snicket - 09-18-2024

(09-18-2024, 03:42 PM)Tim Curtis Wrote: Try this patch. It addresses the following bugs:
- FIX: Manually added radio logo thumb saved to wrong directory
- FIX: Currentsong.txt file not being updated correctly for renderers
- FIX: HTML entities in metadata being displayed as text
- FIX: Remove broken Interface line in Audio section of System info


Code:
wget -q -O - https://moodeaudio.org/test/r910patch_multi.sh | sudo bash

Thanks, this was an amazingly fast fix. Everything works now as expected.

If someone else has similar needs I put some Home Assistant details in this post.
To create a binary sensor in Home Assistant put the following in your configuration.yaml and replace moode.local with your IP or hostname:

Code:
rest
 - resource: "http://moode.local/command/?cmd=get_currentsong"
  scan_interval: 15
  binary_sensor:
    - name: "Moode Audio is playing"
      device_class: running
      value_template: >
        {% if value_json.outrate == "Not playing" %}
          False
        {% elif value_json.outrate == "" %}
          False
        {% else %}
          True
        {% endif %}