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

1161719212225

Comments

  • Hi, I have a suggestion for extending the functionality with schedules. This would really save me a number of flows. Use case would be to set the thermostat high during working hours, and low during non-working hours. In your app you could add a boolean variable that is true during the set schedule, and false otherwise. With a trigger flowcard when the value changes, and a condition flowcard I would be all set. All you would need to do is add is a place to set up the schedule. Something similar to what is displayed below would do the trick :)

    Dou you see this as a good extension of BL?




    This sounds like a new app. Then you make triggers in start and finish of the specific schedule. 

  • @emile had such an idea about scheduling back in april 2015, see this thread https://forum.athom.com/discussion/1138/volume-settings/p1 no idea what has happened with his idea...
  • I'm going to prepare an update for the Global Token support..... Looks like good fun.
  • DaneeDeKruyffDaneeDeKruyff Member
    edited December 2016
    Great!
  • Awesome.
  • @Uranday
    Can't wait to get my hands on the Homey update and your Better Logic !

    Thanks for the good work, just made a donation.
  • @Uranday
    Can't wait to get my hands on the Homey update and your Better Logic !

    Thanks for the good work, just made a donation.


    Thanks! Much appreciated! Feels great everything the PayPal notifies me with a notification! 
  • @Uranday ;
    I made a flow with
    IF: date&time, every minute
    THEN: Betterlogic Set String Variable: TimeString, Value: TimeTag

    TimeString now is '22:16'

    So actually stringfunctions like you have a mathjs flowcard would do the job.
    like:
    TimeString.substring(1, 2) -> TimeHourString
    fixed

    Someone who wants to do that with a date can do the same.

    You think a stringfunction flowcard would be possible ?

    Thanks!
    In your scenario substrings are not so nice to work with due to the fact you cannot do calculations. So I add a set of extra reserved variables next to timenow. 

    * Feature: Added #DD (day), #MM (month), #YYYY (year), #HH (hours), #mm (minutes) #SS (seconds) as reserved words next to timenow in the mathjs flows. You can now for example assign #HH to a variable to get the hours. Also I changed timenow to #timenow for consistency.

    Hope it helps!

  • Working on 1 bug for the local hours (currently I can only get the UTC. But this are the upcomming features for now

    V0.9.8
    * Feature: Add global TAG support
    * Feature: Changed the i and d in increment to increment and decrement (left the i and d for backward compatibility)
    * Feature: Added #DD (day), #MM (month), #YYYY (year), #HH (hours), #mm (minutes) #SS (seconds) as reserved words next to timenow in the mathjs flows. You can now for example assign #HH to a variable to get the hours. Also I changed timenow to #timenow for consistency.
    * Bug: Replace filter with find when looking up devices
    * Bug: Fixed delete all function so it also removes all Insights

     (small snippet of the new global tags you have in the flow editor)
  • Someone asked my to add extra devices next to the bitflip. For now I see something like a number slider where you can change a number. (I think strings will not be possible). To do so I have to predifine a card with a range. I was thinking about a card 0-100. What do you guys think?
  • UrandayUranday Member
    edited December 2016
    Uranday said:
    Someone asked my to add extra devices next to the bitflip. For now I see something like a number slider where you can change a number. (I think strings will not be possible). To do so I have to predifine a card with a range. I was thinking about a card 0-100. What do you guys think?
    It is implemented with a slider from 0-100 with steps of 0.5. Lets see how it is going to work.
  • What would be a use case for that?
  • Does that matter? :D
  • For example, you have X dimmers or thermostats you want to put in a group. What you can do is create a number variable, adjust it with the slider, and then set multiple devices with that value....
    To make it more usefull, during adding of the device you can select the min/max and step values. So, besides the why, because I can, I think there is a usecase.
  • Fire69Fire69 Member
    edited December 2016
    Does that matter? :D
    lol  :p

    Just wondering how I could maybe use this myself  ;)

    Uranday said:
    For example, you have X dimmers or thermostats you want to put in a group. What you can do is create a number variable, adjust it with the slider, and then set multiple devices with that value....
    To make it more usefull, during adding of the device you can select the min/max and step values. So, besides the why, because I can, I think there is a usecase.
    Hm, that might really come in handy indeed! :)
  • Its submitted without the slider. Still some open issues, but wanted to give you TAG support in the upcomming release. Hope you enjoy it!

    V0.9.8
    * Feature: Add global TAG support
    * Feature: Changed the i and d in increment to increment and decrement (left the i and d for backward compatibility)
    * Feature: Added #DD (day), #MM (month), #YYYY (year), #HH (hours), #mm (minutes) #SS (seconds) as reserved words next to timenow in the mathjs flows. You can now for example assign #HH to a variable to get the hours. Also I changed timenow to #timenow for consistency.
    * Bug: Replace filter with find when looking up devices
    * Bug: Fixed delete all function so it also removes all Insights
  • Thanks for your hard work!
    The sliders sound amazing as well, I can think of loads of uses (especially in combination with HomeyDash for example)
  • Released for everyone that is on 1.1.0
  • @Urunday Thanks!

    I use timenow in some mathjs cards, you write you changed timenow to #timenow, do I have to change the cards?

    Example:



  • @Urunday Thanks!

    I use timenow in some mathjs cards, you write you changed timenow to #timenow, do I have to change the cards?

    Example:




    Nope, kept the old one so you won't be mad at me :D


  • Hi,
    How to round a number to half decimals
    example:
    i got a #Outside_Temperature which is -2.4  __  I want it to be changed in -2.5 
     if i use: round(#Outside_temperature) to (#Rounded_Outside_Temerature) it gives me the number -2

    Can someone tell me how to do this?

    thanks in advanced
  • Ronald said:
    Hi,
    How to round a number to half decimals
    example:
    i got a #Outside_Temperature which is -2.4  __  I want it to be changed in -2.5 
     if i use: round(#Outside_temperature) to (#Rounded_Outside_Temerature) it gives me the number -2

    Can someone tell me how to do this?

    thanks in advanced
    round($d$*2)/2

    First you multiply the numer times 2, you round and then you devide to 2.
    so that would be -2.4*2 = 4,8 -> round that would give -5. Devide it by -2 would give -2.5. 

    If you want to do it with steps of 0.25 you can do the same trick but use 4 instead of 2.

    Hope it helps!
  • Uranday said:
    @Urunday Thanks!

    I use timenow in some mathjs cards, you write you changed timenow to #timenow, do I have to change the cards?

    Example:




    Nope, kept the old one so you won't be mad at me :D



    Well, I don't mind if it's changed and brought in line of the other date/time related variables, I think in the long run it would make things easier. So if you change it and give us a heads-up on how to change our flows I have no problem with it.
  • Uranday said:
    Ronald said:
    Hi,
    How to round a number to half decimals
    example:
    i got a #Outside_Temperature which is -2.4  __  I want it to be changed in -2.5 
     if i use: round(#Outside_temperature) to (#Rounded_Outside_Temerature) it gives me the number -2

    Can someone tell me how to do this?

    thanks in advanced
    round($d$*2)/2

    First you multiply the numer times 2, you round and then you devide to 2.
    so that would be -2.4*2 = 4,8 -> round that would give -5. Devide it by -2 would give -2.5. 

    If you want to do it with steps of 0.25 you can do the same trick but use 4 instead of 2.

    Hope it helps!
    Works Like a charm :-)

    Thank i appreciate it.
  • Better logic stopped working for me since 1.1.2.
  • Yep, it seems like the triggers stopped working. Ill go and investigate to see what is going on.
  • DaneeDeKruyffDaneeDeKruyff Member
    edited December 2016
    I'm not sure but to me it seems a card in the ...and... column also doesn't work properly. I'm still not sure in what situations it happens, still investigating.
    I check a dim value from a hue light for beeing bigger then 0,99.

    In a test with entering a value the evaluation is correct.
    When I set the dim level of the light to 100% the evaluation goes wrong.
    When I make a flow that reportsthe dim level it reports 1 when the dim level is set to 100% so the evaluation should have been correct


    (On a side note, it would be more logical if 100 was reported when brightness is set to 100% the way it was in earlier builds, but @emile thinks it's correct this way: https://github.com/athombv/homey/issues/958#issuecomment-257541512)
  • There is a bug in triggering. Unsure what the problem is. We have to wait until Weejewel can fix it. Until then if you rely on BL, hold off the update.
  • Ok, thanks, read up on the forum and slack and figured it was indeed the bug that was suposed to be fixed: 
    • Fixed a bug where Flow tags of a trigger could be null
    I've learned the hard way that manual updates is the way to go on experimental so I'm safe ;)
  • The problem is found. A bug I abused is fixed. Currently I have two options to fix it:
    I have two options:
    - Make a shitload of cards (bool set, bool changed, number set, number changed etc) and have tokens on the trigger card.
    - Make 1 trigger card, but without the tokens and use a tag when needed.....

Sign In or Register to comment.