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

9 minutes ago, jgab said:

Almost.

If you only have one bridge you can leave out the 'hue:' prefix. The default prefix is "Hue:", capital "H". The prefix is to distinguish different Hue bridges. You set _HueHubs to
{{name='Hue',user=_HueUserName,ip=_HueIP}}, and you can have many bridges with different names.

 

If it is only one id to monitor you can skip the table

Please login or register to see this code.

The first argument to define ( "huevrum" ) is the name of the device in the Hue system.

In my HUE bridge the device i want to monitor is named LampaTV and located in room called Vardagsrum, so how should it be then?

Hue.monitor does not read the values from my HomeTable scene? And id(number) should be different than defined  n  HomeTable?

 

Link to comment
Share on other sites

  • Topic Author
  • A heads up.

    I have been busy working on a "Scene simulator" lately. 

    It's a general emulator to run most types of HC2 scenes. However, my main reason for this is to change the EventRunner framework to run on the simulator.

    There are many benefits this will bring:

     

    -We can load and run multiple ER scenes that send events to each other. (I have already been able to find a bug in the publish/subscribe mechanism and pushed a new version of the old EventRunner.lua to GitHub :-) )

    -Emulated scenes can send and receive events to scenes running on the HC2 and vice versa...

    -We can have some (fake) devices that are handled by the emulator and still interact will real devices on the HC2 (same with globals)

    -An ER scene running on the HC2 can be told to stop processing the events and instead forward them to its copy running in the emulator...

    -The ER scene becomes more clean as a lot of setup moved to the emulator.

    -I can dispose of EventRunnerDebug.lua that was turning into a monster...

    -json and FibaroSceneAPI.lua is included in the emulator and don't need to be downloaded separately...

    -Oh, and ER will be bumped to version 2.0 :-) 

     

    I'm still doing some tests but I have successfully run Supervisor, iosLocator, a light scene, and 2 publish/subscribe scenes in parallel - all pinging, subscribing, publishing at the same time.

    It's even possible to debug the publisher - consumer code that is the heart of the ER mechanism, set breakpoints and inspect variables, stepping etc.

    I have optimised the ER framework for the emulator so it doesn't do the millisecond polling. It can do it, the problem is if we run in _SPEEDTIME all the fans on my Macbook pro turns on max :-) Anyway, the performance is very good. The only thing that is not optimal is the socket server that receives incoming events from the HC2 (or node-red) as the current socket library requires polling the socket and  I don't want to drag in a dependency on another socket libraries (they tend to be OS native too)

     

    I will be back with a post on how to migrate... but it only effects the offline running of scenes. On the HC2 the framework behaves and looks the same...

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

  • Topic Author
  • 8 minutes ago, jompa68 said:

    In my HUE bridge the device i want to monitor is named LampaTV and located in room called Vardagsrum, so how should it be then?

    Hue.monitor does not read the values from my HomeTable scene? And id(number) should be different than defined  n  HomeTable?

     

    It doesn't matter in what "Hue" room it is. The name (LampaTV)  is unique (for the bridge)

    Please login or register to see this code.

    The Hue.define("LampaTV",nil,12004) looks up "LampaTV" in the bridge, and then creates a "fake" fibaro deviceID with 12004 that is "associated" with the Hue lamp "LampaTV".

    This means that we can do fibaro:call(12004,"turnOn") and other fibaro stuff, treating it as a dimmer switch...

    However, you need to assign the deviceID 12004 to something in your hometable, unless you want to use 12004 everywhere.

    The Hue.monitor, takes a deviceID and a time in milliseconds and starts a loop polling the state for the Hue device associated to the deviceID 12004 in this case.

     

    Link to comment
    Share on other sites

    still error when trying Hue.monitor lines

    Please login or register to see this image.

    /monthly_2019_03/image.png.1569a990bdba1e31745084b0b088bb77.png" />

     

    Please login or register to see this code.

    some of the hue lines from my HomeTable scene

    Please login or register to see this code.

    Cold this morning, -18 :blink:

    Edited by jompa68
    Link to comment
    Share on other sites

  • Topic Author
  • 1 hour ago, jompa68 said:

    still error when trying Hue.monitor lines

    Please login or register to see this link.

    Please login or register to see this code.

    some of the hue lines from my HomeTable scene

    Cold this morning, -18 :blink:

     

    Strange, below works for me. Is your _HueHubs correctly setup? What is the code around line 2137?

    Please login or register to see this code.

    Only -10 here :-)

     

    Edited by jgab
    Link to comment
    Share on other sites

    i have setup my HUE like this

    Please login or register to see this code.

    Function it stops on

    Please login or register to see this code.

     

    Edited by jompa68
    Link to comment
    Share on other sites

  • Topic Author
  • If you set _debugFlags.hue=true does the http request to the bridge look ok?

    you can post it if you change the hue username that is part of the url.

    Link to comment
    Share on other sites

  • Topic Author
  • When it reads the whole state in the beginning it’s empty. What does it log before it crash?

    Link to comment
    Share on other sites

    nothing special, scene just restarts.

    Please login or register to see this image.

    /monthly_2019_03/image.png.3d0ee63f3bd115a339f0518c97f64728.png" alt="image.png.3d0ee63f3bd115a339f0518c97f64728.png" />

    Link to comment
    Share on other sites

  • Topic Author
  • 15 minutes ago, jompa68 said:

    nothing special, scene just restarts.

    Please login or register to see this link.

    So between 08:38:42 and 08:38:55 you restart the scene, right?

    It's strange that we don't get any log message before the "Hue connection error:_"

    All hue http requests go through this

    Please login or register to see this code.

    ...and it should log the message before the crash...

    You are running monitor on some deviceID when it crashes?

    Link to comment
    Share on other sites

    3 minutes ago, jgab said:

    You are running monitor on some deviceID when it crashes?

    Yes i do. 

    Please login or register to see this code.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 16 minutes ago, jompa68 said:

    Yes i do. 

    Please login or register to see this code.

     

    There are 2 self.monitor in the Hue section. Can you swap the second to this one so we can know what url it is monitoring?

    Please login or register to see this code.

     

    Edited by jgab
    Link to comment
    Share on other sites

    hope i got it right

    Please login or register to see this image.

    /monthly_2019_03/image.png.4a92b357c05fe547dcd282d93a2f89f7.png" alt="image.png.4a92b357c05fe547dcd282d93a2f89f7.png" />

    Link to comment
    Share on other sites

  • Topic Author
  • 29 minutes ago, jompa68 said:

    hope i got it right

    Please login or register to see this link.

    Nja, I think you swapped the wrong one.

    It's the self.monitor that starts on line 1970 in the EventRunner.lua file on Githib.

    Link to comment
    Share on other sites

    Updated to latest ER.lua but still same error. 

    Please login or register to see this image.

    /monthly_2019_03/image.png.ec2075b402a5eb956311082397ba3d22.png" alt="image.png.ec2075b402a5eb956311082397ba3d22.png" />

    Link to comment
    Share on other sites

  • Topic Author
  • and you remembered to set _debugFlags.hue and apply the patch to self.monitor on line 1970? Because I don't see any log output.

    Link to comment
    Share on other sites

  • Topic Author
  • Can you run it in ZBS? Same error?

    If you can, break-point at line 1784 at entry of self.request and see what url you have?

    Next step, can you make minimal version of the scene with only the Hue rule that crashes and send it to me and I can see if I can simulate it?

     

    Edited by jgab
    Link to comment
    Share on other sites

    Must test that tonight. Working from other city today...
    No big deal with this, i can live without my new rule. Will convert to HC2 emu soon as possible.

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