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

Struggling with LUA / VIrutal devices


JanJoh

Question

Ok, complete newbie with HC2, but a long time electronics builder and semi-coder.

Please login or register to see this image.

/emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

Before i got my HC2 we bought a new house which had a nice out side hot tub, but with a dagerous electrical system.

So, that got rebuilt, and the control of that is now handled by a RPi, some power relay modules and a few sensors. Internet connected and all

Please login or register to see this image.

/emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

However, i would now like to create a virtual device in HC2 to get some data from the tub.

I can (as an example) browse to

Please login or register to see this link.

and that will return

38.741788

(Not as a proper html-file, it just contains that data)

Now, how the heck do I create LUA to get this data from my HC2, and update a label on my virtual device with this informtation? I goofed around quite a lot the last two nights, bit got nowhere fast..

Any hints?

Thanks!

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
Not tested......

Please login or register to see this code.

add also

fibaro:log("Aktuell temp " ..temp)

Link to comment
Share on other sites

  • 0
Guest Lode

And update your label....

Please login or register to see this code.

[ Added: 2013-09-06, 19:59 ]

Wanna know if it works ?

Please login or register to see this image.

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

Please login or register to see this image.

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

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Thank you all!

    I will certainly test this in a while.

    RIght now I am back at square one, as i was unable to log on to my HC after a power failure. So, I wnet back to factory defaults.

    My new plan is to get a few other things working to get some more grip on how LUA actually works.

    The reason i started with the hot tub was the fact that I had not yet gotten the shipment of sensors/switches I was waiting for. So all I had was a Wall Plug and a 2x1,5kW

    Please login or register to see this image.

    /emoticons/default_smile.png" alt=":)" srcset="https://forum.fibaro.com/uploads/emoticons/[email protected] 2x" width="20" height="20" />

    [ Added: 2013-09-08, 17:40 ]

    And update your label....

    Please login or register to see this code.

    [ Added: 2013-09-06, 19:59 ]

    Wanna know if it works ?

    Please login or register to see this image.

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

    Please login or register to see this image.

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

    Hello!

    Not as far as I can see. I see nothing logged in the access logs on the Raspberry. But if I do it from my browser, it is of course served/logged as expected, so the HC2 does not seem to call the RPi

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