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


  • 0

Google Home and HC2 Integration - A work in Progress


ianbren

Question

Hi there, I've been working on getting Google Home (GH) to work with my HC2.

 

It requires a few components - IFTTT, AWS (for the web action) and an ESP8266 to poll AWS for actions.

- ESP8266 - I use a WEMOS D1 Mini to use the built-in USB for power - configured to use Arduino code

- AWS - I use API, Lambda and DynamoDB as a simple message process.

- IFTTT - using the Assistant modules to call AWS and post data to the database

 

I then use a Virtual Device to poll the ESP8266 to see if there are any messages on the database, pull them down and pass them back to HC2 as JSON.

 

The ESP8266 then clears out the database record so the last command isn't used again.

 

At the HC2, the JSON is used in an LUA script.  
 

It's a bit clunky, but the IFTTT integration is very fast to AWS, so any delay is really the second or two that it takes HC2 to poll a VC; about a second longer than the verbal response from IFTTT.

 

 

If there's any interest - say 10 people - I'll rough up the components and post them over to Github.

 

 

 

 

Link to comment
Share on other sites

12 answers to this question

Recommended Posts

  • 0
Guest pablo77

I'm using also esp8266, and I'm trying to configure to get information from esp8266 to HC2.

 

So, if You could, please make Ginthub possible for this forum.

 

I'm looking forward for this integration,

With regards

 

 

Link to comment
Share on other sites

  • 0

@pablo77

Do you use espeasy to your esp8266?

if you do that you could do a json readout from Esp with a VD.

There is a couple of threads about that here on the forum.

Link to comment
Share on other sites

  • 0
Guest pablo77

I'm using this multisensor:

 

 

 

I'll start reading about espeasy

Link to comment
Share on other sites

  • 0
  • Inquirer
  • @pablo77  The basic way to call an ESP8266 is through a Virtual Device (VD).

    1) set up the VD with the IP and Port of the ESP8266 you want to poll.

    2) for a test, add a button to the VD

    3) add two Labels on there as well

    3) drop this code into the LUA section for the button

     

    local thisdevice = fibaro:getSelfId()

    -- the next line uses the VD information in (1) and calls the ESP8266

    local conn = Net.FHttp(fibaro:getValue(thisdevice, 'IPAddress'), fibaro:getValue(thisdevice, 'TCPPort'))

     

    -- if there's a path name, then put it in the GET() method.

    response, status, errorCode = conn:GET('/')

     

    -- respond will have the raw HTML/XML/JSON coming back

     

    -- because you want to know what's coming back - right?

    fibaro:debug(response)

     

    -- good practice

    fibaro:sleep(1)

    if errorCode == 0 then

    -- so , you got something back ok

    -- the Status is not really needed, unless you're going to deal with non-200 HTTP Status codes

      fibaro:debug(status)

     

    -- Example processing JSON

      jsonTable = json.decode(response)

      fibaro:call(thisdevice, "setProperty", "ui.Label1.value", jsonTable.JsonElementName1)
      fibaro:call(thisdevice, "setProperty", "ui.Label2.value", jsonTable.JsonElementName2)

     

    -- maybe you want to call another device - perhaps based on a SJON Value

      fibaro:call(AnotherDeviceID, "pressButton", "1")

        -- Send IFTTT for Special Value -- Placeholder
         fibaro:debug("Sending IFTTT")

    -- I use a generic button for IFTTT alerts -

      fibaro:call(iftttDeviceID, 'pressButton',1)
        end

    else

    -- so we had a non-zero error code

      fibaro:debug("error")

    end

    Edited by ianbren
    • Like 1
    Link to comment
    Share on other sites

    • 0
    Guest pablo77

    Hi,

     

    I'm reading about espeasy, and I must say its much more easer than mqtt option.

     

    Today I'll buy things on Aliexpress to create 5 new multi sensors, with this software.

     

    Many thanks for You 

    Please login or register to see this link.

    Link to comment
    Share on other sites

    • 0

    Super interested, I'm also in Australia. I have a couple of wemos D1 and hoping to be able to control them via http from the HC2. 

    Link to comment
    Share on other sites

    • 0
    Guest pablo77

    Hi,

     

    Why I don't have credentials to see Your post ianbren ??

    Edited by pablo77
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • HI, I was also locked out - I changed the title and it had to go to moderation.

     

     

    Try now - or pop over to 

    Please login or register to see this link.

     

    Link to comment
    Share on other sites

    • 0
    17 minutes ago, ianbren said:

    DO you have a link to the Fibaro/GH integration please?

     

     

    Try following this thread @ianbren. You will be able to work it out from the screen shots, although it doesn't seem to be working in Australia yet.

    Quote

     

     

    Link to comment
    Share on other sites

    Join the conversation

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

    Guest
    Answer this question...

    ×   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...