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

Did you get the mqtt library installed OK ?

Or you mean you are using IF's to not execute any mqtt statements offline ?

 

Our posts overlapped sorry - what OS are you running ZeroBrane on ?

Edited by xAPPO
Link to comment
Share on other sites

@jgab Jan 

another issue

 

Please login or register to see this image.

/monthly_2020_07/image.png.7cdf3af5b1153c02b1b80f996b0562a3.png" />

Link to comment
Share on other sites

17 minutes ago, xAPPO said:

Did you get the mqtt library installed OK ?

Or you mean you are using IF's to not execute any mqtt statements offline ?

 

Our posts overlapped sorry - what OS are you running ZeroBrane on ?

no. I am chuck norris

Link to comment
Share on other sites

  • Topic Author
  • 20 minutes ago, 10der said:

    @jgab Jan 

    another issue

     

    Please login or register to see this link.

     

    I can't see any ":" in the code - this piece of code has compiled for months - must be some evil char that have sneaked into your source.

    Link to comment
    Share on other sites

  • Topic Author
  • 42 minutes ago, 10der said:

    Please login or register to see this attachment.

     

    You need to change the way you include the emulator

    Please login or register to see this code.

    ...otherwise you get an infinite loop.

     

    Link to comment
    Share on other sites

    Jan. thank you.

    fixed.

     

    so. luamqtt doesn't work in VSCode.

    attached lib works. but I re-wrote (cuz uncompatibile) your code :(

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

  • Topic Author
  • 12 minutes ago, 10der said:

    Jan. thank you.

    fixed.

     

    so. luamqtt doesn't work in VSCode.

    attached lib works. but I re-wrote (cuz uncompatibile) your code :(

     

    Please login or register to see this attachment.

    Why doesn't it work? Is it some lib? like luasocket?

    Link to comment
    Share on other sites

    ok. trying to debug.

    btw: simple lib what i attached worls like a charm

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

  • Topic Author
  • 18 minutes ago, 10der said:

    ok. trying to debug.

    btw: simple lib what i attached worls like a charm

     

    Please login or register to see this attachment.

    Ok, I will have look at the library and see if I can use it instead.

    Link to comment
    Share on other sites

    and btw #2 :) 

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    @jgab fixed luamqtt installation fro VSCode

     

    now i have this blad.

    [19.07.2020] [23:13:14] |ERROR|: MQTT error:failed to open network connection: socket.connect failed: host or service not provided, or not known

    Link to comment
    Share on other sites

    UPD
     

    mqtt://192.168.1.10:1883

     

    self.client = mqtt.Client.connect("192.168.1.10", {clientId = "HC3"})

     

     

    [19.07.2020] [23:20:07] |[34;1mSDBG |: MQTT connect:{"rc":0,"type":2,"sp":false}
    [19.07.2020] [23:20:12] [DEBUG]: connected: {"returnCode":0,"sessionPresent":false}

     

    [19.07.2020] [23:20:17] |[34;1mSDBG |: MQTT close:{"close_reason":"connection closed by broker","connack":{"type":2,"rc":0,"sp":false},"coro":thread: 

     

    Edited by 10der
    Link to comment
    Share on other sites

    UPD2: all OK!

    just clientID already was busy by own app. 

     

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    so, RTFM for windows VSCode users

     

    1) download luamqtt-master.zip 

    2) unpack to mqtt folder from zip mqtt folder (sorry for tautology)

    3) create mqtt.lua file

    Please login or register to see this image.

    /monthly_2020_07/image.png.a7f6477629f5e625f00971cdb156b34b.png" />

    with context

    Please login or register to see this code.

    happy debugging!

     

    Link to comment
    Share on other sites

    After F/W upgrade to 5.040.37..

    mainFunction  now invisible.

    Yes. Can't edit via api.post()

    Link to comment
    Share on other sites

    click in the main file left .. this version supports multifile QAs. Once clicked you should see content and be able to save, so the selection stays in saved QA.

    • Like 1
    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, rangee said:

    After F/W upgrade to 5.040.37..

    mainFunction  now invisible.

    Yes. Can't edit via api.post()

    Yes, the quickApp's code management have become more sophisticated. I need to update the way I deal with it in the emulator. The good news is that I believe what we got is much better....

    Edited by jgab
    Link to comment
    Share on other sites

    2 minutes ago, jgab said:

    Yes, the quickApp's code management have become more sophisticated. I need to update the way I deal with it in the emulator. The good news is that I believe what we got is much better....

    I think this is preparation of QA encryption.

    To encrypt the code, it need to be invisible via any way.

     

    QA editor  consists of main file and additional files(eg. test1)

     

    QA loads   test1, test2 and finally  main file.

    main file loaded at last.

    test1, test2, main   these 3 files are cooperative but works independently.

    I mean...

    test1's local var, fun   cannot call at  test2, main.

     

    test1's   function Quickapp:method is callable at main.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, rangee said:

    QA editor  consists of main file and additional files(eg. test1)

    QA loads   test1, test2 and finally  main file.

    main file loaded at last.

    test1, test2, main   these 3 files are cooperative but works independently.

    I mean...

    test1's local var, fun   cannot call at  test2, main.

    test1's   function Quickapp:method is callable at main.

     

    So they share the global environment and not locals, and that is expected.

    Yes it seems like 'main' (that can't be removed) is run last. The rest of the files seems to be loaded in order, top to bottom.

    If I have 3 files:

    File 'main':  print("A1") function QuickApp:onInit() self:debug("A1") end

    File 'test1': print("B1")

    File 'test2': print("C1")

     

    I get the log:

    [23.07.2020] [22:23:32] [DEBUG] [QUICKAPP1333]: B1

    [23.07.2020] [22:23:32] [DEBUG] [QUICKAPP1333]: C1

    [23.07.2020] [22:23:32] [DEBUG] [QUICKAPP1333]: A1

    [23.07.2020] [22:23:32] [DEBUG] [QUICKAPP1333]: B1

    [23.07.2020] [22:23:32] [DEBUG] [QUICKAPP1333]: C1

    [23.07.2020] [22:23:32] [DEBUG] [QUICKAPP1333]: A1

     

    Which looks like they load all the files twice(!) - be aware to not have commands that execute directly in your files - like the prints in my example... 

    However, it's only when we save the QA - if it restarts due to a crash it only loads the files once.

    Edited by jgab
    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...