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

Control Arduino with HC2


Guest DPKok

Question

Guest DPKok

Hi there,

 

I'm building a Nextion touchscreen with a arduino ESP8266 chip. I already can start scene's from the display. I'm now struggeling with a way to communicate back. Is there someone who can tell me how to send value's from a variable in Fibaro HC2 to the arduino ESPchip?

 

I created a webserver running on the arduino and can make different actions on it i.e. /ledon runs a led on script on the arduino. But this way i need to make a different script for every single action/value of a variable. undoable when I want to send temp or lux to the arduino. Is there a way, so yes how, to send the value of a global variable in fibaro HC2 to a global variable in the arduino.

 

Cheers,

 

Damien

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 1

Or you can build on the Z-Uno, an Arduino board with a Z-wave chip. Very easy to use.

Please login or register to see this link.

 

Link to comment
Share on other sites

  • 0
Guest DPKok
  • Inquirer
  • 3 hours ago, 10der said:

    http://HC2-IP/docs

     

    I'm familiar with the docs page, thanks.  Do I have to think the other way around? Let the arduino make GET commands in order to 'fill' it's variables?

    Link to comment
    Share on other sites

    • 0
    31 minutes ago, DPKok said:

    Let the arduino make GET commands in order to 'fill' it's variables?

    yep! absolutely right!

    Link to comment
    Share on other sites

    • 0
    Quote

    function asyncGet(url, options)
        local headers = {['Content-Type'] = 'application/json'}
        local opt = options or {}
        self.http:request(url, {    
            options={
                headers = headers,
                method = 'GET'
            }, 
            success = function (response)
                if response then
                    opt.success(response)
            end,
            error = function (error)
                opt.error(error); 
            end    
        })
    end

     

    function setLedOn()
        asyncGet(
            'http://' .. ip .. '/ledon', 
            {
            success=function(resp)
                local data = json.decode(resp.data)
                if data.code == 1000 then
                else
                end            
            end, 
            error=function(error)
            end
            }
        )
    end
     

    Is this what you mean?

    Link to comment
    Share on other sites

    • 0
    Guest DPKok
  • Inquirer
  • I'm not sure, thats behond my knowledge of programming... :(

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