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
    3 minutes ago, Rover said:

    {0,"`BewegingHal`",{InitOnStartup=false,lineState={"{&ConstantHalLicht:value=0}"},state="value=true",

    Please login or register to see this link.

    again my bad....

    initOnStartup  (i not a capital letter)

    Posted

    It looks good now, no error e-mails and stable behavior. ?

     

    The Refresh button don't work. If I want to see the details I have to make a little change in the code (put a space character) and save the page, but after some looking time I have to make a code change again, annoying.

  • Topic Author
  • Posted
    12 minutes ago, Rover said:

    It looks good now, no error e-mails and stable behavior. ?

     

    The Refresh button don't work. If I want to see the details I have to make a little change in the code (put a space character) and save the page, but after some looking time I have to make a code change again, annoying.

    Are you sure ? It works fine for me. Sometimes it takes few presses...

    By the way what about HcWebEye? Is it refreshes when you press start?

    Posted
    3 minutes ago, cag014 said:

    Are you sure ? It works fine for me. Sometimes it takes few presses...

    By the way what about HcWebEye? Is it refreshes when you press start?

    No, even with 10 presses no refreshing.

    HcWebEye Start refreshes the web page, but no possibility to see the details.

  • Topic Author
  • Posted
    Just now, Rover said:

    No, even with 10 presses no refreshing.

    HcWebEye Start refreshes the web page, but no possibility to see the details.

    What do you mean by details? By pressing Start button on HcWebEye it should refresh the AOS.

    By the way same should be on AOS scene itself, try to press Start button (should do the refresh as well)

    Posted
    1 minute ago, cag014 said:

    What do you mean by details? By pressing Start button on HcWebEye it should refresh the AOS.

    By the way same should be on AOS scene itself, try to press Start button (should do the refresh as well)

    Details: by hovering you see the text: do manuals refresh for details. I want to see these details (the logical structure (very nice).

    Start button HcWebEye refreshes the page but do not deliver the details. Start button on AOS scene itself does nothing: delivers idea setting maximum number of active objects from 1 to 2: that helps!

     

    BTW: how to get fibaro:getModificationTime()?

  • Topic Author
  • Posted (edited)

    OK,

    Yes, recommended number of instances at least 3.

    To get modification time of any value just add Modified to the property name.  The returned value is in seconds after last modification and not timestamp like in fibaro:getModificationTime()

    for example

    @407>powerModified   or @407>valueModified ...

    or in conditions

    "{407:powerModified< 20}" or "{407:valueModified< 20}"

    For sensors you can use lastBreached as well

    @300>lastBreached

    or in conditions

    "{300:lastBreached< 20}"

    Edited by cag014
    Posted

    Hi @cag014

     

    How to json.encode {"0","Open","none","Voordeur Open"}?

  • Topic Author
  • Posted

    Didn't understand what exactly you mean?

    you cannot use json.encode() on non table arguments

    Posted
    1 minute ago, cag014 said:

    Didn't understand what exactly you mean?

    you cannot use json.encode() on non table arguments

    In order to send a push notification by Pushover, a json encoded string has to be put in a global variable, something like   

    trueAct={{"&pushoverBody","setGlobal","{"0","Open","none","Voordeur Open"}",""}}}},

    But in this way is does not work.

    How to encode a number of strings into one string?

  • Topic Author
  • Posted (edited)

    It's a little bit tricky, but looks like it works.

    Define at the beginning your table and then in jM{} line encoded.

    for example:

    k={tst="open",val=38}

    jM{

    {..........

    trueAct={{"&pushoverBody","setGlobal",json.encode(k),""}}}},

    Edited by cag014
  • Topic Author
  • Posted

    By the way if your table is dynamic (means you need to update values in the table according to the system) you can define your own keyword which will create the table.

     

    Posted
    1 hour ago, cag014 said:

    It's a little bit tricky, but looks like it works.

    Define at the beginning your table and then in jM{} line encoded.

    for example:

    k={tst="open",val=38}

    jM{

    {..........

    trueAct={{"&pushoverBody","setGlobal",json.encode(k),""}}}},

     

    No immediate success:

     requestBody={"0","Open","none","Voordeur Open"},
    }
    jM={
    --[[
    {'&priority=' 0 '&title=' Open '&sound=' none '&message=' Voordeur Open"}
    --]]
    {0, "$24clock",{state="value=0",timeSlot="17:30~",
        trueAct={{"&pushoverBody","setGlobal",json.encode(requestBody),""}}}},

    Please login or register to see this image.

    /monthly_2020_08/screenshot(6).png.a124c3ff1c40fbcc0bdba3cacf397e06.png" />

  • Topic Author
  • Posted

    1. Please remove the condition field. It shouldn't be empty

    {0, "$24clock",{state="value=0",timeSlot="17:30~",
        trueAct={{"&pushoverBody","setGlobal",json.encode(requestBody)}}}},

     

    2. Your requestBody table is null? The requestBody table definition should not be a part of jS2n or jM. Just stand alone table.

        I suggest define it at the begining


     

    Please login or register to see this code.

     

    Posted (edited)
    8 hours ago, cag014 said:

    By the way if your table is dynamic (means you need to update values in the table according to the system) you can define your own keyword which will create the table.

     

    At which position $userKeyWord=... has to be defined?

    Edited by Rover
  • Topic Author
  • Posted (edited)

    the user keyword table has two arrays.

    Please login or register to see this code.

    In first arrays you define the keyword name and in the second the function or value. The place of the keyword and function must be the same.

    for example to add requestBody it should be like that.
     

    Please login or register to see this code.

    Now you can use $requestBody keyword in jM{} lines.

    The above example works for a static values, meaning you can not change the arguments of requestBody{}.

    In order to do it dynamic you need to define function for the keyword.

    Example (setting requestBody{} first argument to power value of device 407)
     

    Please login or register to see this code.

    Please note: AOS formulas and calculations couldn't be supported inside function. You need to write the code.

    In example above you can use jN2s{} table for devices to avoid numeric IDs.
     

    Please login or register to see this code.

     

     

     

    Edited by cag014
    Posted

    {"`DimmerHal`","turnOff","3600"} works, but {"`DimmerHal`","turnOff","?60*60?"} does not. ???

     

    Is delay possible for {"&ConstantHalLicht","setGlobal","0"} ? Ik want to set the global on "0" after 3600 seconds (indication that period for constant light on is over). How to realize?

  • Topic Author
  • Posted (edited)

    Yes, it does support calculations, but somehow it isn't properly displayed in details. Bug... will fixed for next release.

    You can see "in buffer" line delayed commands, so your command will be seen with the correct delay. Just try it.

    regarding delays in commands where the third field is assigned for data add ~[delayTIme]~

    for example

    {"&ConstantHalLicht","setGlobal","~3600~0"}  no calculations supported yet... next release will.

    Edited by cag014
    Posted
    9 hours ago, cag014 said:

    In order to do it dynamic you need to define function for the keyword.

    Yes the generation of a push message (Pushover) is very dynamic, because for every use the message is different.

    I cannot comprehend how to express this in AOS.

    Let's show how this is done in HC2:

        local prio ="0"
        local ttl ="Open"
        local msg ="Voordeur open"
        local snd ="none"
        local requestBody ='&priority='..prio ..'&title='..ttl ..'&sound='..snd ..'&message='..msg
        fibaro:setGlobal("pushoverBody", requestBody)

    Then the Pushover scene triggered by the change on global "pushoverBody" arranges the payload sending to the Pushover service.

     

    So, how to define this in AOS in order to be able to send different Pushover notifications from every line in AOS?

     

  • Topic Author
  • Posted

    You mean on every line you need to send different data? I the data constant in every line?

    Tow options:

    1. To define requestBody for every line

    requestBody={

    {"0","Open","none","Voordeur Open"},

    {"0","Close","none","Voordeur Open"},

    {"1","Close","none","Voordeur Close"}}

    now you can have in every line like that:

    trueAct={{"&pushoverBody","setGlobal",json.encode(requestBody[1]),""}}}},

    trueAct={{"&pushoverBody","setGlobal",json.encode(requestBody[2]),""}}}},

    trueAct={{"&pushoverBody","setGlobal",json.encode(requestBody[3]),""}}}},

    2. I think this is preferred option.  You can represent (simulate) the data as after json.encode and use variables or keywords to update the values.

    Please login or register to see this code.

    now use variables/keywords or calculation.

    Please login or register to see this code.

    Hope you've got the idea

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