Return to site

How To Control Alexa From Mac

broken image


  1. How To Control Alexa From My Phone
  2. How To Control Alexa From Mac Computers
  3. How To Control Alexa From My Voip Phone

Last week's post we talked about how Alexa can be used to talk to an Arduino micro controller using the code from an earlier project. This week, we'll continue exploring this project by creating an Arduino Server that will listen for commands, and execute commands based on this task.

If you want to change the name, just say 'Alexa, change the wake word' and make your selection. How to change partition size mac. You can also open the Alexa app, go to Settings Device Settings select your device tap Wake.

Recap: Using Alexa to Control an Arduino Device

  1. Recap: Using Alexa to Control an Arduino Device. If you remember, I start with an Arduino, attach an ethernet shield to it and connect it to the network. Set the Mac Address, the IPAddress and Gateway, then create a server listening on a port with one line of code: EthernetServer server(23); This line starts a server on port 23, listening.
  2. Control Alexa from your Windows 10 PC. After a limited release on 'compatible devices' like Yoga laptops, Amazon's Alexa voice assistant is now available for Windows 10.
  3. Next, select DISCOVER DEVICES, or just ask Alexa 'Discover my devices'. Alexa will find your heat pump (s) that you have connected in Mitsubishi Electric Wi-Fi Control. You can now control your heat pump (s) with Alexa. Just ask 'Alexa, turn lounge on'.

If you remember, I start with an Arduino, attach an ethernet shield to it and connect it to the network. I program a server on the Arduino to listen for commands and do something when it gets them, and then in the pyHarmony App, I put in a string to talk to the Arduino, issuing recognizable commands, then push that off to the website, and have it tell the Arduino what to do.

Machine

Creating an Arduino Server is relatively easy. Using the Ethernet Libraries from Arduino, its just a few lines of code to build our server. Set the Mac Address, the IPAddress and Gateway, then create a server listening on a port with one line of code: EthernetServer server(23); This line starts a server on port 23, listening for incoming connections. Below is the server setup block:

Once we've created our server, we can set up a connection and start listening for data. This too is easy, and done with just a few lines of code.

Line 17 through 19 setup the server listener and allows the connection. A telnet connection is made to the Arduino, and the connection is then established.

Next, we need to have the code start listening for the data coming in. The Loop function is where this all takes place. EthernetClient client = server.available(); starts the listening; a connection is made, and then we determine if we are establishing a new connection or if we are just looking at data coming in from an existing connection. If the connection is new, we send the word 'Hello' to let the client know that they are connected and can start sending data. If we've already done that, we simply enter a loop and grab and store each character coming in a variable called incoming.

Incoming is an array of 8 characters long, but Arduino requires that strings end with NULL, so the 8th position is reserved for that. This means our commands can be strings of seven characters long. For each character we receive, we add it to the incoming array, (to build the command) and echo the string back to the client to tell them we got it. So; Client sends 'S', we capture 'S' and put it in incoming in position 1, and send 'S' back to the client to tell them we got it. Next the client sends 't', and as before, we store 't' in incoming at position 2, and sent 't' back to the client. We continue doing this for 7 characters building something like 'S','t','a','r','t','I','t', and we have a command!

Once we reach our 7 character limit, we process the command, reset incoming to empty, and start over for the next command.

Examine the Results

Then all we need to do is examine the string we got. If 'StartIt' is a command we want to recognize, we simply parse, and process on a match.

In the following code sample, I'm recognizing 2 commands; 'StartIt' and 'StopIt ', and anything else is treated as an unrecognized command. It's trivial to add more commands; simply put in an 'if' clause for each command you want. These commands don't do much, actually, I'll leave it to you to figure out what you want your Arduino to do, but it could be lots of things.

You could read a sensor and return the value of it. You could start/stop a motor. You could talk to another Arduino and tell it to do something (a technique I'll be Using to get Jeeves to rumble into the room). There's lots of possibilities here; just add your imagination and stir!

Test the code

To test this code, download it to your Arduino; take care to set the IP settings right for your network. Plug in an Ethernet Shield and connect your network cable. On your computer, start telnet and connect to the Arduino on the IP you specified in code. Press enter a couple of times until you get 'Hello!' and then press a couple more times till you get 'Unknown Command'. Then type in 'StartIt' or 'StopIt ' and the Arduino should send you back a confirmation.

In the next chapter, we'll build out the client (the bits that go between Alexa and the Arduino), and start talking about how to get Alexa to do her bit. See you then!

Sonos has recently updated their Application and products to allow for integration with Amazon's Alexa. This now lets you control your Sonos speakers by simply asking Alexa to play a song/playlist/station on a speaker.

The content below is from the Sonos support site and can be found in its entirety here

What is Amazon Alexa?
Amazon Alexa is the easy-to-use voice service from Amazon that allows you to control your music, get the weather, traffic reports, control your smart home, and much more. All with your voice. Use any Amazon Alexa enabled device to control your Sonos system with your voice. Just ask Alexa to play your favorite tunes and enjoy the music from your Sonos speakers.

Where is Amazon Alexa available?
Amazon Alexa is currently available in the United States, Germany, and the United Kingdom.

What do I need to use Alexa with my Sonos?

  1. An Internet connection / WiFi router
  2. Sonos system running the latest update
  3. Alexa enabled device

How do I control Sonos from Alexa?
Follow the steps below to connect your Amazon Alexa to your Sonos system:

Which music services can I use with Alexa?
Music services need to be added to both Sonos and the Alexa app. The following services are currently supported:

  • Amazon Music
  • Pandora
  • iHeartRadio
  • TuneIn Radio
  • SiriusXM

What commands can I use with Sonos?
Use your Amazon Alexa devices as you normally do, just say the name of the Sonos room you want to play the music through when instructing Alexa to play music. For example;

How To Control Alexa From My Phone

  • Alexa, play Blondie in the bedroom.
  • Alexa, play Lorde in the living room.
  • Alexa, turn the volume up in the bathroom.

Any non-music related commands will still play over your Alexa device (weather, traffic, flash briefs, etc). For a list of commands you can use with Sonos check our article: Controlling your Sonos with Amazon Alexa How to install new mac os from usb.

From

Creating an Arduino Server is relatively easy. Using the Ethernet Libraries from Arduino, its just a few lines of code to build our server. Set the Mac Address, the IPAddress and Gateway, then create a server listening on a port with one line of code: EthernetServer server(23); This line starts a server on port 23, listening for incoming connections. Below is the server setup block:

Once we've created our server, we can set up a connection and start listening for data. This too is easy, and done with just a few lines of code.

Line 17 through 19 setup the server listener and allows the connection. A telnet connection is made to the Arduino, and the connection is then established.

Next, we need to have the code start listening for the data coming in. The Loop function is where this all takes place. EthernetClient client = server.available(); starts the listening; a connection is made, and then we determine if we are establishing a new connection or if we are just looking at data coming in from an existing connection. If the connection is new, we send the word 'Hello' to let the client know that they are connected and can start sending data. If we've already done that, we simply enter a loop and grab and store each character coming in a variable called incoming.

Incoming is an array of 8 characters long, but Arduino requires that strings end with NULL, so the 8th position is reserved for that. This means our commands can be strings of seven characters long. For each character we receive, we add it to the incoming array, (to build the command) and echo the string back to the client to tell them we got it. So; Client sends 'S', we capture 'S' and put it in incoming in position 1, and send 'S' back to the client to tell them we got it. Next the client sends 't', and as before, we store 't' in incoming at position 2, and sent 't' back to the client. We continue doing this for 7 characters building something like 'S','t','a','r','t','I','t', and we have a command!

Once we reach our 7 character limit, we process the command, reset incoming to empty, and start over for the next command.

Examine the Results

Then all we need to do is examine the string we got. If 'StartIt' is a command we want to recognize, we simply parse, and process on a match.

In the following code sample, I'm recognizing 2 commands; 'StartIt' and 'StopIt ', and anything else is treated as an unrecognized command. It's trivial to add more commands; simply put in an 'if' clause for each command you want. These commands don't do much, actually, I'll leave it to you to figure out what you want your Arduino to do, but it could be lots of things.

You could read a sensor and return the value of it. You could start/stop a motor. You could talk to another Arduino and tell it to do something (a technique I'll be Using to get Jeeves to rumble into the room). There's lots of possibilities here; just add your imagination and stir!

Test the code

To test this code, download it to your Arduino; take care to set the IP settings right for your network. Plug in an Ethernet Shield and connect your network cable. On your computer, start telnet and connect to the Arduino on the IP you specified in code. Press enter a couple of times until you get 'Hello!' and then press a couple more times till you get 'Unknown Command'. Then type in 'StartIt' or 'StopIt ' and the Arduino should send you back a confirmation.

In the next chapter, we'll build out the client (the bits that go between Alexa and the Arduino), and start talking about how to get Alexa to do her bit. See you then!

Sonos has recently updated their Application and products to allow for integration with Amazon's Alexa. This now lets you control your Sonos speakers by simply asking Alexa to play a song/playlist/station on a speaker.

The content below is from the Sonos support site and can be found in its entirety here

What is Amazon Alexa?
Amazon Alexa is the easy-to-use voice service from Amazon that allows you to control your music, get the weather, traffic reports, control your smart home, and much more. All with your voice. Use any Amazon Alexa enabled device to control your Sonos system with your voice. Just ask Alexa to play your favorite tunes and enjoy the music from your Sonos speakers.

Where is Amazon Alexa available?
Amazon Alexa is currently available in the United States, Germany, and the United Kingdom.

What do I need to use Alexa with my Sonos?

  1. An Internet connection / WiFi router
  2. Sonos system running the latest update
  3. Alexa enabled device

How do I control Sonos from Alexa?
Follow the steps below to connect your Amazon Alexa to your Sonos system:

Which music services can I use with Alexa?
Music services need to be added to both Sonos and the Alexa app. The following services are currently supported:

  • Amazon Music
  • Pandora
  • iHeartRadio
  • TuneIn Radio
  • SiriusXM

What commands can I use with Sonos?
Use your Amazon Alexa devices as you normally do, just say the name of the Sonos room you want to play the music through when instructing Alexa to play music. For example;

How To Control Alexa From My Phone

  • Alexa, play Blondie in the bedroom.
  • Alexa, play Lorde in the living room.
  • Alexa, turn the volume up in the bathroom.

Any non-music related commands will still play over your Alexa device (weather, traffic, flash briefs, etc). For a list of commands you can use with Sonos check our article: Controlling your Sonos with Amazon Alexa How to install new mac os from usb.

How To Control Alexa From Mac Computers

If you experience issues using Alexa with Sonos, please see our troubleshooting article for additional help.

How To Control Alexa From My Voip Phone

How to get more storage on my mac. —





broken image