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


Question

Posted

Hi all,

 

I use LuaEdit to compose my Lua code before I copy it into e.g. a scene.

It would be nice to debug the code in LuaEdit before dumping it in the HC2, but,

if I hit the debug button in LuaEdit I get an error message at the first line where "fibaro" appears. Makes sense because "fibaro" is nowhere declared in LUA.

is there a way to circumvent this issue?

Please login or register to see this image.

/monthly_2017_03/2017-03-08_12-19-50.jpg.0537beb6c91858588af347fdf89eec5a.jpg" alt="2017-03-08_12-19-50.jpg.0537beb6c91858588af347fdf89eec5a.jpg" />

6 answers to this question

Recommended Posts

  • 0
Posted

if one was to mock up all the fibaro table with dummy returns...

  • 0
Posted

Possible (partial) solution here:

 

 

  • 0
Posted
2 hours ago, robmac said:

if one was to mock up all the fibaro table with dummy returns...

 

Sorry, if forgot to credit/answer you in the previous post. Yes, writing your own "fibaro simulator" is a possibility. Just declaring them empty wont get you very far. Probably your code will get stuck at this:

 

Please login or register to see this code.

I have it (partly) running for my HC and for debugging. It's nowhere near a complete solution and I'm not sharing it, because it is constantly in flux... Think about it: how are you going to simulate device state, events, http access, Sonos TTS...

 

I'm talking about offline debugging now, not "online", like the solution I linked in the previous post.

 

So here's your first "emulator" to get past that very first check in your script:

Please login or register to see this code.

You'll probably want to manage other namespaces too, like

 

Please login or register to see this code.

Unless, of course, you are happy to adjust the script time & date tests to the current time of your PC.

Also, bear in mind that the PC clock will deviate from the HC2 clock.

 

I can go on for hours like this :-)

 

But I'm not going to! :-D

 

  • 0
Posted

No problem Peter. 

 

I used to do that with a table of scene ids and device ids and properties loaded from the api so that a lot of it pretended to work.

 

Maintaining it was all too much hassle. I therefore opted for a simpler alternative. 

 

Don't make mistakes in my code:-D

 

 

 

  • 0
Posted
3 minutes ago, robmac said:

No problem Peter. 

 

I used to do that with a table of scene ids and device ids and properties loaded from the api so that a lot of it pretended to work.

 

Maintaining it was all too much hassle. I therefore opted for a simpler alternative. 

 

Don't make mistakes in my code:-D

 

 

 

 

Exactly! Exactly! And no mistake, only "features"! ;-)

  • 0
  • Inquirer
  • Posted (edited)

    Ah,

    As I am no software hacker it takes some time to digest above info. :-)

    As I understand it now, LuaEdit, even with the library will not function all the way.

    ZeroBrane has as I understand it, a connection with the HC2 so one could debug code in ZeroBrane while using the HC2 as a remote debug machine.

    hhmmm very interesting but serious stuff.

    What I only wanted was something to check the syntax of my code so that at least that step was taken before dumping my code in the HC2 Lua editor.

    Please login or register to see this attachment.

    Thanx

     

    Edited by robd
    pic added

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