connecting a raspberry pi to a google home - raspberry-pi

I want to control my raspberry pi with my Google Home at college, but everything I find involves a server and opening a port which I can not do on my schools network.
Is there another way I can do this?

The Google Home has no way to directly control other devices on the same network or through other wireless protocols. Everything goes through an Internet-based service and expects to communicate with devices via a server-based proxy. How that server communicates with the device is up to the developer.
Depending on your needs and capabilities, you do have a few options.
One option, for example, is to use a tool like ngrok to create a tunnel between the device itself and a service run by ngrok on the public Internet. Calls to the public https address are sent to a service running locally on your device, and you can handle it accordingly.
Another is to have your device connect to a server and listen for command changes, and then execute those changes. If you don't want to run a server, you can even use something like Firebase - have your device listen for changes on the real-time database (which can use the HTTPS port to communicate as a client, so you don't open anything) and have something like a Firebase Cloud Function act as the webhook for your Action.

Go through this blog post: http://nilhcem.com/android-things/google-assistant-smart-home
You will have to set up a OAuth server but as #Prisoner said you can use ngrok to tunnel the device to internet, BUT I would recommend using "localtunnel" as it provides a free static url and the set-up is also easy. NO Port Forwarding is required with this method.
More info on localtunnel setup:-
How to generate fixed url with ngrok
Moreover you need to activate the OAuth server only once for account linking & than you can close it.

The simplest way I can think of is to expose your Pi to the internet (using port forwarding, ngrok, or whatever) then set up an IFTTT Google Assistant trigger to invoke a webhook which points to your exposed Pi.

Related

Video call on Unity with WebRTC without server

I'd like to make a video call app using WebRTC on Unity. I have investigated almost of the WebRTC services and found out that the WebRTC services require "my own server" for authentication(to give users privileges to access the server). Some companies even say "no server needed" but I actually had to register my server domain to use their services - sounds weird...
my questions are :
why do we need to prepare server (It seems the service provider could have prepared auth servers as well)
Is there any WebRTC service as a complete sever bundle(really woking with client-side app only)
Thanks.
For webrtc you need at at least to exchange the candidate between the peer to allow them to connect (it's called signaling int the webrtc architechture), you also need server to handle network path if nat doesn't allow it (stun/turn server).
There is a lot of server and client depending on your use case complexity and stack. (kurento, Freeswitch, peerJs server ... )

Remote.it and openVPN together

So this is a classic question that I’ve seen many times before...
I’m trying to connect to my home network when not at home using a raspberry pi.
I’m well aware that the way to go with this is to use a vpn server such as OpenVPN.
However, in order to connect to the vpn I would need to forward a port on my router... which I can’t do.
I’ve found remote.it which allows remote connection to a computer (pi) without port forwarding.
What I would like to know is how would I set about using the 2 together, I.e. connecting to remote.it which in turn connects me to my vpn server?
I'm sorry to be finding this question just now, but in case it's still useful to you or to anyone else, here's what you need to do:
Install remote.it
Set-up a remote.it connection to use the protocol (TCP/UDP) and port required by the VPN application
Make a remote.it connection/adding the service to your network (remoteit - Desktop application UI terminology)
Use this connection info (URL/port or localhost:port) with the VPN client
Send an e-mail to support#remote.it if you need help
I would recommend ZeroTier(https://www.zerotier.com/). It haves its own linux client , and you can connect to as many networks as you would like.
You can also configure IP address from the website.
There is also an Android an IOS app that is really simple to connect.

Google Smart Home integration with my IoT device (clarification needed)

I am looking for some clarification to how Google Smart Home works.
I am looking to integrate my current end device which control lights with Google Smart Home.
My end device is running a very small microcontroller utilizing an RTOS (Linux is not available)
Here is how I see it (Please correct or comment)
To my understanding this requires me to host my own cloud service
which will talk to my current end device?
My cloud service will then talk to Google cloud service.
My cloud service defines the protocol to talk to multiple end devices
Google Smart Home define the protocol to talk to my cloud service
Questions
Is there any method of doing this without having my own cloud Service?
That is a pretty basic summary of things - yes.
The crucial point there is that issuing a command to the Google Home does not have it send out a message on your local network. Google issues any commands from their network - not from your device.
This might seem like a minor detail, but it doesn't need to be a "cloud service" that you control that Google talks to. It does need to be a publicly accessible HTTPS endpoint. This could be a cloud service (and it would be in most cases), a public non-cloud server, or even just a public URL that has a tunnel to your private network (such as with ngrok).
The last is really how you'd get around having your own cloud service - you can setup the control on a local machine, and have a tunnel using ngrok.
I think a specific example may be beneficial: here's how to connect Google Home to your devices using an intermediary service like IFTTT:
Create a recipe (applet) on IFTTT to connect Google Assistant to an ngrok tunnel using the Webhook service. This permits you to define a simple keyword phrase that the Google Home will recognize (like "Hey Google turn on my device"). The applet will then call a webhook - e.g. ngrok - with a custom command that you get to define (like "https://myngroktunnel.ngrok.io/Control.cgi?mydevice=on" ), where myngroktunnel is your ngrok tunnel address (see below #2) and Control.cgi is the CGI script that you have placed on your microcontroller (see below #3).
You would need to install and run ngrok on your microcontroller: this will connect the IFTTT applet to your microcontroller via the ngrok tunnel and give you a publicly-accessible URL that forwards requests to your microcontroller. You would typically forward your ngrok tunnel to a specific port on your microcontroller where you are running a web server (e.g. Apache) with CGI scripts to control your device. There are other secure tunnel services available on the web: ngrok is just one of them. So, you do not have to host your own webservice, but you do have to use a tunnel to a publicly-accessible service.
The web server that you have placed on your microcontroller has CGI scripts that control your device (for example, let's say you have a Control.cgi script that turns your device on or off, given a command string like mydevice=on, e.g. the hook in the IFTTT applet is "/Control.cgi?mycommand=on"
Of course, the RTOS on your microcontroller muse be capable of running ngrok and a web server - this is why many people have chosen to use a single-board computer like the Raspberry Pi or Orange Pi running a form of linux to host and control their devices. Since your device's RTOS is not linux, I would suggest getting a linux device which would then forward the request to your RTOS device over your LAN.

Port Forwarding VPN Server

i'm planning on implementing web server hosted by Raspberry Pi at home, while also having a Dedicated Server with public IP.
The main problem is that my provider charge a lot for a static ip, so i simply dont want to pay.
And here is the question:
Is it possible to achieve what i've mentioned on given diagram (if yes, then maybe some hints?)
Will RPi be accessible through local network while connected to VPN
Thank you for any help!
1.
That is basically possible, it is called a Reverse-Proxy (See wiki for a brief description). The exact implementation depends on the web server you use.
Your dedicated Server will then accept client connections, get the content over the VPN from your Raspberry and serve it to the client like it's his.
2.
Your Pi will still be accessible from the local network while being in the VPN, since it should use a virtual adapter for the connection if its a client on its own. Otherwise, if the router acts as a gateway to the VPN it will do the routing and again your Pi will be fine.

Configuring NetGear router with PHP Front End?

I have a netgear router and a PC that functions as the server. On the server I have a website that is hosted on a WAMP solution (windows, apache, mysql, php). Linux is an option, but Windows is first prize in this specific scenario.
What I need:
If someone connects to the wireless network, the splash page that is hosted on the server must be displayed.
All users must have bandwidth limits that are configurable for each user
I must be able to interact with the router via PHP code, in order to execute certain functions when certain users logon, etc.
So, my question is, how do people normally do this? Is there a way to configure this on the router (users connect to ROUTER), or is this something that can only be accomplished with a PROXY (users connect to proxy on server, server connects to internet via router).
Is this possible? Is there software available that does this? Is a proxy what I really need?
If your router supports it, you can install DD-WRT onto the router and use NoCatSplash to capture the connected user's first HTTP request and redirect it as needed.