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

1679111225

Comments

  • @Uranday My little boy goes to sleep at 19:30 every day (If we're lucky), I basically want a flow to turn on all the hue lights around the house on full at sunrise (Playtime), but only turn on his if he's not asleep (i.e. it's before 19:30), then at 19:30 I'll turn his off and dim the lights foe adult time :-)

    What's the most efficient way to achieve this?
  • The 0.9.4 version is published. This is fixing the initial crash with an empty collection. The bug report (published on git) is not fixed in this release.
  • I'm holding a bit off with updates till the bug is fixed. But if anyone has a feature request, please let me know and I'll try to implement it in the next update. 
  • aloftaloft Member
    Uranday said:
    I'm holding a bit off with updates till the bug is fixed. But if anyone has a feature request, please let me know and I'll try to implement it in the next update. 
    Any update on the bugfixing? My flows heavily rely on the BetterLogic variables, so many flows are pretty broken right now.
  • aloft said:
    Uranday said:
    I'm holding a bit off with updates till the bug is fixed. But if anyone has a feature request, please let me know and I'll try to implement it in the next update. 
    Any update on the bugfixing? My flows heavily rely on the BetterLogic variables, so many flows are pretty broken right now.

    Waiting till @Emile fixed it in the firmware. I saw he assigned the bug to himself. 
  • aloftaloft Member
    One feature request, although I am not sure this should be in BetterLogic or in a separate app. A countdown timer. I use BetterLogic to turn off lights after X seconds of non-movement. My flows would be a lot easier if I could set a countdown timer (when movement is detected) and then an action card that triggers when the countdown timer reaches zero.  (or if it is a count-up: when it reaches a certain value).

    Right now , I have implemented this myself with a flow that increases a number every 15 seconds, and as soon as the variable is e.g. 60 , I turn off the light.

    It would save some flows if this was built into the BetterLogic app itself, or in a separate countdown timer app, if that is more logical. 
  • You can already set a delay on the action cards in the flow manager @aloft ;
  • aloftaloft Member
    You can already set a delay on the action cards in the flow manager @aloft ;
    Yes, but a delay is something else then a countdown timer. I cannot reset an action card with e.g. 60 seconds delay when a new motion is detected. Once the action card is triggered, the action will be executed (with the configured delay), whether I want this or not.  Especially for continuous motion detection, this is not ideal.
  • I see what you mean, good point :smile: 
    As I am planning on using motion sensors to switch on / off lights and set brightness off lights I also want to make use of some sort of solution you're after.
  • aloftaloft Member
    I see what you mean, good point :smile: 
    As I am planning on using motion sensors to switch on / off lights and set brightness off lights I also want to make use of some sort of solution you're after.
    I have a solution, but it now requires 7 flows per motion sensor. It is described somewhere on the forum. Having a countdown timer would help keeping the flows more clean. I am still trying to find time to write the app myself, but I think is an easy extension of the current BetterLogic app. 


  • Countdown timer would be awesome, I have some triggers that I need to re-trigger if the return is false...
  • I dont see a countdown timer as something for better logic for now. Not even sure if it is possible to do. 
    There is a way of working around this that would work very nice I think.

    Create a flow that every second (or X seconds) flips a boolean value (to create a specific flow trigger)
    On motion you set a variable LastMotionTimeSensorX

    Then you create a flow that triggers on the change of the boolean, checks with the math.js library if there is X seconds between the current time and LastMotionTimeSensorX AND LastMotionTimeSensorX != 0(1 card). If it is true, you can reset the LastMotionTimeSensorX to 0. 
  • aloftaloft Member
    Uranday said:
    I dont see a countdown timer as something for better logic for now. Not even sure if it is possible to do. 
    There is a way of working around this that would work very nice I think.

    Create a flow that every second (or X seconds) flips a boolean value (to create a specific flow trigger)
    On motion you set a variable LastMotionTimeSensorX

    Then you create a flow that triggers on the change of the boolean, checks with the math.js library if there is X seconds between the current time and LastMotionTimeSensorX AND LastMotionTimeSensorX != 0(1 card). If it is true, you can reset the LastMotionTimeSensorX to 0. 
    I already have a workaround (which sort of uses this principle, only without the math.js library), but this will use a lot of flows for each motion (or whatever you need to count for).

    I'll give it a go to try to come up with a separate countdown app, I agree Better Logic might not be the best place for tis kind of functionality. And that's the beauty of Homey and its app store ;-)
  • PeaoPeao Member
    edited April 2016
    Hey, thanks for your app! But I am missing the possibility to get the value of a variable in a flow, which is not triggered by anything related to this variable.

    Example:
    You have a flow that saves the temperature messured by your sensor to a variable everytime the temperature changes.
    And you would like to have a voice command that you can ask homey what will result in speaking what value this variable has. As far as I checked this, there is no option to get the value of a variable in a flow unless its the Trigger-Card in the "when..." colum.

    Request:
    Please add a "...and..." card which has a dragable variable sign. e.g.: "Variable [] is set" [Value] [Variable].
  • Great news, the new update fixes Better Logic!

    @Peao Your feature is currently not possible. And cards can not have droptokens.
  • Too bad. There is still a bug after testing it. For some reason the settings page dissappear after some time with the test flow. Disabling and enabling the app makes everything come back. So no variables get lost. I'll post a bug report tomorrow on github. 
  • Better Logic runs at 26MB here since the update yesterday, with 11 variables.
  • MarkSwiftMarkSwift Member
    edited April 2016
    @Peao I also wanted to use a similar flow For now I've sidelined it, I hope @Uranday will consider it for a future release!
  • MarkSwift said:
    @Peao I also wanted to use a similar flow :) For now I've sidelines it, I hope @Uranday will consider it for a future release!


    I also would like it, but the homey does not allow it for now. 
  • @Uranday Is it possible to have variable values logged in 'insights'?
  • I had it for a bit in there... After the change in api I removed it. Will bring it back soon. 
  • @Uranday As you're the local flow master, what is the best way to trigger a flow, for example...

    If variable changes, and variable is less than x, trigger flow x

    Is this possible?

    Background info:

    I want to check my freezer temp variable, if it's not below a certain temperature, I want to trigger a recurring flow until it returns to a normal temperature...
  • MarkSwift said:
    @Uranday As you're the local flow master, what is the best way to trigger a flow, for example...

    If variable changes, and variable is less than x, trigger flow x

    Is this possible?

    Background info:

    I want to check my freezer temp variable, if it's not below a certain temperature, I want to trigger a recurring flow until it returns to a normal temperature...


    What will your trigger be? An change on temp or a trigger every x seconds? 
  • I have a flow that checks MQTT and updates a better logic variable (Freezer Temperature). So the trigger would be a change in temperature, with and is more than say -18...
  • UrandayUranday Member
    edited April 2016
    If variable changes
    Variable > -18
    Then do X....

    And if you want to trigger aslong this is true, replace do X with set bool DoX = true
    Then make an second flow

    Every X seconds
    AND DoX==true
    Then do more special stuff....

    But this is so simple, you probably had an other idea?
  • Question/feature request:

    What would it take, to be able to do something like this:

    If [I say something: "What is the temperature"]  and [TempValue > 0]  then [Say: The temperature is $TempValue]
    or even
    If [I say something: "What is the temperature"]  then [Say: The temperature is $TempValue]

    ? any chance of something like this happening, or does this require a significant change in the Flow editor first?
  • Perhaps something like: Sensor -> on temperaturechange write value to variable

  • Perhaps something like: Sensor -> on temperaturechange write value to variable

    Well, that's the easy part. It's the follow-up to that that is causing me issues... I am looking for a simple way to be able to output that stored variable in speech, when I ask for it (NOT when the temperature changes)

    And it looks like I also can't copy the contents of one variable into another one... so I also can't do:
    If [I say something: "What is the temperature"]  then [SET $TempValue2 = $TempValue]
    If [$TempValue2 is set] then say [The temperature is $TempValue2]

Sign In or Register to comment.