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

11921232425

Comments

  • Of course, here you go:

    {
      "id": "7eea6ae1-ebf1-4deb-85dd-a9962e805241",
      "timestamp": "2017-01-14T16:05:13.213Z",
      "result": {
        "source": "agent",
        "resolvedQuery": "in the master bedroom",
        "action": "control.homey.devices",
        "actionIncomplete": false,
        "parameters": {
          "activity": "turn on",
          "device": [
            "light"
          ],
          "floor": "",
          "room": "master bedroom"
        },
        "contexts": [],
        "metadata": {
          "intentId": "4d862988-0f71-4975-9de0-74058e02853c",
          "webhookUsed": "true",
          "webhookForSlotFillingUsed": "false",
          "intentName": "control-homey-devices"
        },
        "fulfillment": {
          "messages": [
            {
              "type": 0,
              "speech": "You got it. I will turn on the light master bedroom"
            }
          ]
        },
        "score": 1
      },
      "status": {
        "code": 200,
        "errorType": "success"
      },
      "sessionId": "0ae14818-0aa7-44a7-ad7a-9ce6b589ff73"
    }

    I'm extracting the "speech" string bij using the following expression:

    $..speech

    Screenshot of flow in action:

    Let me know if this is enough data!

  • @lenonline
    Awesome idea!
    Probably this is an issue with the http app, the jsonpath or the format google sends the json data. 
    If you install the Homey Logger and enable logging for Flow, HTTP App and Better Logic we can debug this further.
    This is my logging with a succesfull post from Postman and the same flow you showed:


  • @ErikVanDongen
    Thanks for dropping by Erik! Let's try to find this out together.

    Recently I installed Homey Logger. I'm probably doing something stupid cause my version looks different from yours (I don't have the tab 'Configuration' and the grey buttons). Also tried the one on Github without luck. A snapshot:



    Let me know what I'm doing wrong and I'll report back with the logs after I can find them ^^

  • Try the github version...
  • @lenonline sorry, just updated the app, but it's not in the app store yet off course.  The v 0.1.0 from github will have this tab.
    However, both versions of the logger will show HTTP app debug lines.
  • UrandayUranday Member
    edited January 2017
    Pushed the next version to Git and for review to the appstore:
    V0.9.10
    * Feature: Add NumSlide device. When adding, first you have to specify the min, max and step size. After that you can select your number variable.
    * Feature: Add Trigger variable with action cards. This trigger fires one time when being triggered
    * Feature: Add Trigger device to create a button that can trigger
    * Feature: Add trigger to API. Call 
    * PUT for increment: HTTP://HOMEYADDRES/api/app/net.i-dev.betterlogic/trigger/VARIABLENAME This triggers the given variable

    And if anyone ever wants to make some nice icons and stuff, I would be very greatfull (I suck at graphic design as you all can see)

    Njoy!
  • Got it @ErikVanDongen . I played around a little more. I think you're mostly interested in this bit of the logs.

    Let me know if it helps!



  • @lenonline
    The JSON is a little bit different than posted before. There are 3 'speech' elements, and the JSONpath statement is selecting them all three. So tweak the JSONpath a little further, or copy-paste the complete 'data' part here. 
  • @Uranday
    Just installed the latest version in order to test the new Trigger variable.
    I managed to create a variable and also managed to add this Trigger as a device. However, I don't see any action cards, and don't know how to use it in a flow...

    I think these trigger variables were made to replace the BitFlip workaround...?
    Could you - or someone else - show a Flow and the use of the new Trigger variable.

    Thanks for the create App!
  • Eternity said:
    @Uranday
    Just installed the latest version in order to test the new Trigger variable.
    I managed to create a variable and also managed to add this Trigger as a device. However, I don't see any action cards, and don't know how to use it in a flow...

    I think these trigger variables were made to replace the BitFlip workaround...?
    Could you - or someone else - show a Flow and the use of the new Trigger variable.

    Thanks for the create App!
    In the when flow you can use the normal variable changed cards. In the action card I added an extra trigger card. Hope this helps!

  • @Uranday
    Thanks for the rapid answer!
  • UrandayUranday Member
    edited January 2017
    Uranday said:
    Pushed the next version to Git and for review to the appstore:
    V0.9.10
    * Feature: Add NumSlide device. When adding, first you have to specify the min, max and step size. After that you can select your number variable.
    * Feature: Add Trigger variable with action cards. This trigger fires one time when being triggered
    * Feature: Add Trigger device to create a button that can trigger
    * Feature: Add trigger to API. Call 
    * PUT for increment: HTTP://HOMEYADDRES/api/app/net.i-dev.betterlogic/trigger/VARIABLENAME This triggers the given variable

    And if anyone ever wants to make some nice icons and stuff, I would be very greatfull (I suck at graphic design as you all can see)

    Njoy!
    There is a problem with the NumSlide device. When using it it will corrupt the variable. Will fix this tonight.

    ---Edit:
    Fixed ;)
  • Could someone please post some flows to demonstrate the new trigger variable and the NumSlide variable... 

    Thanks! 
  • Uranday said:
    Uranday said:
    Pushed the next version to Git and for review to the appstore:
    V0.9.10
    * Feature: Add NumSlide device. When adding, first you have to specify the min, max and step size. After that you can select your number variable.
    * Feature: Add Trigger variable with action cards. This trigger fires one time when being triggered
    * Feature: Add Trigger device to create a button that can trigger
    * Feature: Add trigger to API. Call 
    * PUT for increment: HTTP://HOMEYADDRES/api/app/net.i-dev.betterlogic/trigger/VARIABLENAME This triggers the given variable

    And if anyone ever wants to make some nice icons and stuff, I would be very greatfull (I suck at graphic design as you all can see)

    Njoy!
    There is a problem with the NumSlide device. When using it it will corrupt the variable. Will fix this tonight.

    ---Edit:
    Fixed ;)
    It is released! Njoy!
  • UrandayUranday Member
    edited January 2017
    Eternity said:
    Could someone please post some flows to demonstrate the new trigger variable and the NumSlide variable... 

    Thanks! 
    I have not the time to create the flows, but its not hard. Just create a trigger card that triggers on a variable change. That is enough. Keep in mind that the slider can by design emit multiple triggers.
  • THnx @Uranday

    I just don't understand the concept:
    - I create a Trigger variable
    - I add the Trigger as a device (it shows with a nice push button)

    Now I would like to have that push button in the IF colum of a flow.... but that can't bed done?

    So,
    - create an extra boolean variable "Trigger pushed"
    -I add this as a BitFlip device (it shows with a slider)
    - in a flow I can use the Bitflip.....to toggle the Trigger....
    - so, shy do I need the trigger in the first place???
  • See screenshot below. This in the when column is a trigger defined.


  • Thanks Patrick :-)

    I will investigate further !
  • i was told this app could create a virtual button to start/trigger, how does this work?

    I tried to create a new flow with this app but i cannot find any option to create a virtual device or button, is there a tutorial somewhere which i could follow?
  • B3rt said:
    i was told this app could create a virtual button to start/trigger, how does this work?

    I tried to create a new flow with this app but i cannot find any option to create a virtual device or button, is there a tutorial somewhere which i could follow?
    If I ever have time I will make a manual (but if anyone feels the urge, please, write it ;))

    What you do to create a button with a flow is the following:
    -> Go to settings
    -> Go to the better logic settings
    -> Add a variable, select with type trigger
    -> Go to devices
    -> Add device and select betterlogic Trigger
    -> There you should see the created trigger variable
    -> Add it.
    (These are basically the same steps you need to do for bitflip (boolean) and numbslide (number))

    -> Go to flows
    -> Create flow
    -> Select the better logic card "On variable changed"
    -> Select the variable name in there. Ensure you select the value from the dropdown, only typing will not work

    This should do the trick. Hope it helped!
     
  • Idea / Feature request

    Calculate the time difference in seconds / minutes / hours between 'touching' a variable.

    I flip a boolean at 9.30.00 and again at 10.05.00, this results in 35 minutes.
    Since you already keep track of the time when a variable has changed this saves extra variables for storing start and stop times.

    Doing this with mathjs would be sufficient for me, but it's not possible to get that info there from a specific variable, only contents of the variable itself.

  • B3rtB3rt Member
    edited February 2017
    removed my comment,  **wrong** topic

    Sorry!
  • B3rt said:
    Uranday said:
    B3rt said:
    i was told this app could create a virtual button to start/trigger, how does this work?

    I tried to create a new flow with this app but i cannot find any option to create a virtual device or button, is there a tutorial somewhere which i could follow?
    If I ever have time I will make a manual (but if anyone feels the urge, please, write it ;))

    What you do to create a button with a flow is the following:
    -> Go to settings
    -> Go to the better logic settings
    -> Add a variable, select with type trigger
    -> Go to devices
    -> Add device and select betterlogic Trigger
    -> There you should see the created trigger variable
    -> Add it.
    (These are basically the same steps you need to do for bitflip (boolean) and numbslide (number))

    -> Go to flows
    -> Create flow
    -> Select the better logic card "On variable changed"
    -> Select the variable name in there. Ensure you select the value from the dropdown, only typing will not work

    This should do the trick. Hope it helped!
     
    Thx for the tip for a working around, ut i believe it should work as intended ;)

    But my intention was to just reported that the flow card is not working, so i actually i am only reporting a bug :)
    I did not see a bug in what you said. Can you clarify a bit more?
  • "Poetsen" is a BL boolean variable. If I drop this line "http://192.168.2.48/api/app/net.i-dev.betterlogic/Poetsen" I get this answer: "{"status":200,"result":{"name":"Poetsen","type":"boolean","value":true}}"
    Can someone tell me if I drop this line "http://192.168.2.48/api/app/net.i-dev.betterlogic/Poetsen/false" in a browser the BL variable should be set to false, because I get this as answer: "{"status":404,"result":"not_found"}"
  • Uranday said:
    B3rt said:
    Uranday said:
    B3rt said:
    i was told this app could create a virtual button to start/trigger, how does this work?

    I tried to create a new flow with this app but i cannot find any option to create a virtual device or button, is there a tutorial somewhere which i could follow?
    If I ever have time I will make a manual (but if anyone feels the urge, please, write it ;))

    What you do to create a button with a flow is the following:
    -> Go to settings
    -> Go to the better logic settings
    -> Add a variable, select with type trigger
    -> Go to devices
    -> Add device and select betterlogic Trigger
    -> There you should see the created trigger variable
    -> Add it.
    (These are basically the same steps you need to do for bitflip (boolean) and numbslide (number))

    -> Go to flows
    -> Create flow
    -> Select the better logic card "On variable changed"
    -> Select the variable name in there. Ensure you select the value from the dropdown, only typing will not work

    This should do the trick. Hope it helped!
     
    Thx for the tip for a working around, ut i believe it should work as intended ;)

    But my intention was to just reported that the flow card is not working, so i actually i am only reporting a bug :)
    I did not see a bug in what you said. Can you clarify a bit more?
    sorry, my respond was for an other topic, i removed my comment on that.

    Sorry again..
  • HansieNL said:
    "Poetsen" is a BL boolean variable. If I drop this line "http://192.168.2.48/api/app/net.i-dev.betterlogic/Poetsen" I get this answer: "{"status":200,"result":{"name":"Poetsen","type":"boolean","value":true}}"
    Can someone tell me if I drop this line "http://192.168.2.48/api/app/net.i-dev.betterlogic/Poetsen/false" in a browser the BL variable should be set to false, because I get this as answer: "{"status":404,"result":"not_found"}"
    Via the brower you do a get request. It should be done as a put. 
  • ok i got a problem also.

    I have the following betterlogic variables:
    binnen_lux (= numeric)
    binnen_lux_old (= nummeric)

    The flow i want to create is:
    when:
    lux value of sensor changes (value = lux)

    and:
    lux MORE then 'binnen_lux_old'

    then:
    update values betterlogic
    binnen_lux_old = binnen_lux
    binnen_lux = lux (after 1 sec delay)

    The when and then statement is no problem, the problem is the 'and' part.

    How can i use MORE then the stored value?

  • I think if you use in the AND column a Better Logic math.js expression using the '<' calculation and select the (generic) tag for the 'binnen_lux_old' you should be good to go. 
  • mbalik79mbalik79 Member
    edited February 2017
    @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?
  • 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.
Sign In or Register to comment.