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


Recommended Posts

Posted
12 minutes ago, ChristianSogaard said:

Thank you Jan. You cant repeat my problem because you didnt do the same stupid error as I did. ???

Toolbox is downloaded.

 

Need to look into this

Please login or register to see this code.

 

 

[30.01.2021] [13:58:02] |[35mSYS  [0m|: HC3 SDK v0.158
[30.01.2021] [13:58:02] |[35mSYS  [0m|: Created Event server at 192.168.201.236:6872
[30.01.2021] [13:58:02] |[31;1mERROR[0m|: Code crashed: cannot open Toolbox/Toolbox_basic.lua: No such file or directory
cannot open Toolbox/Toolbox_basic.lua: No such file or directory

 

So I downloaded the MQTT, at I see it in the library. I guess the definition is missing in the hc3_emulator.FILE ?

 

Please login or register to see this attachment.

  • Topic Author
  • Posted (edited)
    22 minutes ago, ChristianSogaard said:

    Thank you Jan. You cant repeat my problem because you didnt do the same stupid error as I did. ???

    Toolbox is downloaded.

     

    Need to look into this

    Please login or register to see this code.

     

     

    [30.01.2021] [13:58:02] |[35mSYS  [0m|: HC3 SDK v0.158
    [30.01.2021] [13:58:02] |[35mSYS  [0m|: Created Event server at 192.168.201.236:6872
    [30.01.2021] [13:58:02] |[31;1mERROR[0m|: Code crashed: cannot open Toolbox/Toolbox_basic.lua: No such file or directory
    cannot open Toolbox/Toolbox_basic.lua: No such file or directory

     

    If you have the latest plugin there is a menu option to download toolbox, MQTT etc.

    8 minutes ago, ChristianSogaard said:

    So I downloaded the MQTT, at I see it in the library. I guess the definition is missing in the hc3_emulator.FILE ?

     

    Please login or register to see this attachment.

    You need to stand in the directory where you have the fibaroapiHC3.lua file when you download the other files.

    ...and the QA file you work on needs to be in the same directory

     

    ../MyQA.lua

    ../fibaroapiHC3.lua

    ../Toolbox/...

    ../mqtt/...

     

    Edited by jgab
    Posted
    22 minutes ago, jgab said:

    If you have the latest plugin there is a menu option to download toolbox, MQTT etc.

    You need to stand in the directory where you have the fibaroapiHC3.lua file when you download the other files.

    ...and the QA file you work on needs to be in the same directory

    IU 

    ../MyQA.lua

    ../fibaroapiHC3.lua

    ../Toolbox/...

    ../mqtt/...

     

    I'm pretty sure, i have that right 

    Please login or register to see this image.

    /monthly_2021_01/image.png.3d09bd187f9e094a93052993a8e91231.png" />

     

    Posted
    1 hour ago, ChristianSogaard said:

    I'm pretty sure, i have that right 

    Please login or register to see this link.

     

    Do i need something like this in the include /modules?

    hc3_emulator.FILE("MQTT/somethingmqtt.lua","Toolbox")

  • Topic Author
  • Posted (edited)
    8 minutes ago, ChristianSogaard said:

    Do i need something like this in the include /modules?

    hc3_emulator.FILE("MQTT/somethingmqtt.lua","Toolbox")

    No, mqtt is loaded differently. I check if the 'mqtt' subdirectory exists and load it at startup.

    (Same for the websocket support)

    Edited by jgab
    Posted
    6 minutes ago, jgab said:

    No, mqtt is loaded differently. I check if the 'mqtt' subdirectory exists and load it at startup.

    (Same for the websocket support)

    Downloading latest MQTT/*
    Program starting as '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/bin/lua.app/Contents/MacOS/lua53 /Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/myprograms/fibaroapiHC3.lua -downloadfile MQTT/*'.
    Program 'lua53' started in '/Applications/ZeroBraneStudio.app/Contents/ZeroBraneStudio/myprograms' (pid: 66166).
    [30.01.2021] [16:30:01] |[34mLOG  [0m|: Writing file mqtt/bit53.lua
    [30.01.2021] [16:30:01] |[34mLOG  [0m|: Writing file mqtt/bitwrap.lua
    [30.01.2021] [16:30:01] |[34mLOG  [0m|: Writing file mqtt/client.lua
    [30.01.2021] [16:30:01] |[34mLOG  [0m|: Writing file mqtt/init.lua
    [30.01.2021] [16:30:01] |[34mLOG  [0m|: Writing file mqtt/ioloop.lua
    [30.01.2021] [16:30:01] |[34mLOG  [0m|: Writing file mqtt/luasocket_ssl.lua
    [30.01.2021] [16:30:01] |[34mLOG  [0m|: Writing file mqtt/luasocket.lua
    [30.01.2021] [16:30:02] |[34mLOG  [0m|: Writing file mqtt/ngxsocket.lua
    [30.01.2021] [16:30:02] |[34mLOG  [0m|: Writing file mqtt/protocol.lua
    [30.01.2021] [16:30:02] |[34mLOG  [0m|: Writing file mqtt/protocol4.lua
    [30.01.2021] [16:30:02] |[34mLOG  [0m|: Writing file mqtt/protocol5.lua
    [30.01.2021] [16:30:02] |[34mLOG  [0m|: Writing file mqtt/tools.lua
    Download done! - MQTT/*
    Program completed in 1.67 seconds (pid: 66166).
     

    Please login or register to see this code.

     

     

    and the run

     

    Please login or register to see this code.

     

  • Topic Author
  • Posted

    Do a new lua files in the same directory with a single line

    require("mqtt")

    and test it. It should work...

    Posted
    9 minutes ago, jgab said:

    Do a new lua files in the same directory with a single line

    require("mqtt")

    and test it. It should work...

     

     

    Please login or register to see this attachment.

  • Topic Author
  • Posted
    2 minutes ago, ChristianSogaard said:

     

     

    Please login or register to see this attachment.

    You are not running a_test.lua, you are running something else (like your Nilan QA). In the console you see how it runs fibaroapiHC3.lua and loads ex. event manager.

    Have you set it as start file?

    Posted (edited)
    10 minutes ago, jgab said:

    You are not running a_test.lua, you are running something else (like your Nilan QA). In the console you see how it runs fibaroapiHC3.lua and loads ex. event manager.

    Have you set it as start file?

    I see what you mean. I got it working now . Thank you again ??? 

    Edited by ChristianSogaard
    P
    Posted (edited)
    1 hour ago, ChristianSogaard said:

    I see what you mean. I got it working now . Thank you again ??? 

     

    I properly need to look into to do the MQTT in EV4 if that is possible. Because this is flotting my logs ;-)

    Please login or register to see this attachment.

    Edited by ChristianSogaard
    P
  • Topic Author
  • Posted (edited)
    13 hours ago, ChristianSogaard said:

     

    I properly need to look into to do the MQTT in EV4 if that is possible. Because this is flotting my logs ;-)

    Please login or register to see this attachment.

     

    I'm a advocate for "source filtering". I think you should put in some filter on the events from MQTT. I can't imagine all the events being different, or different enough, to need to be posted to the ER QA.

    Please login or register to see this code.

    this filter just checks that the events are different. If they have numeric values that differs just a little the filter can take that into consideration too... but that's a later exercise.

     

    and then in your MQTT handler

    Please login or register to see this code.

     

    Edited by jgab
    Posted
    1 hour ago, jgab said:

     

    I'm a advocate for "source filtering". I think you should put in some filter on the events from MQTT. I can't imagine all the events being different, or different enough, to need to be posted to the ER QA.

    Please login or register to see this code.

    this filter just checks that the events are different. If they have numeric values that differs just a little the filter can take that into consideration too... but that's a later exercise.

     

    and then in your MQTT handler

    Please login or register to see this code.

     

    great idea Jan ? - i didnt see that myself. ?

    I have two errors in ZBS

    The first is

    [31.01.2021] [09:13:35] |[31;1mERROR[0m|: MQTT error:CONNECT failed with CONNACK [rc=5]: Connection Refused, not authorized

    but if i Deploy the QA - authentication works - and i dont see any error.

    Second is 

    [31.01.2021] [09:20:03] |[31;1mERROR[0m|: QuickApp crashed: Toolbox/Toolbox_events.lua:77: Bad argument to postRemote

     

    the line --self:postRemote(1103,.... works fine when "--" is removed.

     

    Please login or register to see this code.

     

  • Topic Author
  • Posted
    15 minutes ago, ChristianSogaard said:

    great idea Jan ? - i didnt see that myself. ?

    I have two errors in ZBS

    The first is

    [31.01.2021] [09:13:35] |[31;1mERROR[0m|: MQTT error:CONNECT failed with CONNACK [rc=5]: Connection Refused, not authorized

    but if i Deploy the QA - authentication works - and i dont see any error.

    Second is 

    [31.01.2021] [09:20:03] |[31;1mERROR[0m|: QuickApp crashed: Toolbox/Toolbox_events.lua:77: Bad argument to postRemote

     

    the line --self:postRemote(1103,.... works fine when "--" is removed.

     

    Please login or register to see this code.

     

    Sorry, filter was wrong

    Please login or register to see this code.

     

    16 minutes ago, ChristianSogaard said:

    great idea Jan ? - i didnt see that myself. ?

    I have two errors in ZBS

    The first is

    [31.01.2021] [09:13:35] |[31;1mERROR[0m|: MQTT error:CONNECT failed with CONNACK [rc=5]: Connection Refused, not authorized

    but if i Deploy the QA - authentication works - and i dont see any error.

     

     

    How does your MQTT URL look like and how do you open the connection?

    Posted
    3 minutes ago, jgab said:

    Sorry, filter was wrong

    Please login or register to see this code.

     

     

    How does your MQTT URL look like and how do you open the connection?

    Please login or register to see this attachment.

  • Topic Author
  • Posted (edited)
    15 minutes ago, ChristianSogaard said:

    Please login or register to see this attachment.

    Can you in the header set

     

    if dofile and not hc3_emulator then
      hc3_emulator = {

          debug = { mqtt = true},

          :

     

    and see if you get any more debug logs?

    Edited by jgab
    • Like 1
    Posted
    3 minutes ago, jgab said:

    Can you in the header set

     

    if dofile and not hc3_emulator then
      hc3_emulator = {

          debug = { mqtt = true},

          :

     

    and see if you get any more debug logs?

    Please login or register to see this spoiler.

     

  • Topic Author
  • Posted
    5 minutes ago, ChristianSogaard said:

    Please login or register to see this spoiler.

    So, I have very limited experience of MQTT. It looks like the authorisation fails (username password?) and then it retries and it succeeds? You get a message at the end?

     

    Are you sure you need to add username/password to the options when you connect? I add it to the MQTT connect and it may be the wrong username/password and you get the fail - On HC3 they may ignore it...?

    Posted
    2 minutes ago, jgab said:

    So, I have very limited experience of MQTT. It looks like the authorisation fails (username password?) and then it retries and it succeeds? You get a message at the end?

     

    Are you sure you need to add username/password to the options when you connect? I add it to the MQTT connect and it may be the wrong username/password and you get the fail - On HC3 they may ignore it...?

     

    I deleted the proxy QA and run the code again, and now it dont show anymore.

    Filter is working SuperB ?

     

     

     

     

     

    Please login or register to see this attachment.

    Posted

    Slave rule in EV4

     

    Hi Jan

    I would like to configure a slave rule - a rule that is triggered when another rule trigger, but does something else - so i tried these two rules

    the rule @{catch,00:01 never triggers, could i do something else than the catch ?

     

     

    Please login or register to see this code.

     

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