dinsdag 20 december 2016

Domoticz - Android voice control "Ok Google"



In this tutorial I would like to explain you how you can setup your Android device to interact with Domoticz based voice commands. In my situation I have a Android Nexus 7 wall tablet and it is really cool to say "Ok Goolge" and then "Christmas tree on" and see the lights go on. The benefit is that I don't need a Google Home voice activated speaker and even I can speak Dutch.



P.s. the below setup is quite simple and you don't need to pay for any app. I had a similar setup with Tasker and AutoVoice but that was quite complex.

What you need:
1) you need a Android device with Google Now activated
2) Automate App from the Google Play Store

To interact with Domoticz from an external device I use the JSON method wich is described in the Domoticz Wiki. I will show a lightswitch on command as example in step 3.

Step 1 (enable Google Now):

Make sure that you have given the right permissions and "Ok Google" command is working.
Turn on "Ok Google" on your Android
My settings are:



The above "From any screen" means I can activate a voice command even from standby.

Step 2 (install Automate):
Install the Automate app and make sure you will give it the right permision.
Android Settings -> Accessibility
Make sure you turn it on for the Automate app



It might differ per android device, but I also enabled some permissions (Connectivity and Storage) within the Automate app under Settings -> permissions.




Step 3 (setup your first flow):



in text:
- press plus
- menu
- search for "Google Now voice command"
- insert text: Christmastreeon
- connect OK of box 1 with IN of box 2
- menu
- search for "Expression true?"
- insert text: christmastreeon (which is the variable defined earlier) = "Christmas tree on" (which is the text used for recognition)
- connect OK of box 2 with IN of box 3
- connect NO of box 3 with IN of box2
- menu
- search for "HTTP request"
- insert text (request URL) http://192.168.1.180:8080/json.htm?type=command&param=switchlight&idx=99&switchcmd=On
- select request method = GET
- select request content type = JSON
REMARKS:
      - use your own IP adress for Domoticz
      - use the right idx value for the switch
      - if you have login credentials in Domoticz enter them here
- connect OK of box 4 with IN of box 2
- press done
- rename the flow towards Christmas tree on and press start
- validate

Step 4 (setup your own flows)
I hope you can use the above and create your own flows within the Android Automate app.

---------------------------------------

Update 22-12-2016:
I included 2 extra boxes at the end of the flow. See below the example.
- "Interact" where I defined Immediately action " Back", this will perform a tap back button so the Google Now search results will not be displayed
-  "Toast show" with the text "Ok, Christmas tree on". A screen popup will be shown.













30 opmerkingen:

  1. Bedankt voor deze handleiding, dit helpt me bijzonder verder in mn domotica. echter, als ik "ok google" in het nederlands zet, kan ik deze niet meer benaderen vanuit een gelocked scherm. Hoe heeft u dit in het nederlands gekregen?

    BeantwoordenVerwijderen
    Reacties
    1. I prefer to keep the comment english so others can read it as well. I use English and Dutch in Google Now. With English primary it allow you to use the "Ok Google" phrase. Dutch is set as secondary so I can use Dutch words which are recognized by Google now as well.

      Verwijderen
  2. Very nice, thx for this. I have it working on a Asus tablet with Android 5 (Android 4.4 - no Google now on any screen option).

    Is there also a solution the get readings back from Domoticz? Like a temperature reading for example?

    BeantwoordenVerwijderen
    Reacties
    1. You can add a text to speech in the flow. The question you have is a bit different. What you could do, create a blocky in domoticz. Like temp 20 degree -> send email to xxx and if email xxx with subject xxx is received on android read value xx.

      Verwijderen
  3. Hallo, i tried what You are writing here, but I cannot set spaces in the Google now command. Zo i could not wat: "Eetkamerlamp aan". How did you do that?

    BeantwoordenVerwijderen
    Reacties
    1. The google now text insert is a variable which should be 1 word. The expression can contain multiple words with spaces. See the steps as mentioned above.

      Verwijderen
  4. Hi... Great work!
    I learning with this tutorial... and with automate and my voice command I can open app ipcamera but i can't close this app because with app "ok google" doesn't listen anymore. Is there any way for this to work?!! Thanks.

    BeantwoordenVerwijderen
    Reacties
    1. I can not advise based on the below. Can you be a bit more specific in which step of the above tutorial you get stuck?

      Verwijderen
  5. Hi... again!!! Could you get a little time to answer my question?! Please!!!

    BeantwoordenVerwijderen
  6. I post here in comment box a link with a printscreen of my scheme automate and disappeared!!!

    BeantwoordenVerwijderen
  7. Hi - any idea on how I could get Google Now to obtain the temperature (e.g. 20 degrees celsius) and read it out aloud from my temperature sensor device?

    BeantwoordenVerwijderen
    Reacties
    1. If you have Domoticz, you could add your temperature sensor, and use a http request to get the current status of that "device".

      Verwijderen
  8. In the text steps you forget to connect box 3 "yes" to box 4 "in".

    BeantwoordenVerwijderen
  9. App cant launch google now, Samsung s7 android 7. Anyone having same problem?

    BeantwoordenVerwijderen
  10. insert text: christmastreeon (which is the variable defined earlier)

    can't find this step in your manual ?

    BeantwoordenVerwijderen
  11. I get an error :fail 11@6 automate java.net.connectexception:connection refused

    BeantwoordenVerwijderen
  12. Works great, thanks for the tutorial.

    BeantwoordenVerwijderen
  13. Hi, works great. Thanks. Is it possible to control more than one switch id in one command?
    Or should I create a specific group in Domoticz?

    BeantwoordenVerwijderen
    Reacties
    1. I dont know the automation app, but i would create a dummy in domoticz and assign actions on that in blocky or lua, That way the sky is the limit and puts the smart things on one system and let google just issue a command.

      Verwijderen
  14. Hello, i have a Google Home Mini, but because Automate isn't available, it won't work with a Google Home Mini?

    BeantwoordenVerwijderen
  15. Thanks a lot for your manual! I used it to build my own setup and it works perfectly!
    Pieter

    BeantwoordenVerwijderen
  16. Thanks for the manual but I have a challange. When I copy it as you made it works. When I replace Keukenverlichting with Spotswoonkamer it does not work anymore.
    google voice command: spotswoonkameraan
    expression true: =spotswoonkameraan = "spots woonkamer aan"
    Google now reports after speach : spots woonkamer aan. So I don;t understand why it does not work. Do you have any idea?

    BeantwoordenVerwijderen
  17. The term “smart home” is used to describe a house, apartment or room, which contains a communication network that connects different devices and allows them to be controlled, monitored and accessed remotely through smartphones, voice aids, and others. Smart devices connect to the Internet, which allows them to be controlled remotely via Wi-Fi.

    Click here to know more information smart home technology

    BeantwoordenVerwijderen
  18. Love this post, just didn't work with my Pocophone F1

    BeantwoordenVerwijderen
  19. WBM Smart devices are usually also able to collect data and store it, either locally in the network or on a cloud server. They can usually also make decisions based on that data. ... Many smart devices can also communicate with other smart devices in their own home network

    BeantwoordenVerwijderen
  20. Looking for smart home devices?Welcome to the [url=https://wbmsmart.com/]Smart Home Automation Devices[/url], Where you'll find great prices on a variety of smart products to automate your Smart Home

    BeantwoordenVerwijderen
  21. This is really awesome there is some other info on this website. House Awesome

    BeantwoordenVerwijderen
  22. Goedemiddag,

    Ik heb je post gelezen over het gebruik van Automate i.c.m. OK google om domoticz te benaderen.
    dit zou voor mij echt de uitkomst zijn voor het bedienen van mijn verlichting.

    ik heb alles ingesteld zoals je in de video hebt aangegeven. echter lijkt het of bij de zin die ik inspreek (na OK google) of deze niet overgenomen wordt naar Automate. als ik de request URL van de http request open in de browser gaan netjes de verlichting aan die aan zou moeten gaan. dus ik weet in ieder geval dat die link goed is.

    Heeft u enig idee waar ik het moet zoeken?
    onder toegankelijkheid staat Automate aan, dus hij zou dan toch OK google commando's moeten kunnen lezen?

    met vriendelijke groet

    Nils

    BeantwoordenVerwijderen
  23. Good afternoon,

    I read your post about using Automate in combination with OK google to approach domoticz.
    this would really be the solution for me to operate my lighting.

    i set everything up as you indicated in the video. however, it seems as if the sentence I say (after OK google) or it is not transferred to Automate. when I open the request URL of the http request in the browser, the lights go on nicely which should come on. so at least I know that link is good.

    Do you have any idea where to look for it?
    under accessibility Automate is on, so it should be able to read OK google commands, right?

    Kind regards

    Nils Nijenhuis

    BeantwoordenVerwijderen