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

Variable management

UrandayUranday Member
edited February 2016 in Archive
Hi,

You can set variables and add triggers based on variables. Wouldn't it be nice to have a variables management section (create, update, see current value etc)... Also being able to increment or decrement a value, flip from true to false etc in a flow would be very helpfull.

Patrick

Comments

  • After doing a bit more now, it becomes more and more needed to get more insight into variable. I am structuring now my flows like:
    For example I have the following flows:
    - When its 6'00 -> Awake = 1
    - When Awake is changed and Awake = 1 -> WantCoffee = 1
    - When button 1 on is pressed -> WantCoffee =1
    - When WantCoffee = 1 -> Turn on power of KAKU device

    And the reverse. 

    As you can see, figuring out the state of variables is not very nice. And to be honest, sometimes I see no response of my KAKU device. This is now not very good debuggable due to the missing variables.... 

    Maybe adding a variable as insight diagram would be helpfull..? A 1 and 0 as bool is very easy plottable.
  • Uranday said:
    After doing a bit more now, it becomes more and more needed to get more insight into variable. I am structuring now my flows like:
    For example I have the following flows:
    - When its 6'00 -> Awake = 1
    - When Awake is changed and Awake = 1 -> WantCoffee = 1
    - When button 1 on is pressed -> WantCoffee =1
    - When WantCoffee = 1 -> Turn on power of KAKU device

    And the reverse. 

    As you can see, figuring out the state of variables is not very nice. And to be honest, sometimes I see no response of my KAKU device. This is now not very good debuggable due to the missing variables.... 

    Maybe adding a variable as insight diagram would be helpfull..? A 1 and 0 as bool is very easy plottable.
    It's not a bad idea but it looks more like a developer thinking flow. I don't see normal consumers think like this
  • Why not make a flow
     - When its 6'00 (And somebody is home) Then make coffee

    And another one:
     - When button 1 is pressed Then make coffee

  • UrandayUranday Member
    edited February 2016
    Why not make a flow
     - When its 6'00 (And somebody is home) Then make coffee

    And another one:
     - When button 1 is pressed Then make coffee

    My coffee machine is a piston espresso machine. So I need to turn it on to preheat it before I can make coffee. 
  • kitkat said:
    Uranday said:
    After doing a bit more now, it becomes more and more needed to get more insight into variable. I am structuring now my flows like:
    For example I have the following flows:
    - When its 6'00 -> Awake = 1
    - When Awake is changed and Awake = 1 -> WantCoffee = 1
    - When button 1 on is pressed -> WantCoffee =1
    - When WantCoffee = 1 -> Turn on power of KAKU device

    And the reverse. 

    As you can see, figuring out the state of variables is not very nice. And to be honest, sometimes I see no response of my KAKU device. This is now not very good debuggable due to the missing variables.... 

    Maybe adding a variable as insight diagram would be helpfull..? A 1 and 0 as bool is very easy plottable.
    It's not a bad idea but it looks more like a developer thinking flow. I don't see normal consumers think like this
    I'm indeed a developer, but what I know of other devices this is the needed way of working to prevent getting crazy in the end.
  • Also incrementing and decrementing becomes more and more welcome. For example:

    When button 1 is pressed:
    Temperature = Temperature + 1

    When Temperature is changed
    Call HTTP request with the temperature as parameter
  • As far as I know app are "sandboxed" and variables should survive an reboot. 
    Maybe it's possible to create some sort of global variable app which receives variable changes from webhooks? 
  • Uranday said:
    Also incrementing and decrementing becomes more and more welcome. For example:

    When button 1 is pressed:
    Temperature = Temperature + 1

    When Temperature is changed
    Call HTTP request with the temperature as parameter
    Have you tried in-card calculations? This is posted bij Emile a while back:


    Execute a HTTP request with temperature as a variable is possible. You can drag the value-token into the HTTP cards (remove the two extra spaces it adds automagically around the tag)
  • ErikVanDongen Any idea what I'm doing wrong?


    flow.png 403.1K
  • No, I cannot get variables in output fields. Calculations like {{3*3}} are correct, but as soon as I add a variable it outputs like {{3*variable1}} (i use push notifications to check the output).
  • UrandayUranday Member
    edited February 2016
    I decided to build a module for variable management/Logic. Currently my goal is to create:
    - String support
           - Equals, not equals
           - Contains
    Bool support
           - True/False support with a token 
           - Flip 
    Number
           - Equals, (Not) Great than, (Not) Less then
           - Increment, Decrement by a fixed value or token

    Settings to create values/see values. All values used should be defined before you can use them in a flow

    After the first release I want to add API support.

    Are there already any feature requests?

    Patrick
  • PhuturistPhuturist Member
    edited February 2016
    That would be awesome Patrick! Don't have wishes that arent in scope yet at the moment other then the boolean support you already mentioned in another thread.
This discussion has been closed.