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

os.execute nil ?


Question

Posted
Hi,

 

i'm totally new to lua, what i'm trying to do is to write the power value (FGP111 Plug) to a influxdb using curl/post.

what i get is that the output window tells me that os.execute is a nil value (non-existant ?)

if that is the case how else can i achieve this behaviour ?

 


(Homecenter 2, 4.090)

 


Any help is appreciated!

Thank you in advance

 


 

 

 


SOURCE:

 

--[[

%% properties

17 power

%% events

%% globals

--]]

 

local power = fibaro:getValue(17, "power")

local startSource = fibaro:getSourceTrigger();

if ((tonumber(fibaro:getValue(17, "power")) > 1 ) or startSource["type"] == "other")

then

  runcommand = 'curl -i -XPOST \"

Please login or register to see this link.

--data-binary mischer,host=server02 value='.. power ..'' 

  print(runcommand)

  os.execute(runcommand)

end

 

 

OUTPUT:


 

[DEBUG] 08:51:08: curl -i -XPOST "

Please login or register to see this link.

--data-binary mischer,host=server02 value=1.3

[DEBUG] 08:51:08: line 15: attempt to call field 'execute' (a nil value)

 


 

3 answers to this question

Recommended Posts

  • 0
Posted

there are LUA restrictions (made by Fibaro, below the list) on HC2 (since 1.5yrs or so), so imporve security:

Please login or register to see this code.

  • 0
  • Inquirer
  • Posted

    fair enough, but how do i perform the post now ?

    • 0
    Posted

    with e.g. (from Scene) net.HTTPClient, check

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