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

1171820222325

Comments

  • I personaly prefer tokens on the trigger card because that is what I'm used to, but I can see using tags being the way to go in the future.
    though choice to make... but I think it's yours to make as it is you who invests the time in building and maintaining the app.

  • UrandayUranday Member
    edited December 2016
    I decided myself. I removed the tokens because that is the fastest way to get it running again. Later I can revert this and do it an other way based on your feedback so please let it go. For now I released the 0.9.9 release that removed the tokens.

    And good job on the Athom team to get the update pushed as fast as they did.
  • glijieglijie Member
    edited December 2016
    Uranday said:
    I decided myself. I removed the tokens because that is the fastest way to get it running again. Later I can revert this and do it an other way based on your feedback so please let it go. For now I released the 0.9.9 release that removed the tokens.

    And good job on the Athom team to get the update pushed as fast as they did.
    whooo! that's fast...its is working again!! thx!!!

  • Soo... I'm not completely getting it.  What are those tokens that got removed now? :confused:
  • The things that are attached to a flow card that you can drop on other cards. 
  • Ah, ok.  But the global tags are still there.
  • Ofcourse
  • @Uranday two questions, originating from the same flow instance.

    In below flow, I'm calculating the 3 point average of my light intensity; to be used as trigger for my lights.

    1) I'm able to use the global tags in the BL cards, yet not in the variable fields itself. Is it possible to implement this to make it even more user friendly?
    2) Would it be possible to add an array type of variable... to be used for these type of n-point average, but also to store the previous dim level of a device.
  • @Uranday To ease the management of a large number of variables and given renaming isn't possible, could you perhaps consider allowing folders so we can sort our variables?
  • MarkSwift said:
    @Uranday To ease the management of a large number of variables and given renaming isn't possible, could you perhaps consider allowing folders so we can sort our variables?

    This could be a feature, but currently there are other features more needed. Best thing you can do is prefix the names and use the filter. 

    Patrick 

  • Uranday said:
    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: 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)
    Hi @Uranday

    I finally found some time to experiment with this (I also updated this evening to Homey 1.1.2).

    I created 2 number-variables in Better Logic.
    I'm trying to create a basic flow like this:





    I get an error when setting the number-variable.

    But when I do this



    I don't get an error, but 'hours' is now a string-variable.

    What can be wrong ?
  • I think I found what was wrong.

    I have 2 variables (#uren and #minuten). By mistake I thought these were your build-in variables. But they were mine, that I created some time ago.

    So now I found out that #year, #month, #day, #seconds, #minutes, #hours are simply not available under Tags. Is there something I have to do to make them visible?
  • I think I found what was wrong.

    I have 2 variables (#uren and #minuten). By mistake I thought these were your build-in variables. But they were mine, that I created some time ago.

    So now I found out that #year, #month, #day, #seconds, #minutes, #hours are simply not available under Tags. Is there something I have to do to make them visible?
    Currently the day, month, etc variables are no tags. So you have to assign them to your own variable with a trigger. See an example below. The #SS can be replaced by the one you want (see release notes. Casing is important)

     
  • Thanks for the tip, but the main issue remains:



    I created the Time-variables, I still get an error on TimeHH in the mathjs expression.
    Strange.
  • Thanks for the tip, but the main issue remains:



    I created the Time-variables, I still get an error on TimeHH in the mathjs expression.
    Strange.
    This is really silly. But You typed the TimeHH probably instead of using autoselect and select it with the mouse. Just click in the field, the dropdown should appear and select the item.... And see the magic (I hope ;))
  • Nooooh :-)

    Thanks
    That solved a part of the problem.
    Now I get this:


    TimeMM is always 1

  • he #SS can be replaced by the one you want (see release notes. Casing is important)
    I hoped my hint was clear enough ;) ;)

    There is one huge issue with date notation... see the following string YYYY-MM-DD-HH-mm-SS

    Thus in the releasenotes is written:

    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.

    Thus, in your minute field you now get the month (1)... Hope this helps :)
  • I can 't thank you enough for your endless patience !
  • No problem! 


  • Do I understand it right that its NOT possible to make 1 variable that is night, morning, afternoon and evening? 
    I do have to make four variables with true, false? 
  • @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.
  • For those who want to do what I was doing, have homey telling the time like this:

    13 hours, homey says 1 o'clock

    You can use this mathjs expression:   $#HH$ > 12 ? $#HH$ - 12 : $#HH$

  • Added the numberslide device on git. 1 known issue is if you scroll to max value you get the maxvalue * 10. This is a bug in the homey software. More devices are comming in the next week. For now I'm planning on:
    - Trigger variable with a nice pushbutton card
    - Cards that can show the current value of a boolean, string or number




  • I have a dilemma.

    I have a flow, that starts when a variable is set to true, this flow sets the thermostat to 21o. And a flow that sets it to 18o when the var is false. I can use a BL Bitflip to turn on/off the heating quickly. That works great!

    But now, the thermostat has a shedule himself and of course buttons. I want to update the BL variable state (true/false) when the thermostat changes the temperature. I have the Atag One thermostat, that works great with Homey. I can make a flow 'if the set temp is 21 or higher, then change variable to True'. But, at that moment, the flow will start too, and I don't want that.

    For example, it's 18o and someone sets the temp manualy to 22o, I want the variable change to True, but I don't want it to run the flow (becouse then it sets the temp back to 21o).

    Anyone an idea how I can do this?




  • First, thanks for your donation ;) I appriciate it a lot.

    What you could do is create a flow that sets the HeatingOn to true when changed manually but also set a second variable to true.( ManualTempAdjust). Furthermore set the same variable to false after 30 seconds oid (with the timer icon in the right corner).

    Then in the flow that now is triggered to often, check if the manual temp adjust is not true and it is working I guess.

    Hope it helps!
  • No problem. I couldn't make flow like I do now, without your app! So you deserve a beer.. ;)

    Your suggestion sounds logical. I'm going to try that!
  • I wondering if the following is possible with your app (+ HomeyDash + Harmony).

    I've greated a few bitflips for my favorite tv channels let say channel3, channel5, channel20, etc
    What I do now is great a flow to:

    if= channel3 on then channel5, 6, 20 off + harmony sets my tv to channel3 (this is working great but maybe not the best way to do it)
    In the HomeyDash dashboard I see what channel is selected/on and which are off when I controle the bitflips from the dashboard.

    Now what I'm trying to achieve is that when I use my remote controle (harmony) and select channel5 that this will also change on the dashboard.

    Is something like this possible??? and how can I achieve this???

  • MennoMenno Member
    edited January 2017
    @Uranday is the above request possible to get working with your app? I just saw in other thread you will create a virtual button in an upcoming version this sounds to me to be perfect for selecting tv channels (am I right?). 
  • Hi there! I was forwarded from the Slack channel to this topic. I'm hoping I can use your brains for a moment to help me figure out a challenge I'm having right now.

    I'm trying to do the following: connecting Google Home/Assistant with Homey through API.AI.  I created a Homey agent for Google Assistant which I can ask for help. I can have a discussion with the assistant and the end result is a http post using a webhook. The request includes JSON. Within the JSON results, there's a speech string that we can use to emulate speech within Homey ((I'm assuming ;) )). Heck, we could use a BL variable for a lot of other things as well!

    All good so far. I've hooked up Homey to the Google Assistant, it sends a POST to Homey, Homey receives the POST. Then I extract a string that I want to save to a BetterLogic variable. And here I run into an issue. When I manually test the flow and provide the JSON input, it works smoothly. When I try to do the same through the Google Assistant, the BL variable doesn't seem to be updated. I took a look at the logs and this error stands out to me: "["HTTP Log",{"datetime":"2017-01-15T14:30:52.980Z","message":" --> error: result is an array"}]". But I can't really find any clear explanation on these type of errors..

    I'm probably doing something wrong so sorry in case my question / problem is plain stupid. I also don't know if this is a 'BL' or a 'HTTP request' issue. Yet I do users using both so I thought; let's post it here. Any thoughts? Would really appreciate some help here. If I get this to work, I'll write a detailed post on this proof of concept for integrating two really great systems!
  • UrandayUranday Member
    edited January 2017
    Can you post an example of the json message you send? 
Sign In or Register to comment.