Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Do you know easy way to use "ok Google" on Android?


Recommended Posts

Guest Roman
Posted

Hi, guys.

 

I want to talk about Android platform.

Our clients very often asks about possibility to control smart home via voice.

Lili is cool, but it's not very fast to open Fibaro application, navigate to Lili and click start listening..

As for me it's much faster just to create widget shortcut on home screen.

 

So I want to use "okay google" voice activation. In this case I even don't need to turn tablet (phone) on.
I found possibility to run Fibaro scenes via Tasker. But this is very long way. It's really boring to create every voice command using phone screen.

 

 

So my question.

Do you know easy way how to use "okay google" voice control with Fibaro?

Posted

edit: Ah sorry, first video was blocked for me. AutoVoice is described.

Please login or register to see this image.

/emoticons/default_icon_redface.gif" alt=":oops:" />  But I think AutoVoice is the best solution next to fibaro. Works very reliably.

 

Hi Roman,

 

check

Please login or register to see this link.

. There is the function implemented you need (no interaction with tablet/smartphone needed, only speaking). It is possible to use "Ok Google" or you make your own keywords. AutoVoice can be used as Tasker Addon.

 

The problem will be the micro. For me it was available when I was just near to my tablet. I was no longer understood two meters from the tablet.

 

Regards,

Mick

Guest Roman
  • Topic Author
  • Posted

    Thank you for your reply!

    As for me it takes much time to add every command by clicking on mobile phone screen.

     

    I have idea, but don't know how to implement it. Probably you can help me.

     

    1. Use Tasker and Autovoice to set global variable in HC2 (like audioCommand="Turn on the lamp").

    2. HC2 will be checking modification event of this variable and do needed actions.

     

    Advantage: phone configured once, and all additional modification on HC2 side.

    What do you think about it?

    Posted

    What about Http-Commands?

    Works fine for me with Restask.

    Guest Roman
  • Topic Author
  • Posted

    Thank you for this advice. Really cool addon for Tasker.
    I was able to set up global variable and run scene.

    Posted

    You can also write script in Tasker which will check what devices you have in your HC2 (by name) and after that it will turn on/off etc.

    Guest Roman
  • Topic Author
  • Posted

    Thank you! Really good appcoach!

     

    As for me I'm thinking about cheap Android tablets located in every room. And same tasker script will be executed on every device.

    It's very easy when android tablet sends to HC2 just text variable (recognized command). And after it HC allows to handle it.

    It much easyier to modify code only on HC2. And do not change anything on tablets from time to time.

     

    Have anybody tested device like this?

    Please login or register to see this link.

     

    If I'm not wrong it has microphone. So probably tasker will work on it.

    Posted

    Thank you for this advice. Really cool addon for Tasker.

    I was able to set up global variable and run scene.

    Roman, could you share how Restask must be set up in order to modify a global variable value?

    I managed to change the global variable value writing the variable body (including variable name and new value) in the "custom body" field of Restask, but this does not trigger a scene sensitive to global variable changes.

    Moreover, this way only passes "hard coded" values, whilst we want to pass the autovoice recognized text.

    Guest Roman
  • Topic Author
  • Posted

    This exampe allows to set value of global variable called voiceCommand. Pay attantion, this variables should be created before in Variables Panel.

     

    Request type: PUT

    HOST: http://<hc2 ip address>/api/globalVariables/voiceCommand

    Basic Auth: your login and pass from HC2.

    Enable custom body: checked

    Custom body: {"name":"voiceCommand","value":"%avcomm"}

    Posted

    Thanks Roman.

    Believe or not, that was exactly, letter by letter (including the name of the variable voiceCommand), my setup of Restask (I guess that all of us are so predictable...) but it doesn't work.

    I have set a notification to verify that %avcomm variable (and also %avcommnofilter, just to test) are correctly detected in Autovoice and passed on to tasker, but unfortunately Restask does not take it. Hoewever, a fixed value like "value":"whatever" does work. 

    Please login or register to see this image.

    /emoticons/default_icon_eek.gif" alt=":shock:" />  

     

     

    EDIT: I found my mistake. I had skipped the quotes in %avcommand.

     

    Now it is working. However, this procedure does not start the scene automatically, even though it should react to any change of this variable. This is not a big deal anyhow, because i can start it from tasker inmediately after changing the global variable but i am just curious why this does not happen automatically.

    Guest Roman
  • Topic Author
  • Posted

    > Now it is working. However, this procedure does not start the scene automatically, even though it should react to any change of this variable. This is not a big deal anyhow, because i can start it from tasker inmediately after changing the global variable but i am just curious why this does not happen automatically.

    Yes, you are right. I also added startScene code right after this.

     

    Additional idea how to improve it:

    Please login or register to see this code.

    This code should be in VitrualDeivice button. It allows to use lili commands with Okay Google.

    Posted

    Well, I have never used Lilli, due to its low reliability . And now that we have the opportunity to setup a scene for voice recognition purposes I have rather selected a different approach, more flexible from the speech detection point of view.

    This is how i have built the scene;:

     

    First of all, we start retrieving the the speech previously stored in the already mentioned "voiceCommand" global variable through tasker and Autovoice as explained in previous posts.

    Please login or register to see this code.

    Then we need to create a variable containing keywords for the different actions we want to build. This is an example, but there are no limits:

    Please login or register to see this code.

    The keywords variable will be analyzed by the "findCommand" function, which looks for coincidences of these keywords with the retrieved speech, identifies the commands and stores them in a new variable "commandList" for futher actions:

    Please login or register to see this code.

    idIsInList is this supporting function:

    Please login or register to see this code.

    Note that the function can identify several commands in the same speech. A command will be recognized only if ALL keywords of at least one variant are met, although those keywords can be called in any order. 

     

    Then we need the "executeActions" function:

    Please login or register to see this code.

    Note that the command names must match those in "keywords" variable.

     

    Finally, we need to trigger the process:

    Please login or register to see this code.

    And that's all.

    After triggering "OK Google" you could say for instance: "Turn on the lamp in the corner, please", or even "could you please switch the corner lamp off and play some music?" . It's cool. Kids love it (I do too). 

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    Posted

    So is the above code for a VD, or does it run as a standalone scene?

    Posted

    That is for a scene, that must also be triggered by Tasker, right after it changes the "voiceCommand" global variable.

    Posted

    Understood.

     

    I'm still doing it the "hard way" (each command send from the phone by REST call)

    Lot's of coding on the phone.

     

    Your way does look way easer...

     

    Testing now.

    Posted

    Hmmmm

     

    Getting an "bad argument #1 to 'find' (string expected, got nil)"error from the function findCommand (speech)

    Error is within: match = match and (string.find (speech, word) ~= nil) 

     

    Please login or register to see this code.

    Posted

    That was my mistake while transcribing the scene. Now edited.

    local commList = findCommand (trigger) must be:

     local commList = findCommand (speech) ;

    Posted

    To bad that we can not do a 'invokeScenes'=>true within the 1st RES call, instead of calling the scene again to trigger it.

     

    It would speed things up a lot!

    Posted

    Must be an ID 10 T error here (read IDIOT), but for some reason I can not get the scene to trigger anymore after populating the variable "voiceCommand".

    How should the 2nd REScall look like?

    Posted

    Please login or register to see this link.

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Reply to this topic...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...