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

Have a virtual device display a value from a file on LAN web server


Question

Posted (edited)

Hi guys

Using HCL, i would like to have a virtual device display a value.

that value is in a file on my raspberry's LAN apache WEB server.

 

Let’s say 192.168.0.123 is my raspberry and the file is http://192.168.0.123/prod.txt

 

the file contains just a number, and it’s updated every hour using a cron job.

for example it could be « 2 » at 8AM, then « 19 » at 9AM, then « 55 » at 10AM, then « 156 » at 11AM, and so on...

It’s just an example, it could be the number of visitors on a website or the number of gallons of water I drink, or Power production of an engine... whatever!

 

my only concern is how to have a virtual module on HCL display that number? 

I don’t care if it’s not updated on HCL at the exact second it is updated on the web server... yet it should be updated somehow every hour also.

 

thanks for any help !

 

 

Edited by fel-x
typo

2 answers to this question

Recommended Posts

  • 0
Posted

only by call HCL VD from raspberry via  API POST of HCL, see last 3 post in:

 

  • 0
  • Inquirer
  • Posted (edited)

    thanks I'll look into that !!

     

    EDIT : problem SOLVED.

     

    There is a way to send a value to a virtual device on HCL.

    Here is my example working from a Raspberry that is on the same LAN :

     

    Please login or register to see this code.

    where LOGIN and PASSWORD are plain text login and password for HCL, like  [email protected]:secretpassword 

    make sure to use your HCL IP address, deviceID (I used 123 in this exemple) and label (I used Label1, which is default on virtual devices).

    You need to have the value in a variable, in this example the variable is $blahblah

    It's also possible to have spaces in the value, by using %20 , so let's pretend $blahblah=13 and it would be like this: arg2='$blahblah%20minutes' 

    (which would send "13 minutes" as the value to display in the virtual device)

     

     

    Edited by fel-x
    SOLVED

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