Create a DialogFlow Agent which accepts end-user's queries. It extracts keywords (for example, the country name) from those queries and populates those keywords into a Firebase database. Next on Linux, it extracts those keywords from Firebase and displays it on Google Earth.
- Go to the Dialog Flow Website. Click Sign in wih Google, and sign in.
- In the Left Panel, click on Create Agent.
- A new window would have appeared in the middle of the page, at the top click on Agent name, and give your agent a name.
- Click on CREATE.
- After it creates, click on Intents on the left side of the page.
- Then click on CREATE INTENT.
- Give your Intent a name by clicking on Intent Name, I named my intent AskLocation.
- Click on Contexts, followed by ADD CONTEXT. Now, type in an Input Context, I named mine ask_for_location.
- Click on Actions and parameters, followed by ADD PARAMETERS AND ACTION.
- Under PARAMETER NAME, give it a name, I named mine location.
- Under ENTITY, type in
@sys.geo-country
. - Under VALUE, type in your Parameter Name, so I typed in location.
- Click SAVE.
- Under Training Phrases, followed by ADD TRAINING PHRASES, type in some Phrases your end users will say. For example I want to look at america (Make sure there is a country in each training phrase). Keep adding new training phrases, as your phrases get populated, DialogFlow will highlight the country names in yellow, if it doesnt double click that country name, next click on location.
- Scroll down to Fulfillment, followed by ADD FULFILLMENT, then check the Enable webhook call for this intent.
- Click on SAVE.
- Your Intent should look like this.
- Click back on Intents, then Default Welcome Intent.
- Under Contexts, leave the input context blank, for the output context type in the Input Context you set for your previous intent. For me it was ask_for_location. (If you forgot the name of your input context, then click back on Intents, then your other Intent. You should see your input context there)
- Still in the Default Welcome Intent, scroll down to Responses. Type in
Hi! What do you want to see?
- Click on Save.
- Your Default Welcome Intent should look like this..
- Go to the Firebase Website. Click on Get Started and sign in to your Google Account.
- Under Your projects using Firebase, click on the project with the name of your Dialog Flow Agent.
- Under Discover Firebase, click on Get Started for the Database box.
- Click on Create Database.
- Click on Enable.
- On the top of the page, next to Database, make sure it says Realtime Databse, if it doesn't, click on the small downward facing triangle, and select Realtime Database.
- Make sure, you are under the data section, if not just click on data.
- You should see
null
, hover over that then click on the small plus icon. - For Name, type in a broad name, like location. Don't type in specific names like Country/State etc. I named mine Location.
- Leave the value blank, then click on the plus icon next to the value box.
- For Name, type in Country. (Remember
@sys.geo-country
, that extracts countries) - Set the Value to anything, I named mine Empty.
- Lastly, click on the Add button.
- Copy your database URL, it should end with .firebaseio.com/.
- Your Firebase Database should look like this.
- Head back over to Dialog Flow.
- On the left panel, click on Fulfillment
- Enable the Inline Editor, by clicking the Enabled button.
- Make sure you are under index.js.
- Delete all the code currently in the Inline Editor, and replace it with this.
- In the code, replace DATABASEURL with your database URL. When you copy your Database URL, remove the HTTPS://. It should look something like this:
ws://NAME.firebaseio.com/
. - In the code, replace BROADNAME with the broad name from your database. Mine looks like this:
return admin.database().ref('location').transaction((location) => {
. - In the code, replace NAMEOFINTENT to what your intent name is. Mine looks like this:
intentMap.set('AskLocation', handleLocation);
- Click on DEPLOY.
- After it deployes, you can test it out. On the Try it now field, type in a greeting (like hi, hello etc). It will respond
Hi! What do you want to see?
, now type in a country name. It will finally respondThank You... Viewing (name of your country) on Liquid Galaxy
!
Use the termial for the installation
- Install all updates
sudo apt-get update
sudo apt-get upgrade
- Install curl:
sudo apt-get install curl
- Install node.js:
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
- Install Firebase CLI:
npm install -g firebase-tools
- Log in to Firebase:
firebase login
When you run this command, it will ask if Firebase can collect ULI usage and error, just typeY
Then it will open a window, there you log into your Google Account - Initialize your Firebase CLI:
firebase init
When you run this command, it will ask you which features to select, select all of them. To select click on space, and to go down click on the down key. Click enter when you finish selecting them all.
Next, it will ask you to set up a default Firebase project. Select the project which contains your database, from the Set Up Firebase Section.
After that, just keep clicking enter. Until it asks for what language to use.
Chose JavaScript
when it askes for what language to use for Cloud Function.
Then, type y
for when it askes if you want to use ESLint
Next, type Y
when it askes to install dependencies.
After that, click enter when it askes to use your public directory.
Then, type y
for when it askes to configure it as a single-page app.
Finally, click enter for when it asks about Storage Rules.
- On Linux, open the browser and go to the Google Earth download page.
- Download and install it, by using the default software install (or any other way to install it).
- Navigate to Google Earth folder:
cd /opt/google/earth/pro
- Edit drivers.ini file with Root privileges:
sudo nano drivers.ini
BetweenSETTINGS{
andCPUVertexBlendEfficiency = 1.2
, type in the following:;ViewSync settings
ViewSync/queryFile = /tmp/query.txt
ViewSync/send = true
Click Ctrl-X
ThenY
to Save - drivers.ini should look like this.
- Download Script:
wget https://raw.githubusercontent.com/MyWorldRules/LGxVoiceControl/master/LGScript.sh
- Edit Script
nano LGScript.sh
Use the arrow keys to go down tofirebase database:get /BROADNAME/country > messages.txt
. Replace BROADNAME with the Broad Name from the Firebase database.
Click Ctrl-X
ThenY
to Save - Give execute permission to the script:
chmod +x LGScript.sh
- Open Google Earth
- Run the script:
./LGScript.sh
Note: The first time you run the file, you will get a error. From the second time onward there will be no error. - To stop the script, simply click Ctrl-C