Pi audio component

Awesome thank you so much!

1 Like

It is possible to use text to speech (tts) too? Using the audio jack output

I have installed the add-on, and I can call the function in my browser but can’t seem to make this work in Hassio, I have tried your start notification, but it just gives me errors, also you didn’t say whether it went into the configuration yaml or automation yaml.

hello there @Andy_Nunes, well, you can place the service wherever you need it… and the startup notification it’s in automations.yaml.
I updated my Hass.io to the latest release and it still works, so it should work on yours too.
This is how my addon looks like in my Hassio section:


Is it the same on yours?

1 Like

oh wait… on my hassio is installed locally, let me install the one on github and see if it still works…

Actually you’re right, it works if the addon is local, but doesn’t work if installed using the repository.
I’ll try to understand why, meanwhile you can follow these instructions:

to make it work on your system.

1 Like

ok, I found out where is the problem.
If you create the addon locally then you have to use the command addon: local_audio_player, like

      - service: hassio.addon_stdin     
        data:        
          addon: local_audio_player          
          input: "http://192.168.1.100:8123/local/song.mp3"

but if you install it from the repository, you’ll have to modify the line replacing “local” with the number you see in the url:


so, in this case it will be:

      - service: hassio.addon_stdin     
        data:        
          addon: de3cd379_audio_player          
          input: "http://192.168.1.100:8123/local/song.mp3"
1 Like

Okay that works fine, but I still can’t get any audio playback via the pi this is what is in the log :

starting version 3.2.4
starting!
[Info] Read alias: https://my.duckdns.org/local/MrDJ.mp3
play WARN alsa: can’t encode 0-bit Unknown or not applicable
wget: error getting response: Connection reset by peer
play FAIL formats: can’t open input file URL `https://my.duckdns.org/local/MrDJ.mp3’:
[Error] Playing failed →

Any ideas?
I am also getting this error in main log:

Log Details (WARNING)
Thu Feb 08 2018 12:55:38 GMT+0000 (GMT)

Unable to find service hassio/addon_stdin

Try using the internal ip like:
http://192.168.1.100:8123/local/MrDJ.mp3
Or changing the mp3 file and tell me if something changes.

This is what you should see in the addon log:

[Info] Read alias: http://192.168.1.100:8123/local/power_down.mp3
play WARN alsa: can't encode 0-bit Unknown or not applicable
http://192.168.1.100:8123/local/power_down.mp3:
 File Size: 0         
  Encoding: MPEG audio    
  Channels: 2 @ 16-bit   
Samplerate: 48000Hz      
Replaygain: off         
  Duration: unknown      

In:0.00% 00:00:00.00 [00:00:00.00] Out:0     [      |      ]        Clip:0    
In:0.00% 00:00:00.51 [00:00:00.00] Out:20.5k [      |      ]        Clip:0    
In:0.00% 00:00:00.60 [00:00:00.00] Out:28.7k [      |      ]        Clip:0    
In:0.00% 00:00:00.77 [00:00:00.00] Out:36.9k [      |      ]        Clip:0    
In:0.00% 00:00:00.94 [00:00:00.00] Out:45.1k [      |      ]        Clip:0    
In:0.00% 00:00:01.11 [00:00:00.00] Out:53.2k [      |      ]        Clip:0    
In:0.00% 00:00:01.28 [00:00:00.00] Out:61.4k [      |      ]        Clip:0    
In:0.00% 00:00:01.37 [00:00:00.00] Out:65.5k [      |      ]        Clip:0    
In:0.00% 00:00:01.54 [00:00:00.00] Out:73.7k [      |      ]        Clip:0    
In:0.00% 00:00:01.71 [00:00:00.00] Out:81.9k [      |      ]        Clip:0    
In:0.00% 00:00:01.73 [00:00:00.00] Out:82.9k [      |      ]        Clip:0    
Done.

Still no joy changed IP, changed MP3 but still get the same errors.

I think my problem with this may stem from using SSL

Can this also be a streaming mp3 file?

Apparently yes, I just made this script:

  local_radio:
    sequence:
      - service: hassio.addon_stdin
        data:
          addon: de3cd379_audio_player
          input: "http://icestreaming.rai.it/1.mp3"

…and it works. So, yes, you can stream your favourite radios directly on the raspberry pi 3.5mm audio jack :wink:

cool! i am not using hass.io, just have to detirmine how to use it in HA

1 Like

Hello Pantomax, very new to this Hassio system but im begining to like it, but as a noob I’m having problems with testing json service call in developer module. Basically I would like to trigger a sound when temperature of sensor reaches a certain level but being a noob and an old git can’t get this to work. Is it possible to use the call service and test json format. If it’s possible could you give us an example please?

Hey @OldGitHub,
actually I don’t really know how to answer to your question, I’m not even a coder, so my knowledge level is very low. Maybe… something like:

{
     "addon" : "de3cd379_audio_player", 
     "input" : "http://192.168.1.100:8123/local/sound_when_temperature_of_sensor_reaches_a_certain_level.mp3"
}

:sweat_smile:

Hello again @Pantomax…you sir are a legend, brilliant, I made the error of missing “input”, which was why I kept getting errors in the log…Doh! this is great, after pulling out what hair I had left, I can now wire the house up with sensors and speakers, the only down-fall is I’m probably gonna get an ear bashing from TheOldGirl when a trigger sounds an alert. This home automation stuff is brill…thanks again for your quick reply :sweat_smile:

1 Like

Glad that I could help. :blush:
Happy automating over there, let your home sound like the USS Enterprise computer :wink:

@Pantomax ciao, volevo chiedereti di aggiungerti al mio gruppo facebook per creare una comunità di supporto italiana di HA, visto il poco materiale reperibile nella nostra lingua, ciao e grazie