We have moved at community.getvera.com

Author Topic: Vera Home Made Raspberry pi Speakers  (Read 3732 times)

Offline hellovn

  • Sr. Member
  • ****
  • Posts: 279
  • Karma: +19/-46
Re: Vera Home Made Raspberry pi Speakers
« Reply #15 on: August 01, 2018, 09:48:00 am »
Simplest way, as I posted early in this thread, is to pair Alexa with Bluetooth and play your tunes this way. I'm using it since one year and it's working very well.

I meant to play any custom text to speech to my Echos. It seems OpenHab already supported this. I have installed openhab2 in my raspberry PI and tried this plugin:

https://community.openhab.org/t/solved-alexa-tts-via-http/46615

Now, when a door is open, Vera will call a HTTP command and play "Front door is open" to my Echos.

Offline RV

  • Full Member
  • ***
  • Posts: 136
  • Karma: +0/-0
Re: Vera Home Made Raspberry pi Speakers
« Reply #16 on: August 01, 2018, 09:54:21 am »
did you try the steps given here:
https://projects.raspberrypi.org/en/projects/lamp-web-server-with-wordpress/4
or
https://www.raspberrypi.org/documentation/remote-access/web-server/apache.md

You seem to have the web server working but php isn't installed. If it doesn't work, do a search on the error. PHP should be straight forward to install. Put your errors here and i can have a look
Yes did the first one, skipped the mySQL part and the wordpress part. Is the workpress required?

Offline ghost

  • Newbie
  • *
  • Posts: 12
  • Karma: +4/-0
Re: Vera Home Made Raspberry pi Speakers
« Reply #17 on: August 03, 2018, 05:50:45 am »
wordpress and mysql are not required. i'm not sure what the problem is. You need php, maybe try a different php engine

Offline RV

  • Full Member
  • ***
  • Posts: 136
  • Karma: +0/-0
Re: Vera Home Made Raspberry pi Speakers
« Reply #18 on: August 03, 2018, 10:38:48 am »

Offline RV

  • Full Member
  • ***
  • Posts: 136
  • Karma: +0/-0
Re: Vera Home Made Raspberry pi Speakers
« Reply #19 on: August 03, 2018, 12:32:32 pm »
I've tested php (as described on the rpi page "hello world") and it's working

the command line
sudo mpg321 -g 100 /var/www/html/audio/lgo.mp3 plays the file.

I created a test file, soundtest.php, minus the variables but added the date test

<?php exec("sudo mpg321 -g 100 /var/www/html/audio/lgo.mp3") ;
           echo date('Y-m-d H:i:s');
?>

to execute it directly. I get the date returned but no sound.

I added ;echo date('Y-m-d H:i:s'); and "  hello world"; to the original soulnd.php file and I get the date/time and the message but no sound.

Offline RV

  • Full Member
  • ***
  • Posts: 136
  • Karma: +0/-0
Re: Vera Home Made Raspberry pi Speakers
« Reply #20 on: August 03, 2018, 03:50:18 pm »
did some more testing and I'll post this here for future users testing php
I created a test php file named soundtest.php just to test if php and mpg were working

<?php exec("sudo mpg321 /var/www/html/audio/lgo.mp3");
 echo date('Y-m-d H:i:s');
 echo "  hello world";
?>

you can test your script with
php soundtest.php in a terminal window

turns out it's a sudo rights issue
the solution was found here
https://serverfault.com/questions/160581/how-to-setup-passwordless-sudo-on-linux

Offline Greg-Mega

  • Newbie
  • *
  • Posts: 7
  • Karma: +0/-0
Re: Vera Home Made Raspberry pi Speakers
« Reply #21 on: August 03, 2018, 10:32:53 pm »
I actually had a play with a random idea that popped into my head during the week last night to make an old android device play audio alerts using a similar concept to the OP but a little bit simpler. I found that installing Kodi on my girlfriends old Moto X play and enabling the kodi web interface i could tell it to play media via the API.

I could make a call using the vera to the Kodi device using:

Code: [Select]
http://<PHONEIP>:8080/jsonrpc?request={"jsonrpc":"2.0","method":"Player.Open","id":1,"params": {"item" : {"file":"http://<NASIP>/media/alert.mp3"}}}
And it would start playing the alert. I had a bit of a look for a TTS plugin or TTS API but at this point i gave up on the idea, i proved my point it was possible just have no idea what i would use it for personally that would be all that useful. I guess if i had people leaving doors open lights on it would be good. My only other thought was i could plug the phone into my alarm clock / dock thing and have it do something if one of the door sensors picked something up in night mode instead of an alarm going crazy.

VERA Alarm clock maybe?

I'm already using something similar to the above to make use of the Kodi Notification/pop up's when things happen around the house on my kodi devices which are connected to my TV's.
« Last Edit: August 03, 2018, 10:37:00 pm by Greg-Mega »

Offline RV

  • Full Member
  • ***
  • Posts: 136
  • Karma: +0/-0
Re: Vera Home Made Raspberry pi Speakers
« Reply #22 on: August 10, 2018, 07:23:00 pm »
I've got to say this is really slowing down scene processing.
« Last Edit: August 12, 2018, 03:01:44 pm by RV »

Offline spud1502

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: Vera Home Made Raspberry pi Speakers
« Reply #23 on: February 26, 2019, 06:29:40 pm »
not working for me
I can play the sound using
mpg321 /var/www/html/audio/lgo.mp3
I get a web page when I go to the web address
I think php isn't working for me

I have the exact same problem, my PHP is working as I made a test with some writing to display on the webpage, has anyone solved this?

Offline RV

  • Full Member
  • ***
  • Posts: 136
  • Karma: +0/-0
Re: Vera Home Made Raspberry pi Speakers
« Reply #24 on: February 26, 2019, 06:57:53 pm »
I did a couple of post above, however, it was slowing down all scene execution so I removed it.

I moved the process to a Home Assistant implementation and it works well. the HA reads the Vera state and executes the "automation" to play the sound.

Offline spud1502

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: Vera Home Made Raspberry pi Speakers
« Reply #25 on: February 26, 2019, 10:30:25 pm »
Do you remember what permissions you needed to give?

I don't know much about home assistant.

Thanks again

Offline RV

  • Full Member
  • ***
  • Posts: 136
  • Karma: +0/-0
Re: Vera Home Made Raspberry pi Speakers
« Reply #26 on: February 27, 2019, 12:19:28 am »
from above
https://serverfault.com/questions/160581/how-to-setup-passwordless-sudo-on-linux

I don't recall.... I assume I gave it the ability to run as sudo

now I use HA to call this link for example
http://192.168.0.201/sound.php?file=mp3soundfile&volume=100

Offline spud1502

  • Newbie
  • *
  • Posts: 15
  • Karma: +0/-0
Re: Vera Home Made Raspberry pi Speakers
« Reply #27 on: February 27, 2019, 10:44:35 am »
Brilliant thanks, will try HA, I?ve had a look for some guidance but not having much look. Do you have a link?

Thanks again

Offline RV

  • Full Member
  • ***
  • Posts: 136
  • Karma: +0/-0
Re: Vera Home Made Raspberry pi Speakers
« Reply #28 on: February 27, 2019, 06:33:39 pm »
I still use the vera for all automation.
I only use this speaker thing and HA for sound like "upper gate open" when it's opened.
I also use HA to scan all sensors for open/tripped states @ 11pm and announce "the west garage door is open" for example.
I was a huge pain in the @$$ to set up but basicly..

set up HA on a raspberry Pi
set it to use the Vera
vera:
  vera_controller_url: http://192.168.0.200:3480/
  lights: [6, 7, 16, 29, 32, 40, 43, 45, 99, 122]
  exclude: [ 90, 91, 92]

setup automatons
- id: '1535144973178'
  alias: Laundyroom Door Open
  trigger:
  - entity_id: binary_sensor.laundyroomdoor_113   <-- there a file that gets created that has all the Vera device names.
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - alias: play_ldo_mp3
    data:
      url: http://192.168.0.201/sound.php?file=ldo&volume=100
    service: rest_command.play_ldo_mp3

setup the rest commands
#rest_command:
  play_ldo_mp3:
    url: "http://192.168.0.201/sound.php?file=ldo&volume=100"

Offline RV

  • Full Member
  • ***
  • Posts: 136
  • Karma: +0/-0
Re: Vera Home Made Raspberry pi Speakers
« Reply #29 on: February 27, 2019, 06:39:16 pm »
there's probably an easier way to do this but the helpful people @ the HA forums suggested "rest" so that's the route I took.

I think it could be done by using the same HA pi as a media player for HA and call the mp3 directly a folder on it and play on a speaker attached to the HA rPI.