Echo & Alexa Forums

Anyone know of an API/Hack to have Echo speak

0 Members and 1 Guest are viewing this topic.

jking519

Anyone know of an API/Hack to have Echo speak
« on: February 24, 2015, 01:08:53 pm »
I just implemented one of the unofficial API's from github to have Alexa control my Nest thermostat.  I'm now looking for a way for Alexa to tell me what the temperature currently is.  So if I say "Alexa, what is the upstairs temperature", she would read the Nest temperature and speak "the temperature is seventy degrees".   

I was thinking something could be done using the "Simon Says" feature.  Anyone try anything like this?

heapmaster

Re: Anyone know of an API/Hack to have Echo speak
« Reply #1 on: May 05, 2015, 05:07:38 pm »
Based on the APIs I have seen I would wait until the Official APIs come out, the current ones I think are based on to-do's

yang3535

Re: Anyone know of an API/Hack to have Echo speak
« Reply #2 on: September 11, 2015, 11:44:06 pm »
Now that the official SDK had been out a while,  has anyone figured out an answer to the OP's question?  It would be nice if someone would figure out a way to send text to the echo for conversion to speech.

I have the echo controlling my lights, but I'd like to have it report door lock status, temperature, etc. perhaps via a simple PUT command to a raspberry pi as intermediary?


Offline jwlv

  • *
  • 1470
Re: Anyone know of an API/Hack to have Echo speak
« Reply #3 on: September 12, 2015, 07:55:53 am »
It's actually quite simple to have Echo say something in response to a request.
In this example, I'm using a PHP script hosted on my website as the endpoint.

I would ask, "Alexa, open [the name of my skill]"
Then the PHP script will tell Alexa to say anything I want it to.

If you wanted to get the current temperature from your thermostat, you will need to know how to get that value. Once you have that value, the script will ask Alexa to speak it.

In a different example, I've demonstrated that Alexa can say anything you tell her to. This example is the Larry skill which asks Alexa to tell a dirty joke. It didn't work 100% at the time, but here's the video of it:
https://www.youtube.com/watch?v=HLj_p_NwBjY 
I found out that the reason why it didn't work correctly sometimes was because I had non-ASCII characters in some of the joke text.

<?
##### some code to get the current temperature
##### for example: $msg = "The current temperature is " . $value . " degrees.";

respond($msg);

function respond($jResponse)
{
 header('Content-Type: application/json;charset=UTF-8');

 $text = '{
"version" : "1.0",
"response" : {
"outputSpeech" : {
"type" : "PlainText",
"text" : "'.$jResponse.'"
},
"shouldEndSession" : '.$true.'
}
}';

 // Response
 header('Content-Length: ' . strlen($text));
 echo $text;
 exit;
}

?>


I just implemented one of the unofficial API's from github to have Alexa control my Nest thermostat.  I'm now looking for a way for Alexa to tell me what the temperature currently is.  So if I say "Alexa, what is the upstairs temperature", she would read the Nest temperature and speak "the temperature is seventy degrees".   

I was thinking something could be done using the "Simon Says" feature.  Anyone try anything like this?

monty617

Re: Anyone know of an API/Hack to have Echo speak
« Reply #4 on: September 16, 2015, 11:19:24 am »
Yes this is fairly easy and almost limitless now with the APIs. I do however wish I could get Alexa to respond to external requests, but unfortunately the initial request has to come from the Echo itself.

dataway

Re: Anyone know of an API/Hack to have Echo speak
« Reply #5 on: December 11, 2015, 11:29:46 am »
I also wanted to implement temperature and humidity monitoring into my home for each room and in turn control my bluetooth enabled vents that I made and one thing i wanted was to ask alexa the temp or humidity for any room in my home and she would respond.  I am happy to say I am almost complete with this installation and use Particle Photons wired with a temperature and humidity sensor which is addressed for each room.  I used this project as my basis to get this going :

https://www.hackster.io/krvarma/particle-alexa-5bc196?ref=part&ref_id=6597&offset=15

He uses a Spark core but is easily adaptable to the Photon with minor code changes.

At this point I can now say " Alexa ask Particle what guest room east temperature is"  Alexa responds with "The temperature in Guest Room East is 67 degrees"  I can also ask for humidity levels, I have also piped this temp and humidity data into an app on my iPhone that handles graphing and provides me with temp and humidity readings for all rooms in my home now.  My next steps are to integrate that into my automated vents to do auto load balancing for heat and humidity for each room or zone of my house...

Hope this gives you a starting point to get the temp readout you are looking for....