This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.

[APP] Better logic / Variable management

11920222425

Comments

  • Uranday said:
    mbalik79 said:
    @Uranday

    I want to have a mobile card in the Homey app where I can see a value that is updated in a betterlogic(number) variable. Example live monitoring "Netto vermogen live" , it's a sum of the consumed power-  generated power solar. Could this be possible?
    It is on the planning to make 'View' only cards.
    Great!
  • Just want to say THANK YOU! to @Uranday

  • B3rtB3rt Member
    edited February 2017
    i have also have 1 or 2 feature request if a may..

    Is it possible to make a comparisson between tags or betterlogic stored values ?

    For example:
    if 'tag X' is greater then 'tag Y'
    of
    if 'tag X is smaller then 'tag Y'
    or
    if 'tag X is between 'tag Y' and 'tag Z'
    or
    if 'betterlogic valueX' is more then 'Tag Y'
    etc etc

    It would also be great to use a time stamp:
    So  'variableX' is atleast more then 10 minutes ago last changed/updated

    Hope this is possible.

    Thx.

  • Anyone an idea on how to clear a string-variable in a flow?
    I want it to be completely empty.
  • Anyone an idea on how to clear a string-variable in a flow?
    I want it to be completely empty.
    Did you try the MS Excel trick: "" (two quotes with nothing in between)? Just a guess...
  • YvesGeffensYvesGeffens Member
    edited February 2017
    That stores a double quote, but the good thing is, when I use the flow card "Say something" with the contents of that variable, Homey says nothing.
    Before this, I was using a   .   and when homey tried to say the contents of that variable, he said   "punt" (period or dot, I haven't tried it in English)
    So, it's a workaround for me, but not a final solution for people who want the variable completely empty.
    Thanks !
  • is it possible to add an internal check before updating the values?

    Only update the value if the new value is different as the current value, so if a current value = true and the new value is also true it should NOT update (or change time stamp) in better logic database.

    Ofcourse you could say do a check efore you update, but ofter you have to create an other flow et, sadly there is no code we can use to create flows only drag and drop, so not all is simple to create.

    If it was possible too add this on app side it would be wunderfull :)
  • B3rt said:
    is it possible to add an internal check before updating the values?

    Only update the value if the new value is different as the current value, so if a current value = true and the new value is also true it should NOT update (or change time stamp) in better logic database.

    Ofcourse you could say do a check efore you update, but ofter you have to create an other flow et, sadly there is no code we can use to create flows only drag and drop, so not all is simple to create.

    If it was possible too add this on app side it would be wunderfull :)

    What you describe is the difference between the value is set card and the value is charged card. That should work already. 

  • Does a space work? 
    Anyone an idea on how to clear a string-variable in a flow?
    I want it to be completely empty.
  • Uranday said:
    B3rt said:
    is it possible to add an internal check before updating the values?

    Only update the value if the new value is different as the current value, so if a current value = true and the new value is also true it should NOT update (or change time stamp) in better logic database.

    Ofcourse you could say do a check efore you update, but ofter you have to create an other flow et, sadly there is no code we can use to create flows only drag and drop, so not all is simple to create.

    If it was possible too add this on app side it would be wunderfull :)

    What you describe is the difference between the value is set card and the value is charged card. That should work already. 

    no i mean a check on update..

    So if i make a flow and in that flow i do for example poll motion sensor, if this sensor is active i set a value field in betterlogic on true, at that moment the timestamp also updates (so betterlogic atually updates the value aswell)
    But if this value was allready 'true' it should NOT update (read change timestamp) of the value in betterlogic, just skip it (because it is allready the value i wish to set it to)

    So i don't mean in WHEN and AND field but in the THEN  field a check not to update if it is allready the same value.

    Why you will ask, this way you can easily see what the last real timestamp is when the value changed, not when it is updated.

    If you mean that this is possible, can you give me an example how to do this then?
  • could there be added a flow card with the current unix time stamp?

    If this was possible maybe this could be use to calculate the time diff in seconds between 2 values and act on it.

    It would be nice to make a flow and use logic as:

    - activate flow only IF time diff between of last value change is more or less then X seconds
  • This is already possible with the mathjs card and a number value. See release notes how.
  • edited February 2017
    Is there any place online where I can educate myself in how to use the math functions, as for me I really haven't got a clue how this works. Just like B3rt, I would like to calculate the difference between two logged time stamps. I tried some google searches but were not able to find more information. Is there a weblink where all this is explaned? Maybe even some examples? Iam getting stuck at a basic level it seems.
  • Not sure if this has been requested before but I'd be interested in a trigger card "Variable not changed for x minutes". Not sure if this is within the scope of the feature set or if I should solve it with the Countdown app, just let me know ...
  • Uranday said:
    Does a space work? 
    Anyone an idea on how to clear a string-variable in a flow?
    I want it to be completely empty.
    Yes, confirmed.
  • Phuturist said:
    Not sure if this has been requested before but I'd be interested in a trigger card "Variable not changed for x minutes". Not sure if this is within the scope of the feature set or if I should solve it with the Countdown app, just let me know ...

    I think that is something that is you can do with a countdown. In my opinion it should not be a part of bl. 


  • I noticed that the thing im going to say was a bug, but should have been fixed in 0.9.7 (and i'm using 0.9.10)
    source; https://github.com/PatrickSannes/BetterLogic/issues/5

    When a boolean variable changes from true to false (or vise versa) the state of a bitflip device isn't updated..
    I've created a simple button to dimm the led ring of the homey device and have it turn on/off when I come home, or leave the house and it'll turn off when I turn of the lights in the living room after midnight.. and it responds to a bitflip button (on or off).. But I noticed that when my coming home wasn't registered and I wanted to use the button to turn on the led ring, that the bitflip was already at the on position.. had to turn it off (nothing happend) and turn it back on again to turn the led ring back on..

    I've checked this with manually setting the boolean value to true or false (the led ring will turn on/off as well), but the bitflip stays in the same position..
  • NeefRoel said:
    I noticed that the thing im going to say was a bug, but should have been fixed in 0.9.7 (and i'm using 0.9.10)
    source; https://github.com/PatrickSannes/BetterLogic/issues/5

    When a boolean variable changes from true to false (or vise versa) the state of a bitflip device isn't updated..
    I've created a simple button to dimm the led ring of the homey device and have it turn on/off when I come home, or leave the house and it'll turn off when I turn of the lights in the living room after midnight.. and it responds to a bitflip button (on or off).. But I noticed that when my coming home wasn't registered and I wanted to use the button to turn on the led ring, that the bitflip was already at the on position.. had to turn it off (nothing happend) and turn it back on again to turn the led ring back on..

    I've checked this with manually setting the boolean value to true or false (the led ring will turn on/off as well), but the bitflip stays in the same position..
    Somewhere, somehow there is a bug. If this happens, you need to reboot your device and it magically works again.
  • NeefRoelNeefRoel Member
    edited February 2017
    Now i feel like a wizard :smiley:
    It's working again.. thanks
  • B3rtB3rt Member
    edited March 2017
    app crashed and now it won't start any more, what can this be?

    Stack trace:

    TypeError: variable.value.toLowerCase is not a function
    at Object.<anonymous> (/lib/flow/conditions.js:10:44)
    at emitThree (events.js:97:13)
    at Object.emit (events.js:175:7)
    at /homey-app/manager/flow.js:12:37
    at /homey-app/helpers/client.js:1:1077
    at Array.forEach (native)
    at process.<anonymous> (/homey-app/helpers/client.js:1:1046)
    at emitTwo (events.js:87:13)
    at process.emit (events.js:172:7)
    at internal/child_process.js:721:12

    Exit code: 1
    Exit signal: null

    Looks also it let my homey crash compeltely.
    I tried a restart and now it does not come online again anymore...

    edit:

    after long waiting it came online, but betterlogic is not working.
    All values are gone, i pasted a backup back and  homey complete crashes, it is unresponsive again.

    W.T....is going on here?!
  • I think you removed a variable that was used in flows. Have to see if I can do something with it. I would de install, reinstall and clear and restore your variables. Should work. 
  • B3rtB3rt Member
    edited March 2017
    Uranday said:
    I think you removed a variable that was used in flows. Have to see if I can do something with it. I would de install, reinstall and clear and restore your variables. Should work. 
    nope, but i finally was able to remove the app and reinstall it, luckely i had a backup which i could import.
    Now it is working again, but i have still no idea what causes this crash to happen.

    Also if a value is removed it should not crash Homey, i tried this once, make a flow with betterlogic and then remvoe the better logic value, nothing happend, everything works exept the specific flow.

    Just replacing the backup back without first remove and install the app did not work, Homey became unresponsive and came back online after half hour..
    So the fix was first remove it completely and then reinstall it again.
  • B3rtB3rt Member
    edited March 2017
    I discovered a bug in the better logic app.

    When you import a backup in a new installation of the app there are NO betterlogic tags available anymore of values in flows menu!

    When you use in flows these tags they don't work anymore, also a problem is that you cannot re-add these tags because in the drop down tag menu all better logic values are missing.

    @Uranday can you please take a look?


    edit/update:
    When you import the backup you have to restart homey to load the tags into the flows again...
    So if it is a bug i don;t know, but only importing the data is not enough to restore the full function again, a homey restart is needed also.
  • AmelsfortAmelsfort Member
    edited March 2017
    I was wondering if there is a difference between switching the variable of a bitflip device from a flow and switching the bitflip device using the app. I don't think so, but it would be nice to be able to know the difference.

    I just started to implement State Control for my living room and I would like to know if Homey switched on the lights because of some movement (auto) or someone did that manually. Currently I use a bitflip device for the lights, but to make the distinction between 'auto' and 'manual', I guess I need to make more variables/devices. But this would require me to make multiple flows for almost the same action.

    And another question: when I switch a boolean variable from a flow, will that trigger the bitflip device as well? If so, I the idea above won't work since it triggers the 'manual' action.
    The device should be updated though (although this isn't working as mentioned above), but not trigger the flows.
  • Amelsfort said:

    And another question: when I switch a boolean variable from a flow, will that trigger the bitflip device as well? If so, I the idea above won't work since it triggers the 'manual' action.
    The device should be updated though (although this isn't working as mentioned above), but not trigger the flows.
    Yeah, I think you are right in that assumption. Because the boolean variable and the bitflip are one and the same. 
  • Julian said:
    Amelsfort said:

    And another question: when I switch a boolean variable from a flow, will that trigger the bitflip device as well? If so, I the idea above won't work since it triggers the 'manual' action.
    The device should be updated though (although this isn't working as mentioned above), but not trigger the flows.
    Yeah, I think you are right in that assumption. Because the boolean variable and the bitflip are one and the same. 
    That's what I was afraid of. I can make a workaround where Homey switches on the bitflip device (and causes the trigger and flow to switch on the lights and set the state to 'manual') and then immediately (or after 1 second) set the state back to 'auto'.
  • Isn't it so that switching the Bitflip is always manual? Because it is a visual button which you flip? Whereas Homey would flip the boolean. But perhaps that is just semantics :smile: 
  • It's also possible to use a bitflip device in the right column. There you can switch between 'swith on' and 'switch off'.
    But when flipping the boolean also triggers the device, it won't make any difference which one you use.

    I also noticed the issue mentioned above by the way: when a flow flips a bitflip device, it doesn't show so in the app. I already tried rebooting, but that didn't make any difference. I am running the latest version.
  • When I activate a trigger via the android app it takes sometimes more then 5 seconds before the trigger is executed. Is this normal behaviour?
  • GastGast Member
    @gast make 4 flows that update a string var on set times. 

    Examples:

    06:00 morning 
    12:00 afternoon 
    18:00 evening 
    00:00 night

    You can read out in that var the time of day. You can also use it in speech cards e.g. "Good #stringvarname" that will result into good morning etc. depending on the time of day.
    I made a string variable called: Dagdeel.
    But I don't know how to use it in speech.
    Good #Dagdeel doesn't work.
    I also tried {$Dagdeel} also no succes.
Sign In or Register to comment.