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
  • 1 hour ago, fastvd said:

    Hello. on the basis of this rule, how can we simply overload our same controller on which ER4 is hanging? how to describe a simple POST on reboot?

    something like this doesn't work)
    rule ("496:isOn => http.post(fmt('http://192.168.0.254/api/service/reboot'))")

    "overload"? you mean reboot?

    What specifically is not working?

    - the post reboot command?

    - or the 496:isOn ?

     

    Can you explain a bit more?

    Link to comment
    Share on other sites

    11 minutes ago, jgab said:

    "overload"? you mean reboot?

    What specifically is not working?

    - the post reboot command?

    - or the 496:isOn ?

     

    Can you explain a bit more?

    yes i mean reboot! the POST rule, which should start the reboot, does not work!

    Link to comment
    Share on other sites

  • Topic Author
  • You need to add the credentials to the HC3 at 192.168.0.254, like in the earlier example with slave devices...

    Link to comment
    Share on other sites

    @jgab

    Hello Jan, Can we call other quickapp's custom functions in a rule using " : " ? or should we use always the fibaro.call(myquickapp, "testfunction") pattern?

     

    Like:

    rule = ("button1:on => myquickapp:testfunction")

    Link to comment
    Share on other sites

  • Topic Author
  • Please login or register to see this code.

    You need to use fibaro.call(myquickapp, "testfunction")

     

    However, you could do

    Please login or register to see this code.

    which requires some pre-setup...

    • Like 1
    Link to comment
    Share on other sites

    3 hours ago, jgab said:

    You need to add the credentials to the HC3 at 192.168.0.254, like in the earlier example with slave devices...

    and I understand that you need to insert a login\password, but I don't know how... I just thought that when you run the ari command directly from the controller where you are, you don't need it, because you're actually already authorized...

    Link to comment
    Share on other sites

  • Topic Author
  • 15 minutes ago, fastvd said:

    and I understand that you need to insert a login\password, but I don't know how... I just thought that when you run the ari command directly from the controller where you are, you don't need it, because you're actually already authorized...

    Yes, if you do an api.post you don't need.

    http.post always requires credentials as it does an net.HTTPCall():request(...)

    Edited by jgab
    Link to comment
    Share on other sites

    10 minutes ago, jgab said:

    Yes, if you do an api.post you don't need.

    http.post always requires credentials as it does an net.HTTPCall():request(...)

    it's clear... thank you... now I'll try to understand how to run this api.post)))

    Link to comment
    Share on other sites

  • Topic Author
  • 16 minutes ago, fastvd said:

    it's clear... thank you... now I'll try to understand how to run this api.post)))

    api.post("/service/reboot") ?

    Link to comment
    Share on other sites

    3 minutes ago, jgab said:

    api.post("/service/reboot") ?

    well, this is the best thing I tried, but it doesn’t work like that (((there is more, you still need to indicate or turn on RECOVERY...
    I tried like this, but it still doesn't work (((

    rule ("496:isOn => api.post('/service/reboot',{recovery=false})")

    Link to comment
    Share on other sites

    @jgab Hello, Jan, what is the syntax in ER4 for geofence events? Like if for example admin entered Home geofence or left Geofence?

     

    PI :I will test ER5 asap. Not in production, just to help to find bugs.

     

    Link to comment
    Share on other sites

  • Topic Author
  • 2 hours ago, Neo Andersson said:

    @jgab Hello, Jan, what is the syntax in ER4 for geofence events? Like if for example admin entered Home geofence or left Geofence?

     

    PI :I will test ER5 asap. Not in production, just to help to find bugs.

     

     

    Link to comment
    Share on other sites

    13 hours ago, jgab said:

     

    Thanks Jan, but what is the ID of the location. You say in description that it can be found on location panel, but there is no ID for me. Or ID ==  name ?

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    17 minutes ago, Neo Andersson said:

    Thanks Jan, but what is the ID of the location. You say in description that it can be found on location panel, but there is no ID for me. Or ID ==  name ?

    Please login or register to see this attachment.

    UPDATE

    Okay, i have checked on two systems with api call, and it seems that HOME has always 219. Just info fot others who did no know this.

    Link to comment
    Share on other sites

  • Topic Author
  • 19 minutes ago, Neo Andersson said:

    Thanks Jan, but what is the ID of the location. You say in description that it can be found on location panel, but there is no ID for me. Or ID ==  name ?

    Please login or register to see this attachment.

    Yes, you need to add locations in the location panel.The ID of the locations are only visible in the swagger/rest API

    In ER there is a convenience function 'LOC' that returns the location rest structure for a location name

    rule("log('School location id is %s',LOC('School').id)")

     

     

    3 minutes ago, jgab said:

    Yes, you need to add locations in the location panel.The ID of the locations are only visible in the swagger/rest API

    In ER there is a convenience function 'LOC' that returns the location rest structure for a location name

    rule("log('School location id is %s',LOC('School').id)")

     

     

    ...and it's not called 'Home' but the name of the HC3 box. 

    I have defined 'Home' to be the same coordinate-

    Link to comment
    Share on other sites

    On 10/30/2023 at 4:30 PM, fastvd said:

    well, this is the best thing I tried, but it doesn’t work like that (((there is more, you still need to indicate or turn on RECOVERY...
    I tried like this, but it still doesn't work (((

    rule ("496:isOn => api.post('/service/reboot',{recovery=false})")

    any idea?)))

    Link to comment
    Share on other sites

  • Topic Author
  • 26 minutes ago, fastvd said:

    any idea?)))

     

    Try to make a api.post('/service/reboot',{recovery=false}) outside the rule somewhere in main() and see if it works.

    ER just translates it to a standard Lua api.post('/service/reboot',{recovery=false}) and calls it.

    Link to comment
    Share on other sites

    hi all.. just started trying to implement ER4 and it's fantastic!! I hate cluttering HC3 with too many scenes and this wonderful wonderful program is simplifying all the daily routine tasks so thank you so much @jgab!!

     

    I'm now trying to make my life a bit more complicated by using Profiles and Weather as conditions to my rules but not sure how to get it to work for example - 

     

    rule("@07:00 & profile('home') => heater:on") 

     

    I'm also trying to replace a scene where blinds are closed when the weather is Rain or Storm but not sure where to start.  i see this example in the code 

    rule("#weather{property='$prop', value='$val'} => log('%s = %s',prop,val)")

    but not sure how to use it.. any one can point me in the right direction? 

     

     

     

     

     

    Link to comment
    Share on other sites

    if you want I can send in pm something I use for curtains but I have used something similar also for blinds

     

    Link to comment
    Share on other sites

  • Topic Author
  • 49 minutes ago, Angelus said:

    hi all.. just started trying to implement ER4 and it's fantastic!! I hate cluttering HC3 with too many scenes and this wonderful wonderful program is simplifying all the daily routine tasks so thank you so much @jgab!!

     

    I'm now trying to make my life a bit more complicated by using Profiles and Weather as conditions to my rules but not sure how to get it to work for example - 

     

    rule("@07:00 & profile('home') => heater:on") 

     

    I'm also trying to replace a scene where blinds are closed when the weather is Rain or Storm but not sure where to start.  i see this example in the code 

    rule("#weather{property='$prop', value='$val'} => log('%s = %s',prop,val)")

    but not sure how to use it.. any one can point me in the right direction? 

    Well, profile as not very well managed in ER4.

    You need to get the id of the Home profile and then compare that id to the active profile's id. Like this

     

    Please login or register to see this code.

     

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