LIQUIDATION SALE! FREE Shipping on orders over $49 USA $99 INTERNATIONAL USE CODE: "LIQUIDATION" for 50% OF

Chromecast Binding

Chromecast Binding

Demo: 

Hey guys Matt here from MKSmartHouse.com and in this video I am going to show you how to connect your chromecast to openhab.
In this complete guide I will show you how to connect your google chromecast to openhab so you can control it from your phone, computer, amazon echo and eventually habpanel. 
First let me show you how it looks on my phone, there are two items, the first one is a control item and from here we can go back, pause, play and go forward. In the second item we can control the volume via a slider. 
Speaking of volume we can also control it using the amazon echo, “Alexa set Living Room Chromecast Volume to 100”
The items needed to complete this guide are the following: 1. A computer running either mac or windows, I will not be making a seperate guide for each because we are just going to be using it for ssh. 2. A fully setup Google Chromecast. The links to all the parts and devices mentioned are in the video description.
Speaking of links in the description, follow @mksmarthouse on twitter, instagram and snapchat because those are the place where I give sneak peaks on when videos are releasing and also where I ask for your input on topics and future videos.
1. The first thing we have to is go to the web user interface of our openhab server and then paper ui. 
If you don’t know how to access this then watch my home automation server setup guide. 
2. Anyway next click configuration and then bindings. 
3. Click the plus sign and bindings. 
4. In the search bar type in chromecast. 
5. Once you see the binding press the install button. 
Great the binding is now installed so let’s add the actual chromecast. 
6. Click on inbox and then search for things. 
7. After press chromecast binding. 
It will now go through and look for the chromecasts on your network. 
8. Once your chromecast shows up click the checkmark next to it. 
9. A box will pop up, give the chromecast a name and press add as thing. 
This chromecast is going into the living room so i'm going to give it a name relating to that. The chromecast is now added. There are 2 pieces of text we need in order to make chromecast items. 
10. So, go to Configuration then things and click on your chromecast. You should see 2 channels, volume and control. Keep the paper ui tab open, you will need it later. 
11. Next, ssh into the pi so on windows use putty and mac use terminal. 
I recommend having my website open so that way you can just copy and paste commands, link is in the description. 
12. The first thing we have to do is create the chromecast items in the items file so type in sudo nano /etc/openhab2/items/home.items and press enter. 
13.  Then at the bottom of the file type in:
//MK-Room Chromecast
Dimmer LivingRoomChromecastVolume "Living Room Chromecast Volume" <soundvolume> [ "Switchable" ] { channel="chromecast:chromecast:cb1204772c97f92a8df21f8fc363dccc:volume" }
Player LivingRoomChromecastControl "Living Room Chromecast Control" <mediacontrol> { channel="chromecast:chromecast:cb1204772c97f92a8df21f8fc363dccc:control" }
But, the values in what we just typed in will not work for your specific chromecast. 
14. So let's go back to your paper ui and copy the volume and control binding text from the paper ui to your items file. Now it is properly connected. The two items we created are a volume control and media controller, we will see how they look at work in the basic ui. Also, in the volume item I added the switchable tag so that way I can control the volume through Alexa. 
15. Now press control x then y and enter to save. 
16. Now we need to add the items into the sitemap so type in sudo nano /etc/openhab2/sitemaps/home.sitemap and press enter. 
If you have been following along with my guides then you know I have many frames in my sitemap. 
 
17. Since this chromecast is going into my living room I am going to paste the following code in my living room frame. 
           Default item=LivingRoomChromecastControl
           Slider item=LivingRoomChromecastVolume icon=soundvolume
This code simply imports the items so I can use them in the basic ui. 
18. Now press control x then y and enter to save. 
Awesome! We are now completely done with the setup! Let’s test it out! 
19. First cast something to the chromecast either from your phone or your computer. 
20. Then, open up basic ui from your web user interface, you should see the chromecast items in the frame you put them in. 
21. Test out the buttons in the control section. 
22. Next test the volume slider. 
23. Finally, if you have an Amazon Echo ask alexa to set the volume. “Alexa set Living Room Chromecast Volume to 50” 
That concludes this complete guide to connecting the Google Chromecast to openhab. In the description you will find links to all the parts and devices used in the video as well as a link to mksmarthouse.com/shop where I have a wide range of smart home kits that you can put together such as blinds, led strips, sprinkler system and door sensors. Alright thank you for watching and If you have any questions leave them in the comments section below or head over to mksmarthouse.com/forum. Good Bye!
Chromecast Binding
Links + Downloads:
Chromecast: https://goo.gl/DwaoQo
Amazon Echo: https://amzn.to/2vqXD2c
Computer: https://amzn.to/2HzbsOA
Phone 1: https://amzn.to/2JFilOR
Phone 2: https://amzn.to/2qufv7o
SD Card Reader: http://amzn.to/2lqsvL1
Raspberry Pi 3: http://amzn.to/2m62Kg6
Power Adapter: http://amzn.to/2lIyh5E