Community Blog Buy Now
Blog

Misty Community Forum

Misty Skill: Get Weather

This is very similar to the getWeather sample in Mission: Connect Misty to your Favorite External API . It was update to reflect the APIXU to Weatherstack changes, and it provides both temperature and weather description for a given location.

3 Likes

This is great, Aaron. I did a little tidying up on the post to show the js file.

This is great. Is there any way we can use misty’s sound capability to convey the results?

There sure is! Use a Text To Speech service. Examples are here in the forum - I would point to Misty Skill: Hello World Rest Joke Time by @2Alpha as a good example.

Hmm…Sounds like you might have found your Hello World skill to work on and post!

@MorningR @johnathan Is there any way I can use this output with misty’s onboard Text to speech command?
I mean is there any example available for it?

Hi @sp22. I was about to say no, the text to speech was only in the .NET SDK, but then searching the documents to confirm my answer, found that it was also in JavaScript! Are you kidding me! You have to watch the Misty Team, they sneak more and more awesomeness into every release!!!

Here are the lines I added to getWeather:

 misty.SetDefaultVolume(20);
 misty.Speak("Misty here! Just letting you know it is " + _temperature + " and " + _weather_descriptions + " in " + _name);

The changes should be posted to my getWeather Skill on GitHub (link above). You have to supply the JSON file parameters - access key and city.

@MorningR I tried the same command earlier but it did not play any response.
But, I did not defined default volume in that skill may be that the issue.
Thanks, I will try this today and will see how it goes.

@sp22 Do you have a weatherstack account? If you do not update the JSON file with a “access key” and “query” values, Misty will not say anything.

 "Parameters": {
   "access Key": "34423473BunchOfNumbes2312216andletters",
   "query": "Chicago"
 }

I tried the default with no key or query and there was no sound. To test out Misty speaking you could try adding the following line outside of the function:

 misty.Speak("Misty here! If you want to know the weather - GO outside!");

Yes I already have an account with weather-stack and I have provided my API key and query parameters for the same. It does display output in console with debug command. I will check this out again.

@MorningR and @sp22, we are investigating a bug in the current software where Misty’s text-to-speech functionality sometimes fails to come up correctly when the robot boots up. When this happens, the Speak command doesn’t work, and the only solution is to reboot the robot and try again. I’ll create a post for this in the Known Issues category when we learn more so you can track our progress on a fix.

@johnathan Yes you are right, It looks like speech command has some bug, I tried earlier the same command as Aron suggested and it did not work earlier, I did not try to restart Misty as I was not aware of any potential issue. But, when I came to home and started misty It did work without any issues. on the other node it also skips the value from the _temparature value while it plays response. not sure why?

Hi @sp22, glad to hear you were able to get speaking to work. Not sure of your temperature value problem. When I run it, it does not skip the temperature. However, there may be variation in the temperature and your input is likely to be different than mine. I updated the getWeather skill with a test piece of code that you can input the temperature, weather conditions, and city and test out different inputs. If only changing the actual weather was this easy.

When and if you get a chance to try it let me know if it works.

There is also a speakSample skill posted. This is just playing with the new misty.Speak command - copied from the Misty documents. As you will see, Misty will say 34 different than thirty four.

@MorningR I tried the sample code you provided and was able to test different skills abilities. In regards to my previous issue where misty skips the temperature values while it speaks, What I observed, was when temperature values are in minus it skips that variable and if temperature value is positive it will consider temperature variable as well when she speaks.
I will try to use google TTS to see if we can send the text to google TTS and get audio to play on misty.