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


SDK for remote and offline HC3 development


jgab

Recommended Posts

5 hours ago, jgab said:

In any case I have pushed a version (v0.303) where http timeout is specified in ms, like on the HC3. However, I'm pretty sure that the real resolution is seconds... It now also uses net.HTTPClient({timeout=...}) if set.

Thanks

Still sometimes same data received twice when timeout is > 500 mS.

When reducing the timeout to 400 mS. works perfect!

It's probably related to PC performances (speed)

Edited by cag014
Link to comment
Share on other sites

  • Topic Author
  • 19 minutes ago, cag014 said:

    Thanks

    Still sometimes same data received twice when timeout is > 500 mS.

    When reducing the timeout to 400 mS. works perfect!

    It's probably related to PC performances (speed)

    The only time I get the same .last is when the server decides to timeout and return events = {} or events = nil,

    but that's easy to check.

    Link to comment
    Share on other sites

    @jgab

    I newest version I have this bug:

    [27.04.2021] [21:49:32] |[31;1mERROR[0m|: QuickApp timer <Timer:0004 fun:01724440 exp:21:49:32:492> for 'EvoHomeClient', deviceId:946, crashed - fibaroapiHC3.lua:704: attempt to index a nil value (upvalue 'i_options')

     

    Link to comment
    Share on other sites

  • Topic Author
  • 8 hours ago, petrkl12 said:

    @jgab

    I newest version I have this bug:

    [27.04.2021] [21:49:32] |[31;1mERROR[0m|: QuickApp timer <Timer:0004 fun:01724440 exp:21:49:32:492> for 'EvoHomeClient', deviceId:946, crashed - fibaroapiHC3.lua:704: attempt to index a nil value (upvalue 'i_options')

     

    Fixed v.304

    • Thanks 1
    Link to comment
    Share on other sites

    Works perfectly on v0.305 with all timeouts

    Thanks

    Link to comment
    Share on other sites

    @jgab

     

    I have this error message - I want to create child device directly in HC3 (btw. it was working a few version ago)

    [01.05.2021] [14:17:15] |[33mWARN [0m|: Please download assets to create device types
    [01.05.2021] [14:17:15] |[33mWARN [0m|: Unknown device type: com.fibaro.lightSensor

     

    my setup:

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 7 hours ago, petrkl12 said:

    @jgab

     

    I have this error message - I want to create child device directly in HC3 (btw. it was working a few version ago)

    [01.05.2021] [14:17:15] |[33mWARN [0m|: Please download assets to create device types
    [01.05.2021] [14:17:15] |[33mWARN [0m|: Unknown device type: com.fibaro.lightSensor

     

    my setup:

    Please login or register to see this code.

     

    It's warning that it doesn't know the template for that type. You get a default device structure for it.

    If you run

    hc3_emulator.downloadAssets() 

    in the emulator (do it once)

    it will download a file with all templates in ~/.zbstudio/hc3emu/... and use it

    Link to comment
    Share on other sites

    • 2 weeks later...

    @jgab

    I'm playing with the new Fibaro controller and in some point the system has been freeze (Z-wave stuck).

    By starting the emulator it looks like nothing happens for a long time and then an error appears

    [16.05.2021] [15:20:40] |ERROR|: Error connnecting to HC3: 'closed'

    Looks like the timeout is too long and may be it will be a good idea to add debug line like : Accessing HC at IP-address and/or to set a limit for timeout

    Another request could you change the name "HC3" to a global name or could be defined by user. Right now there are three types of controllers HC3, HC3Lite and the new one. (in my case I access HCL and HC2 also)

    Thanks

    Link to comment
    Share on other sites

    • 1 month later...

    Hello

    i am trying to test the sdk with the examples in the youtube video at the very first page.

    using the intrepreter Lua 5.2 in Zenobrane Studio

     

    Please login or register to see this code.

     

    i get the console output

     

    Please login or register to see this code.

    any ideas ?

     

    Link to comment
    Share on other sites

  • Topic Author
  • You need to set interpreter to Lua 5.3 (it is what QAs on the HC3 uses)

    Link to comment
    Share on other sites

    Using Lua53

    getting this new error

    Please login or register to see this code.

     

     

    UPS had a typo in the script, got it working.

    Edited by mike79
    Link to comment
    Share on other sites

  • Topic Author
  • 5 hours ago, mike79 said:

    Using Lua53

    getting this new error

    Please login or register to see this code.

     

     

    UPS had a typo in the script, got it working.

    Yes, its json, not jsonq…

    Link to comment
    Share on other sites

    Hello again

    i am trying to find out how http post get works in Lua and the Emulator

    it aint the same as python that i am use to.

     

    i have been playing around converting this python api for panasonic heat pumps 

    Please login or register to see this link.

    first thing i wanna is get an response that is not 403

     

    my script

    Please login or register to see this code.

    Does anyone have some nice examples using POST, GET, PUT.

     

    Edited by mike79
    Link to comment
    Share on other sites

  • Topic Author
  • 12 hours ago, mike79 said:

    Hello again

    i am trying to find out how http post get works in Lua and the Emulator

    it aint the same as python that i am use to.

     

    i have been playing around converting this python api for panasonic heat pumps 

    Please login or register to see this link.

    first thing i wanna is get an response that is not 403

     

    my script

    Please login or register to see this code.

    Does anyone have some nice examples using POST, GET, PUT.

     

    403 seems to be an issue with the authentication. 

    You could  try to

     

    Add the extraheaders

    ["X-APP-TYPE"] = "1"

    ["X-APP-VERSION"] = "1.10.0"

    just in case the receiver is picky.

     

    Then remove the "HTTP/1.1" at the end of the url - as it's probably part of the protocol and not the url

    i.e. just "https://accsmart.panasonic.com/auth/login"

     

    Just to be sure, you get the same error on the HC3?

    Link to comment
    Share on other sites

    Yes i get the same error on the hc3.

    Aslo with extra headers

    Also

    All the example i find for lua is using reguest, but reguest seem not to be working with hc3.

    I get a nil response.

     

    attempt to call a nil value (global 'require')

     

    is request not allowed with hc3?

     

    Edited by mike79
    Link to comment
    Share on other sites

  • Topic Author
  • Looking at the GitHub they are sending just the params and not the action=create that you have done. 

    Try

    Please login or register to see this code.

    Edited by jgab
    Link to comment
    Share on other sites

    This is very wierd.

    after some hours i did a minimalistic python script to see if that works.

    after a few bumbs the python version  works. 

    Please login or register to see this link.

     

    i then converted to Lua after best off my knowleadge , but the lua version does not work.

     

    python version.

    Please login or register to see this code.

    output

    Please login or register to see this code.

     

    Lua Version

    Please login or register to see this code.

    output

    Please login or register to see this code.

    as you see  i get a 403 forbidden in lua version.

    Also wierd is when printing Params and headers it shows as table in Lua output.

    Edited by mike79
    Link to comment
    Share on other sites

  • Topic Author
  • Lua prints out tables that way per default. You need your own custom print to print keys and values.

    Still some strange things - you assigns params to a 'json' key? It should be 'data' and encoded as json

    Try this

    Please login or register to see this code.

    I'm a bit unsure if the Lua version will comply with the ['SERVER_PROTOCOL'] = 'HTTP/1.1' header. It's a risk that it will be a HTTP/1.2 request anyway.

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

    thx ?

    reponse

     

    Please login or register to see this code.

    next thing is to use token and change settings.

    • Like 1
    Link to comment
    Share on other sites

    not sure but when i setVaribles in function onInit()

    all other functions are not reponsive.

    Dont we set Varibles on onInit() ?

     

    Also i get from console

    04.07.2021] [15:02:04] [WARNING] [QUICKAPP64]: Variable PROXYIP not found

     

    Code

    Please login or register to see this code.

     

     

     

     

    Edited by mike79
    typo
    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
    Reply to this topic...

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