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

11920212224

Comments

  • rtnartna Member
    MarcoWijk said:
    0.9.12 works like a charm! 
    Same over here. Problem solved I guess.
  • Thanks for the quick fix!
  • LJSVVLJSVV Member
    Uranday said:
    Update is finished. Took a bit longer because I was afk
    Thanks!! 
  • Problem solved. Thanks!
  • hallo, de berekeningen kloppen niet altijd, ik gebruik better logic om een lamp te dimmen, maar de dimmer verwacht alleen 2 cijfers achter de comma 0.00-1.00 . wanneer ik 0.05 increment doe of decrement krijg je een getal in mn variabele van 8 cijfer achter de comma bv . 0.499999999. daarmee kan ik niet dimmen.er komt een foutmelding.
    dit was al voor  de laatste updates. het zou heel fijn zijn als u hier tijd hebt om er aan te werken.
  • casedacaseda Member
    edited June 2017
    @TWELLOCITY
    dit is inderdaad iets dat al heel lang speelt, schijnbaar zeer moeilijk op te vangen, ook de homey logic (in gebouwde) kaarten hebben hier last van, je kan het zelf opvangen door de waarde zelf af te ronden:
    round(WAARDE * 100) / 100

    This is indeed something that is there for a long time, even the buildin logic cards of homey have this problem.
    je can catch it yourself by rounding it yourself: 
    round(VALUE * 100) / 100
  • HedzerHedzer Member
    hi Patrick, first of all thanks for the great app and the effort you have put in. Can I ask you a favor with your next planned update ? When I create a device from BetterLogic the received json is not following the standard and as such I have to code around it which I prefer to avoid. All json devices report label with en =".." and/or nl = "..". Your variables also follow these standard, however the BL devices do not do this (see json below comparison of variable and device):

                   \{\

                chart = stepLine;\

                decimals = 2;\

                enabled = 0;\

                label =             \{\

                    en = "Volume Sonos kamer";\

                \};\

                name = "Volume Sonos kamer";\

                type = number;\

                units =             \{\

                    en = Value;\

                \};\

                uri = "homey:app:net.i-dev.betterlogic";\

                uriObj =             \{\

                    icon = "/app/net.i-dev.betterlogic/assets/icon.svg";\

                    id = "net.i-dev.betterlogic";\

                    name = "Better Logic";\

                    type = app;\

                \};\

            \},\

                    \{\

                chart = stepLine;\

                decimals = 2;\

                enabled = 0;\

                label = "Volume Sonos kamer";\

                name = dim;\

                type = number;\

                units = 0;\

                uri = "homey:device:5d0b686e-bf6b-411d-b075-646a5309dab4";\

                uriObj =             \{\

                    icon = "/app/net.i-dev.betterlogic/assets/icon.svg";\

                    id = "5d0b686e-bf6b-411d-b075-646a5309dab4";\

                    meta =                 \{\

                        zoneName = "experimenteer lab";\

                    \};\

                    name = "Volume Sonos kamer";\

                    type = device;\

                \};\

            \},\

  • Is there some list where I can see the functions of better logic?
  • bvdbosbvdbos Member
    math.js works in Better Logic:
    http://mathjs.org/docs/expressions/syntax.html
  • Is it possible to create an array in a better logic variable? 
  • caseda said:
    @TWELLOCITY
    dit is inderdaad iets dat al heel lang speelt, schijnbaar zeer moeilijk op te vangen, ook de homey logic (in gebouwde) kaarten hebben hier last van, je kan het zelf opvangen door de waarde zelf af te ronden:
    round(WAARDE * 100) / 100

    This is indeed something that is there for a long time, even the buildin logic cards of homey have this problem.
    je can catch it yourself by rounding it yourself: 
    round(VALUE * 100) / 100
    I'm also having this issue increasing/decreasing sound on my Sonos, how do I apply ROUND to my BetterLogic variable? Not sure which card to use
  • caseda said:
    @TWELLOCITY
    dit is inderdaad iets dat al heel lang speelt, schijnbaar zeer moeilijk op te vangen, ook de homey logic (in gebouwde) kaarten hebben hier last van, je kan het zelf opvangen door de waarde zelf af te ronden:
    round(WAARDE * 100) / 100

    This is indeed something that is there for a long time, even the buildin logic cards of homey have this problem.
    je can catch it yourself by rounding it yourself: 
    round(VALUE * 100) / 100
    I'm also having this issue increasing/decreasing sound on my Sonos, how do I apply ROUND to my BetterLogic variable? Not sure which card to use
    Found something that works, using mathjs with ROUND. When my 'volume up' flow triggers and set the 'betterlogic' variable to something like 0,00000003 my second flow that set the volume  (triggered by 'a variable changed', in my case 'volume') I'm using the mathjs card to do the rounding of the variable before its passed to my Sonos system.




  • exiofexiof Member
    edited September 2017
    Can I do an "if" in Better Logic/Math.JS? I just want a value to increase until it reaches 1..

    Its for a "slow" dimmer so I want increments of 0,05 until 1 but I need it for 3 lamps and they need to run so lap one starts before lamp 2 and 3 - and I want to integrate it into 1. flow instead of making 3 flows..

    I was looking for a statement that just adds 0,05 if the number in the $variable$ is less than 1.. 

    And then I want to run it until lamp1 => 1 and lamp2 => 1 and lamp3 => 1...

  • techniman said:
    Is it possible to create an array in a better logic variable? 
    +1
  • xAPPO said:
    techniman said:
    Is it possible to create an array in a better logic variable? 
    +1
    Can you guys explain what you would want to do with it? I mean having an array does not do a lot without having some cards that do something with it... 



  • xAPPOxAPPO Member
    edited September 2017
    Uranday said:

    Can you guys explain what you would want to do with it? I mean having an array does not do a lot without having some cards that do something with it... 

    I'm new to Homey and trying to support my lighting system that uses arrays (actually objects but arrays would suffice) and I wanted to be able to pass these between functional blocks and maintain a state array and an ID mapping array too.

    However .. you make an excellent point that without other capabilities in Homey to do the manipulation , it's a pointless feature, so let me withdraw this request, at least for the time being.

    HomeyScript offers a possible solution although I'm not yet sure if I can read/write BL variables (or even Homey variables) from that.  I also have some problems with the asynch nature of the scripts, but as I said I'm quite new to Homey (and JS).  I will explore writing my own app too.

    I'm anxious about the number of flows I have to create to achieve things that are related. BL helps a lot but the overall flow model seems flawed. Something like Node-RED would seem much better suited. I'm looking at hooking in/out of that too.

    Great job with BL - many thanks for all the work you've put in on this and the ongoing helpful support.
  • DD Member
    OetAelse said:
    Now i want to store time like 11:30 in a variable and use this as tag in a flow, is this possible?
    I'd like to know if this is possible as well. Have tried using a BL-tag with a specific time in a time-based trigger, but to no avail. I guess this is more a question for Athom, but if someone knows a workaround for using time from a variable as a time for a trigger I'd love to read it here. ;-)
  • Is it possible to change a variable without the corresponding BitFlip-device triggering flows?

    I have several flows which are triggered by automatically (by movement, sun events, time, etc.) and can be triggered by using a BitFlip-device. When the flows are triggered, the BitFlip isn't changed so I can't see the current state in the app. But when I change the variable from the automatic flow, the device is triggering flows as well.

    Although this might not seem like a problem (since the flow had to be triggered anyway), I have some flows where I want a distinction between automatically triggered and manually triggered. Currently, I just disable some flows when I set the variable and enable them afterwards, but it would be nice if I could change the variable without the device triggering (but have the device change according to the variable).

    Maybe a new card: 'Change variable without trigger'?
  • CyberSponkCyberSponk Member
    edited September 2017
    You (@Amelsfort) can handle this with a Number-Variable. For example BitFlip-Device On you need:

    BitFlip-Device (Boolean)
    Variable (Number)

    You also need two Flows:
    One Flow for the BitFlip-Device and a second Flow for doing things that Homey should do.

    First Flow
    When > BitFlip-Device turned On
    And > Number-Variable is not 1
    Then > Trigger second Flow

    Second Flow
    When > Flow is triggered
    Then > Things that Homey should do and set Number-Variable to 1 and switch On BitFlip-Device after 3 seconds

    3-Seconds-Delay: Tested it out and with 3 seconds it works perfect for me.

    In that way you could trigger the Second Flow with the BitFlip-Device and from other Flows/Actions > The BitFlip-Device will shown (after 3 seconds) the correct state.
  • Count_BCount_B Member
    edited September 2017
    I have added a bitflip device, but when I change the variable to false or true in Homey it isn't changing on my android app. Any ideas?
  • Count_BCount_B Member
    edited September 2017
    Here a little more specific. I have created 2 flows, see below:



    Now the first flow is working fine when I press the Bitlfip device on my mobile phone. The problem is that when I do a voice command the TV is turning on & off fine but the bitflip device is not changing. Although it is changing in the settings menu so it looks like the flow is correct. Maybe I miss something?

    Edit: After a fresh reboot everything is working fine!
  • Uranday said:
    Change log or it didn't happen  :)

    Also, how can I use a variable token from the When column in the Then part, when the variable hasn't changed?

    Edit: doH! https://github.com/PatrickSannes/BetterLogic
    You can not. I can see if this is possible to implement. Not sure though.

    Hello everybody,

    I have some flows where I would need the ability to check if a variable not changed. Are there any news on this? I haven't found something in the forum.

    Regards
    Seraphim
  • Hi All,

    After a very long and busy period I figured I need to put some time in the app again. Also, I still need to implement SDK2 to ensure you all can use the app when SDK1 gets abandonned. For now my to do list is:
    - Implement SDK2
    - Fix some bugs where the app could crash if a value was typed instead of selected
    - Feature request: Whitelisting from LAN
    - Feature request: API call for variable by name

    If anyone has requests or bugs, please post them on github: https://github.com/PatrickSannes/BetterLogic/issues

    Regards,
    Patrick 
  • Is it possible to shift the content of an string variable to another string variable, e.g. content of T2  to T3, T1 to T2, T0 to T1?
  • angrangr Member
    OetAelse said:
    Is it possible to shift the content of an string variable to another string variable, e.g. content of T2  to T3, T1 to T2, T0 to T1?
    Should be, by using Tags. All BetterLogic Variables have associated Tags, hence in a Then-statement use "Set String Variable", Name=T3 Value=<tag_of_T2>   
  • angr said:
    OetAelse said:
    Is it possible to shift the content of an string variable to another string variable, e.g. content of T2  to T3, T1 to T2, T0 to T1?
    Should be, by using Tags. All BetterLogic Variables have associated Tags, hence in a Then-statement use "Set String Variable", Name=T3 Value=<tag_of_T2>   
    Thanks, that did the trick! How could i forget about the tags ;-)
  • Hi all,

    I'm totally new with Homey, just started yesterday. As a former Fibaro user I used a lot of variables in my scenes, that I now miss in Homey. So I really want to try this app.

    I've stranded on the install.

    I'm getting this error:

    ✓ Validating app...
    ✘ Homey App did not validate against level `debug`:
    [
        {
            "keyword": "enum",
            "dataPath": ".flow.triggers[2].args[2].type",
            "schemaPath": "#/properties/args/items/oneOf/0/properties/type/enum",
            "params": {
                "allowedValues": [
                    "text",
                    "autocomplete",
                    "device",
                    "date",
                    "time",
                    "color"
                ]
            },
            "message": "should be equal to one of the allowed values"
        },
        {
            "keyword": "type",
            "dataPath": ".flow.triggers[2].args[2].step",
            "schemaPath": "#/properties/args/items/oneOf/1/properties/step/type",
            "params": {
                "type": "number"
            },
            "message": "should be number"
        },
        {
            "keyword": "enum",
            "dataPath": ".flow.triggers[2].args[2].type",
            "schemaPath": "#/properties/args/items/oneOf/2/properties/type/enum",
            "params": {
                "allowedValues": [
                    "dropdown"
                ]
            },
            "message": "should be equal to one of the allowed values"
        },
        {
            "keyword": "oneOf",
            "dataPath": ".flow.triggers[2].args[2]",
            "schemaPath": "#/properties/args/items/oneOf",
            "params": {
                "passingSchemas": null
            },
            "message": "should match exactly one schema in oneOf"
        }
    ]
    Not installing, please fix the validation issues first

    Am I making a noob mistake?

    Grtz and thx, Chris
  • UrandayUranday Member
    Hi all,

    I'm totally new with Homey, just started yesterday. As a former Fibaro user I used a lot of variables in my scenes, that I now miss in Homey. So I really want to try this app.

    I've stranded on the install.

    I'm getting this error:

    ✓ Validating app...
    ✘ Homey App did not validate against level `debug`:
    [
        {
            "keyword": "enum",
            "dataPath": ".flow.triggers[2].args[2].type",
            "schemaPath": "#/properties/args/items/oneOf/0/properties/type/enum",
            "params": {
                "allowedValues": [
                    "text",
                    "autocomplete",
                    "device",
                    "date",
                    "time",
                    "color"
                ]
            },
            "message": "should be equal to one of the allowed values"
        },
        {
            "keyword": "type",
            "dataPath": ".flow.triggers[2].args[2].step",
            "schemaPath": "#/properties/args/items/oneOf/1/properties/step/type",
            "params": {
                "type": "number"
            },
            "message": "should be number"
        },
        {
            "keyword": "enum",
            "dataPath": ".flow.triggers[2].args[2].type",
            "schemaPath": "#/properties/args/items/oneOf/2/properties/type/enum",
            "params": {
                "allowedValues": [
                    "dropdown"
                ]
            },
            "message": "should be equal to one of the allowed values"
        },
        {
            "keyword": "oneOf",
            "dataPath": ".flow.triggers[2].args[2]",
            "schemaPath": "#/properties/args/items/oneOf",
            "params": {
                "passingSchemas": null
            },
            "message": "should match exactly one schema in oneOf"
        }
    ]
    Not installing, please fix the validation issues first

    Am I making a noob mistake?

    Grtz and thx, Chris
    What firmware version are you on? 
  • UrandayUranday Member
    Are you installing via the appstore? 
  • SpiritflyerSpiritflyer Member
    edited May 2018
    Ow how stupid of me, I was looking in the appstore under the wrong name.

    I was trying to install it via Node, that didn't go well.
    I now installed it via the Appstore.

    Let's see if this will help me make some flows for my rollerblinds.

    Tnx!
Sign In or Register to comment.