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

  • Topic Author
  • Posted
    6 hours ago, gurpal2000 said:

    Related to an old post of mine

    Please login or register to see this link.

    , what would be the "ER5" or "best" way of doing:

     

    Can rule() detect hits to API end points (or functions defined inside the ER5 QA) ?

     

    rule(self:camera1_triggered => ... )

     

    It's almost like I need to define a virtual device and then reference that in my ER rules?

    Or just define a standard QA that responds to the camera breach/safe and then forward those on to an ER5 function?

    Use TriggerQA somehow?

     

    thx

    I assume it's the external IP camera we are talking about?

    Could you post to the HC3 endpoint "/devices/<id>/action/<name>"  ?

    If you can POST something like 

    {"type":"_","ev":{"type":"test","val":42}}

    to 

    http://HC3IP/devices/<ER5 ID>/RECIEVE_EVENT

    you can trigger

    Please login or register to see this code.

     

    Please login or register to see this attachment.

    • Like 1
    Posted
    5 hours ago, jgab said:

    I assume it's the external IP camera we are talking about?

    Could you post to the HC3 endpoint "/devices/<id>/action/<name>"  ?

    If you can POST something like 

    {"type":"_","ev":{"type":"test","val":42}}

    to 

    http://HC3IP/devices/<ER5 ID>/RECIEVE_EVENT

    you can trigger

    Please login or register to see this code.

     

    Please login or register to see this attachment.

     

    That's it! This means that I wouldn't need to write anything else outside of the ER5 QA. Will give this a go soon. thank you

    Posted
    3 hours ago, gurpal2000 said:

     

    That's it! This means that I wouldn't need to write anything else outside of the ER5 QA. Will give this a go soon. thank you

     

    OK some question:

    1. (a) is the payload fixed specifically as you have shown? ie. the schema only works for ER5 QA.

    (b) what is "_", "ev" and "val" ? ev -> event? val -> function argument - can this be a slightly more complex object

    2. not so a big problem, but is there an alias RECEIVE for RECIEVE (is there is a typo hardcoded in)

     

    thx

  • Topic Author
  • Posted

    2, Sorry, it should be RECIEVE_EVENT

     

    1. It's an event wrapped in an event

    {"type":"_","ev":<event>}

    The "_" type could be anything.

    <event> is an event with (any) type key

    Ex. {"type":"test","myValue":"Godmorning","day":"Saturday"}

    The <event> then can be matched in a rule like

    rule("#test => log('Test event, value:%s, day:%s',env.event.myValue,env.event.day)")

     

    • Like 1
    Posted

    @jgab If I go to Updater and push refresh I don't get ER5 v1.05 it stops at v1.04

  • Topic Author
  • Posted
    26 minutes ago, Sjakie said:

    @jgab If I go to Updater and push refresh I don't get ER5 v1.05 it stops at v1.04

    Sorry, miss. Now it's there.

    Posted (edited)

    @jgab Jan, does any inbuilt ER5 function return a device's roomename? like 1845:roomName?

    Ahh okay, i have found, it is actually there,,,thanks

    Edited by Neo Andersson
    Posted (edited)

    @jgab Jan, QA updater in cusmter's house is throwing erros, it was working, and i naver touched it

     

    Please login or register to see this image.

    /monthly_2024_03/image.png.e2c66d9a5e4ca64843a93b9f15b6a06c.png" />

     

    image.png.1fd3912a67a2cbbfebb7fde696711780.png

    image.png.05d83553150d89078b269301f3e76270.png

     

    image.png.6e3d7791bb23dfbf75d46b1fb5e7704d.png

    image.png.4b9f93069bcb32707330e743542b727d.png

    Okay, after refresh, it seems to work..There was a system restart, and after that QA updater threw those errors

    Edited by Neo Andersson
    Posted

    @jgab You helped my very good with:

    Please login or register to see this code.

    How to accomplish with  a Global Variable?

    I want to log the value off $OWM_Temp

    Thanks!

  • Topic Author
  • Posted
    12 hours ago, Neo Andersson said:

    @jgab Jan, QA updater in cusmter's house is throwing erros, it was working, and i naver touched it

     

    Please login or register to see this link.

     

    Please login or register to see this link.

    Please login or register to see this link.

     

    Please login or register to see this link.

    Please login or register to see this link.

    Okay, after refresh, it seems to work..There was a system restart, and after that QA updater threw those errors

    Seems like your box didn't temporarily) have internet/dns connection to connect to github where the QAUpdater manifest is stored (info about QA versions and updates)

    8 minutes ago, Sjakie said:

    @jgab You helped my very good with:

    Please login or register to see this code.

    How to accomplish with  a Global Variable?

    I want to log the value off $OWM_Temp

    Thanks!

    You want to store all logs in a global variable?

    You should have a max limit - not very efficient to continuously read/write a large global variable.

    Posted

    Ok did not thought about that.

    Every day 00:00; 07:00; 12:00; 18:00

    same range as for temps:

    Please login or register to see this code.

    Can this be done or is that also too much?

    Posted

    @jgab Hello Jan, i want to get the roomID of a device, so I created a custom getproperty for it

     

    Please login or register to see this code.

    as i dont need it as trigger neither want to set it, i think the definition above should be enough, but it returns nil..

     

    Please login or register to see this code.

    What is wrong with it?

  • Topic Author
  • Posted
    5 hours ago, Neo Andersson said:

    @jgab Hello Jan, i want to get the roomID of a device, so I created a custom getproperty for it

     

    Please login or register to see this code.

    as i dont need it as trigger neither want to set it, i think the definition above should be enough, but it returns nil..

     

    Please login or register to see this code.

    What is wrong with it?

    roomID is not a property (properties.*) but a key on the top-level of the device structure

    Use

    Please login or register to see this code.

     

     

    Posted (edited)

    @jgab Jan i am storing table data in a global variable HOUSECHECKDATA like this {housechecktime = '06:15', housecheckmode = enabled}

     

    however when i want to use that table data in a rule

     

    Please login or register to see this code.

     

     

    HOUSECHECKTIME is a regular string value, what am i missing?

    Edited by Neo Andersson
  • Topic Author
  • Posted
    1 hour ago, Neo Andersson said:

    @jgab Jan i am storing table data in a global variable HOUSECHECKDATA like this {housechecktime = '06:15', housecheckmode = enabled}

     

    however when i want to use that table data in a rule

     

    Please login or register to see this code.

     

     

    HOUSECHECKTIME is a regular string value, what am i missing?

    Yes, because it's a string "06:15", you need to convert it to the number of seconds.

    The constant 06:15 in the rule

    rule("@06:15 => ...")

    is just a short for the number of seconds (6*3600+60*15)

    In ER4 there used to be a function time(str) that converted a time string to number of seconds but it seems to have  gone missing when I converted it to ER5.

    You can define it with

    Please login or register to see this code.

    and then do

    Please login or register to see this code.

     

    Alternatively you convert it to seconds when you define it in Lua

    Please login or register to see this code.

     

     

    Posted
    48 minutes ago, jgab said:

    Yes, because it's a string "06:15", you need to convert it to the number of seconds.

    The constant 06:15 in the rule

    rule("@06:15 => ...")

    is just a short for the number of seconds (6*3600+60*15)

    In ER4 there used to be a function time(str) that converted a time string to number of seconds but it seems to have  gone missing when I converted it to ER5.

    You can define it with

    Please login or register to see this code.

    and then do

    Please login or register to see this code.

     

    Alternatively you convert it to seconds when you define it in Lua

    Please login or register to see this code.

     

     

    Ahh okay, so ER5 probably has some inbuilt mechanism to convert simple LUA global variables, if they have time format. Thats why it works when using simple global variable without having us to convert it before using..thanks

  • Topic Author
  • Posted
    58 minutes ago, Neo Andersson said:

    Ahh okay, so ER5 probably has some inbuilt mechanism to convert simple LUA global variables, if they have time format. Thats why it works when using simple global variable without having us to convert it before using..thanks

    Yes, it would be too inefficient to traverse any nested json structure looking for time values…

    • Like 1
    Posted (edited)

    @jgab Jan,

     

    Two questions

     

    Question 1. having a condition in a rule 00:00..00:00 will return all the day true right? If no, how to set a time range in a rule that covers the entire day?

     

    Question 2.

    If my timerange is coming from a function, it does not have effect

    Please login or register to see this code.

     

    Probably the same problem like in the other post...need to use fibaro.toTime right?

     

    I have tried like this too

     

    Please login or register to see this code.

     

    Edited by Neo Andersson
  • Topic Author
  • Posted
    12 hours ago, Neo Andersson said:

    @jgab Jan,

     

    Two questions

     

    Question 1. having a condition in a rule 00:00..00:00 will return all the day true right? If no, how to set a time range in a rule that covers the entire day?

     

    00:00..23:59:59

     

    12 hours ago, Neo Andersson said:

     

    Question 2.

    If my timerange is coming from a function, it does not have effect

    Please login or register to see this code.

     

    Probably the same problem like in the other post...need to use fibaro.toTime right?

     

    I have tried like this too

     

    Please login or register to see this code.

     

    There is an function return fibaro.utils.between(a,b) that returns true if time is between a and b

    Please login or register to see this code.

    If it's just that the interval comes from strings you can do

    Please login or register to see this code.

     

    • Thanks 1
    Posted

    Hi Jan, 

     

    I wanna create a rule that automatically sets devices(Lights) that are turned on between 07-09 to 99% what would be the simplest way to make this rule.

    I made this rule for example, but problem is it cant be dimmed as it automatically turns back to 99% is there a way to limit it to just do this rule once per day for example?

    rule("tv_rum_spottar:isOn & 10:00..11:00 => tv_rum_spottar:value=99"

     

    On another note, im also a bit confused on how to add a variabel/profile to this rule, i have made a profile called festivities and if that profile is activate i dont want the rules below to run.

    rule("@19:30 => kok_bankbelysning_ovre:dim = {03:30, 'down', 100, 'linear', 10, kok_bankbelysning_ovre:value}")
    rule("@19:30 => entre_spotlights:dim = {03:30, 'down', 100, 'linear', 10, entre_spotlights:value}")
    rule("@19:30 => passage_spottar:dim = {03:30, 'down', 100, 'linear', 10, passage_spottar:value}")
    rule("@19:30 => passage_spotlights:dim = {03:30, 'down', 100, 'linear', 10, passage_spotlights:value}")
    rule("@19:30 => trappa_trappbelysning:dim = {03:30, 'down', 100, 'linear', 10, trappa_trappbelysning:value}")
     
    All help is appreciated :-D

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