Node-Red And with raw

rules
node-red
node-red-contrib-boo
Tags: #<Tag:0x00007f1829ce1678> #<Tag:0x00007f1829ce1060> #<Tag:0x00007f1829ce0d40>

(Brian M. Pedersen) #1

Hi
I’m trying to make my first node-red rule to test it out. My flow looks like this:

I’m using the “node-red-contrib-bool-gate” to make an “AND” check from the raw object from my xiaomi buttom:
I need a topic and msg. to a value to make it work. From the debug I have:

image
I need to give the topic which I think is "smarthome/items/StButtomTableNodeRed/command"
and the “msg.” path to “SHORT_PRESSED” which I think is : “msg.payload.payload.value” but I can’t make it work.

Please help:!

My flow is below:

[{"id":"359d5c9f.307014","type":"bigtimer","z":"d961fad4.d9dcf8","outtopic":"Darkness","outpayload1":"1","outpayload2":"0","name":"Darkness","lat":"55.6759","lon":"12.5655","starttime":"5004","endtime":"5003","startoff":0,"endoff":0,"offs":0,"outtext1":"","outtext2":"","timeout":1440,"sun":true,"mon":true,"tue":true,"wed":true,"thu":true,"fri":true,"sat":true,"jan":true,"feb":true,"mar":true,"apr":true,"may":true,"jun":true,"jul":true,"aug":true,"sep":true,"oct":true,"nov":true,"dec":true,"day1":0,"month1":0,"day2":0,"month2":0,"day3":0,"month3":0,"day4":0,"month4":0,"day5":0,"month5":0,"d1":0,"w1":0,"d2":0,"w2":0,"d3":0,"w3":0,"d4":0,"w4":0,"d5":0,"w5":0,"suspend":false,"random":false,"repeat":true,"atstart":true,"odd":false,"even":false,"x":438,"y":254,"wires":[["6b1c8072.7825d"],[],[]]},{"id":"6533b5d8.98a6fc","type":"openhab2-in","z":"d961fad4.d9dcf8","name":"","controller":"e6d015f.73ddee8","itemname":"StButtomTableNodeRed","x":322.05554962158203,"y":411.91320991516113,"wires":[[],["6b1c8072.7825d"]]},{"id":"6b1c8072.7825d","type":"and-gate","z":"d961fad4.d9dcf8","name":"","rules":[{"t":"eq","v":"SHORT_PRESSED","vt":"str","propertyType":"msg","property":"value","topic":"smarthome/items/StButtomTableNodeRed/statechanged"},{"t":"eq","v":"1","vt":"str","propertyType":"msg","property":"payload","topic":"Darkness"}],"outputTopic":"","gateType":"and","emitOnlyIfTrue":false,"x":628.0624771118164,"y":341.13195991516113,"wires":[["34e3f665.d3e6aa"]]},{"id":"34e3f665.d3e6aa","type":"openhab2-out","z":"d961fad4.d9dcf8","name":"","controller":"e6d015f.73ddee8","itemname":"Dimmer_Temp_Light_Stue_LED","topic":"","payload":"ON","x":887.0555801391602,"y":341.2534809112549,"wires":[]},{"id":"e6d015f.73ddee8","type":"openhab2-controller","z":"","name":"Openhab","protocol":"http","host":"192.168.1.109","port":"8080","path":"","username":"","password":""}]


(Brian M. Pedersen) #2

I think I found the solution, but I can’t make it work :confused:


(Rgerrans) #3

The topic here based on your output should be “smarthome/items/StButtonTableNodeRed/state”. From the top of my head you should have the msg.payload.payload.value" correct to pull the payload.

I haven’t used the bool gate nodes so don’t know enough about how they work but should probably take a look. I accomplish what you are trying to do by having the BigTimer set a global flow variable which I check when my action occurs using a switch node.


(Elias H.) #4

I will check that. @Moellegaard


(Brian M. Pedersen) #5

Thanks!


(Elias H.) #6

Check this :slight_smile: sorry posted the wrong flow 3 f*** times…

[
    {
        "id": "c55e80c9.cc966",
        "type": "and-gate",
        "z": "713f9364.9c34cc",
        "name": "",
        "rules": [
            {
                "t": "eq",
                "v": "ON",
                "vt": "str",
                "propertyType": "msg",
                "property": "payload",
                "topic": "darkpress"
            },
            {
                "t": "eq",
                "v": "ON",
                "vt": "str",
                "propertyType": "msg",
                "property": "payload",
                "topic": "darkpress1"
            }
        ],
        "outputTopic": "result",
        "gateType": "and",
        "emitOnlyIfTrue": true,
        "x": 624,
        "y": 115,
        "wires": [
            [
                "1db65217.b826ae"
            ]
        ]
    },
    {
        "id": "543a974.a614868",
        "type": "inject",
        "z": "713f9364.9c34cc",
        "name": "",
        "topic": "darkpress",
        "payload": "ON",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 364.5,
        "y": 41,
        "wires": [
            [
                "c55e80c9.cc966"
            ]
        ]
    },
    {
        "id": "33939d4d.674112",
        "type": "inject",
        "z": "713f9364.9c34cc",
        "name": "",
        "topic": "darkpress1",
        "payload": "ON",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 372,
        "y": 163,
        "wires": [
            [
                "c55e80c9.cc966"
            ]
        ]
    },
    {
        "id": "1db65217.b826ae",
        "type": "debug",
        "z": "713f9364.9c34cc",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 812.5,
        "y": 111,
        "wires": []
    },
    {
        "id": "d3ac2556.f603e8",
        "type": "inject",
        "z": "713f9364.9c34cc",
        "name": "",
        "topic": "darkpress",
        "payload": "OFF",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 374,
        "y": 75,
        "wires": [
            [
                "c55e80c9.cc966"
            ]
        ]
    },
    {
        "id": "bfe20cc4.cc186",
        "type": "inject",
        "z": "713f9364.9c34cc",
        "name": "",
        "topic": "darkpress1",
        "payload": "OFF",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 378,
        "y": 202,
        "wires": [
            [
                "c55e80c9.cc966"
            ]
        ]
    },
    {
        "id": "df33c1ae.6f556",
        "type": "and-gate",
        "z": "713f9364.9c34cc",
        "name": "",
        "rules": [
            {
                "t": "eq",
                "v": "SHORT_PRESSED",
                "vt": "str",
                "propertyType": "msg",
                "property": "payload",
                "topic": "press"
            },
            {
                "t": "eq",
                "v": "1",
                "vt": "str",
                "propertyType": "msg",
                "property": "payload",
                "topic": "darkness"
            }
        ],
        "outputTopic": "result",
        "gateType": "and",
        "emitOnlyIfTrue": true,
        "x": 794,
        "y": 470,
        "wires": [
            [
                "b9699419.f27828"
            ]
        ]
    },
    {
        "id": "6b7da549.8680dc",
        "type": "openhab2-in",
        "z": "713f9364.9c34cc",
        "name": "",
        "controller": "4ad6e8ba.17b3c8",
        "itemname": "StButtomTableNodeRed",
        "x": 298,
        "y": 433,
        "wires": [
            [
                "af5c0e5a.f5244"
            ],
            []
        ]
    },
    {
        "id": "af5c0e5a.f5244",
        "type": "change",
        "z": "713f9364.9c34cc",
        "name": "topic=press",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "press",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 529.5,
        "y": 465,
        "wires": [
            [
                "df33c1ae.6f556",
                "32b2cb97.76df24",
                "711a6c80.e7dd04"
            ]
        ]
    },
    {
        "id": "4ee0b322.720eec",
        "type": "bigtimer",
        "z": "713f9364.9c34cc",
        "outtopic": "Darkness",
        "outpayload1": "1",
        "outpayload2": "0",
        "name": "Darkness",
        "lat": "55.6759",
        "lon": "12.5655",
        "starttime": "5004",
        "endtime": "5003",
        "startoff": 0,
        "endoff": 0,
        "offs": 0,
        "outtext1": "",
        "outtext2": "",
        "timeout": 1440,
        "sun": true,
        "mon": true,
        "tue": true,
        "wed": true,
        "thu": true,
        "fri": true,
        "sat": true,
        "jan": true,
        "feb": true,
        "mar": true,
        "apr": true,
        "may": true,
        "jun": true,
        "jul": true,
        "aug": true,
        "sep": true,
        "oct": true,
        "nov": true,
        "dec": true,
        "day1": 0,
        "month1": 0,
        "day2": 0,
        "month2": 0,
        "day3": 0,
        "month3": 0,
        "day4": 0,
        "month4": 0,
        "day5": 0,
        "month5": 0,
        "d1": 0,
        "w1": 0,
        "d2": 0,
        "w2": 0,
        "d3": 0,
        "w3": 0,
        "d4": 0,
        "w4": 0,
        "d5": 0,
        "w5": 0,
        "suspend": false,
        "random": false,
        "repeat": true,
        "atstart": true,
        "odd": false,
        "even": false,
        "x": 240,
        "y": 530,
        "wires": [
            [
                "2df5a17d.98a95e"
            ],
            [],
            []
        ]
    },
    {
        "id": "84711ea3.64b99",
        "type": "inject",
        "z": "713f9364.9c34cc",
        "name": "",
        "topic": "",
        "payload": "SHORT_PRESSED",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 341.5,
        "y": 385,
        "wires": [
            [
                "af5c0e5a.f5244"
            ]
        ]
    },
    {
        "id": "2df5a17d.98a95e",
        "type": "change",
        "z": "713f9364.9c34cc",
        "name": "topic=darkness",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "darkness",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 501,
        "y": 594,
        "wires": [
            [
                "df33c1ae.6f556",
                "32b2cb97.76df24",
                "711a6c80.e7dd04"
            ]
        ]
    },
    {
        "id": "a9e2551b.172dc8",
        "type": "inject",
        "z": "713f9364.9c34cc",
        "name": "",
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 239,
        "y": 605,
        "wires": [
            [
                "2df5a17d.98a95e"
            ]
        ]
    },
    {
        "id": "b9699419.f27828",
        "type": "debug",
        "z": "713f9364.9c34cc",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 977,
        "y": 465,
        "wires": []
    },
    {
        "id": "32b2cb97.76df24",
        "type": "debug",
        "z": "713f9364.9c34cc",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 855,
        "y": 643,
        "wires": []
    },
    {
        "id": "711a6c80.e7dd04",
        "type": "debug",
        "z": "713f9364.9c34cc",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "topic",
        "x": 783,
        "y": 330,
        "wires": []
    },
    {
        "id": "4ad6e8ba.17b3c8",
        "type": "openhab2-controller",
        "z": "",
        "name": "Openhab",
        "protocol": "http",
        "host": "192.168.1.109",
        "port": "8080",
        "path": "",
        "username": "",
        "password": ""
    }
]

(Brian M. Pedersen) #7

@rgerrans I tried your suggestions, but it still doesn’t work

pimage

I found if I use channel 1, and use the change function I can make it work like this:

image

But then I would need to add a change for every AND node


(Brian M. Pedersen) #8

Yeah the code gives some problems with the preformatted text function somehow, but thanks, I found that adding the topic works, but if I could avoid this it would be nice.


(Elias H.) #9

find out what topic your current items are sending. And add those to the AND gate?


(Brian M. Pedersen) #10

I would like to be able to get the topic and value directly from the item and use them in the gate function.


(Elias H.) #11

Yes? thats what I suggested you try… But a debug node behind your item and behind the BigTimer which listens to msg.topic.

[
    {
        "id": "25225fe6.142bb",
        "type": "debug",
        "z": "1157e9d2.2b5ef6",
        "name": "show topic",
        "active": false,
        "console": "false",
        "complete": "topic",
        "x": 1255.8333740234375,
        "y": 65.5833511352539,
        "wires": []
    }
]

If you know the 2 Topics add them to the AND gate.


(Brian M. Pedersen) #12

What a nice simple check :slight_smile:
I’m very new to Node-red I like to add :slight_smile:

This is what I get back from the console with channel 1

11/3/2017, 2:50:43 PMnode: show topic
msg.topic : undefined
undefined

With the raw channel, there is no topic at all. I think I need an other approach, thanks a lot for you assistance.


(Rgerrans) #13

It’s been way too long since I used the raw channel. Try using a change node to move msg.payload.topic to msg.topic.

Or another guess would be to use a json node to convert it but I don’t think that’s right. If you don’t get it working today I should have some time this weekend to reininstall the OH nodes and play with it.


(Elias H.) #14

You can simply add a topic
Example.

[
    {
        "id": "5d41169f.1740d8",
        "type": "inject",
        "z": "5d5cf423.6ade0c",
        "name": "",
        "topic": "",
        "payload": "ON",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 304.5,
        "y": 83,
        "wires": [
            [
                "32aad1b9.aeb46e",
                "f00911bd.db0d7"
            ]
        ]
    },
    {
        "id": "ecb43db1.83819",
        "type": "inject",
        "z": "5d5cf423.6ade0c",
        "name": "",
        "topic": "",
        "payload": "OFF",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 311,
        "y": 177,
        "wires": [
            [
                "a82d60c.a0ecca",
                "10037b8c.bf0924"
            ]
        ]
    },
    {
        "id": "9f1adc68.6e75a",
        "type": "inject",
        "z": "5d5cf423.6ade0c",
        "name": "",
        "topic": "",
        "payload": "ON",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 312,
        "y": 212,
        "wires": [
            [
                "a82d60c.a0ecca",
                "10037b8c.bf0924"
            ]
        ]
    },
    {
        "id": "21ba8dcc.27d402",
        "type": "inject",
        "z": "5d5cf423.6ade0c",
        "name": "",
        "topic": "",
        "payload": "OFF",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 306,
        "y": 116,
        "wires": [
            [
                "32aad1b9.aeb46e",
                "f00911bd.db0d7"
            ]
        ]
    },
    {
        "id": "32aad1b9.aeb46e",
        "type": "change",
        "z": "5d5cf423.6ade0c",
        "name": "topic=1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 442.5,
        "y": 93,
        "wires": [
            [
                "837cc81d.6109c8",
                "db2fde4a.eb5e2"
            ]
        ]
    },
    {
        "id": "a82d60c.a0ecca",
        "type": "change",
        "z": "5d5cf423.6ade0c",
        "name": "topic=2",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "2",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 450,
        "y": 190,
        "wires": [
            [
                "837cc81d.6109c8",
                "4354721a.9044ec"
            ]
        ]
    },
    {
        "id": "837cc81d.6109c8",
        "type": "and-gate",
        "z": "5d5cf423.6ade0c",
        "name": "",
        "rules": [
            {
                "t": "eq",
                "v": "ON",
                "vt": "str",
                "propertyType": "msg",
                "property": "payload",
                "topic": "1"
            },
            {
                "t": "eq",
                "v": "ON",
                "vt": "str",
                "propertyType": "msg",
                "property": "payload",
                "topic": "2"
            }
        ],
        "outputTopic": "",
        "gateType": "and",
        "emitOnlyIfTrue": false,
        "x": 601.5,
        "y": 134,
        "wires": [
            [
                "a579feb5.7d073"
            ]
        ]
    },
    {
        "id": "a579feb5.7d073",
        "type": "debug",
        "z": "5d5cf423.6ade0c",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 753.5,
        "y": 134,
        "wires": []
    },
    {
        "id": "f00911bd.db0d7",
        "type": "debug",
        "z": "5d5cf423.6ade0c",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "topic",
        "x": 441,
        "y": 39,
        "wires": []
    },
    {
        "id": "db2fde4a.eb5e2",
        "type": "debug",
        "z": "5d5cf423.6ade0c",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "topic",
        "x": 608,
        "y": 44,
        "wires": []
    },
    {
        "id": "10037b8c.bf0924",
        "type": "debug",
        "z": "5d5cf423.6ade0c",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "topic",
        "x": 439,
        "y": 252,
        "wires": []
    },
    {
        "id": "4354721a.9044ec",
        "type": "debug",
        "z": "5d5cf423.6ade0c",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "topic",
        "x": 630,
        "y": 235,
        "wires": []
    }
]

I think I know what you try to do.
you got a Xiamoi Wirless Button and want a click to trigger something.

I done it like this.

I created a rule_item just for the Xiamoi Button because I had the same problem with the channel.

Switch v_Switch_Outdoor_Xiaomi_VirtualSwitch "switch for xiaomi wireless button"

Then I created a rule which just switched the rule_item.
And used THAT item with node-red.
A bit of brain f*** I know :smiley:

rule "Xiaomi Switch"

when
        Channel "mihome:sensor_switch:158d00014a0770:button" triggered

then
        var actionName = receivedEvent.getEvent()
        switch(actionName) {
            case "SHORT_PRESSED": {
            if (v_Switch_Outdoor_Xiaomi_VirtualSwitch.state==ON) {
                    sendCommand(v_Switch_Outdoor_Xiaomi_VirtualSwitch, OFF)
                }
                else {
                    sendCommand(v_Switch_Outdoor_Xiaomi_VirtualSwitch, ON)
                }
            }

            case "DOUBLE_PRESSED": {
            //v_Switch_Outdoor_Xiaomi_Ruleoverwrite
            if (v_Switch_Outdoor_Xiaomi_VirtualSwitch.state==ON) {
               sendCommand(v_Switch_Outdoor_Xiaomi_VirtualSwitch, OFF)
            }
            else {
                 sendCommand(v_Switch_Outdoor_Xiaomi_VirtualSwitch, ON)
                 }
           }


//          case "LONG_PRESSED": {
//          }
//
//          case "LONG_RELEASED": {
//          }

        }

end

(Elias H.) #15

The problem with the Xiaomi Wireless Button is, it has no state. With my brainF*** workaround it gets a state.
Maybe there is a better solution but this works fine for me :slight_smile:

wupsyyy just noticed this…


(Brian M. Pedersen) #16

Yes, it anoying, I made this rule, it’s a bit simpler:

rule "button Door"
when
Channel “mihome:sensor_switch:158d00015825b1:button” triggered
then

var actionName = receivedEvent.getEvent()
StButtomTableNodeRed.sendCommand(actionName)

end

I check and all event are transfered to the proxy item(StButtomTableNodeRed)

but I would really like if the Openhab Items had a topic of any kind. So I contnue with this solution:

[{“id”:“fa8c489a.235eb8”,“type”:“tab”,“label”:“Flow 5”},{“id”:“717f419a.a7573”,“type”:“openhab2-in”,“z”:“fa8c489a.235eb8”,“name”:"",“controller”:“e6d015f.73ddee8”,“itemname”:“SwNoteRedTest”,“x”:352,“y”:336,“wires”:[[“d1f744ed.1b7dd8”,“ac5de9d0.90c198”,“92368f86.7e45c”,“2367cff5.3e19”],[]]},{“id”:“77eb7a0c.8fdc54”,“type”:“debug”,“z”:“fa8c489a.235eb8”,“name”:"",“active”:true,“console”:“false”,“complete”:“payload”,“x”:748,“y”:339,“wires”:[]},{“id”:“2367cff5.3e19”,“type”:“and-gate”,“z”:“fa8c489a.235eb8”,“name”:"",“rules”:[{“t”:“eq”,“v”:“ON”,“vt”:“str”,“propertyType”:“msg”,“property”:“payload.payload.value”,“topic”:“undefined”}],“outputTopic”:"",“gateType”:“and”,“emitOnlyIfTrue”:false,“x”:600,“y”:612,“wires”:[[]]},{“id”:“8f9b65a6.dd7e78”,“type”:“inject”,“z”:“fa8c489a.235eb8”,“name”:"",“topic”:“smarthome/items/SwNoteRedTest/statechanged”,“payload”:“ON”,“payloadType”:“str”,“repeat”:"",“crontab”:"",“once”:false,“x”:319,“y”:630,“wires”:[[“2367cff5.3e19”]]},{“id”:“d1f744ed.1b7dd8”,“type”:“change”,“z”:“fa8c489a.235eb8”,“name”:"",“rules”:[{“t”:“set”,“p”:“topic”,“pt”:“msg”,“to”:“item”,“tot”:“msg”}],“action”:"",“property”:"",“from”:"",“to”:"",“reg”:false,“x”:507,“y”:266,“wires”:[[“77eb7a0c.8fdc54”,“d58215d6.96fe08”]]},{“id”:“ac5de9d0.90c198”,“type”:“debug”,“z”:“fa8c489a.235eb8”,“name”:“show topic”,“active”:false,“console”:“false”,“complete”:“topic”,“x”:632,“y”:528,“wires”:[]},{“id”:“92368f86.7e45c”,“type”:“debug”,“z”:“fa8c489a.235eb8”,“name”:"",“active”:false,“console”:“false”,“complete”:“true”,“x”:628,“y”:428,“wires”:[]},{“id”:“d58215d6.96fe08”,“type”:“and-gate”,“z”:“fa8c489a.235eb8”,“name”:"",“rules”:[{“t”:“eq”,“v”:“ON”,“vt”:“str”,“propertyType”:“msg”,“property”:“payload”,“topic”:“SwNoteRedTest”}],“outputTopic”:"",“gateType”:“and”,“emitOnlyIfTrue”:false,“x”:740,“y”:251,“wires”:[[]]},{“id”:“e6d015f.73ddee8”,“type”:“openhab2-controller”,“z”:"",“name”:“Openhab”,“protocol”:“http”,“host”:“192.168.1.109”,“port”:“8080”,“path”:"",“username”:"",“password”:""}]

But im thinking about setting up a mqtt for transferring the items like this, then I can have the extra control with topics. e.g. having the type “switch”, “Number” e.g. maybe…


(Elias H.) #17
[
    {
        "id": "8608610d.ec182",
        "type": "bigtimer",
        "z": "141bd0c8.ae72df",
        "outtopic": "Darkness",
        "outpayload1": "1",
        "outpayload2": "0",
        "name": "Darkness",
        "lat": "55.6759",
        "lon": "12.5655",
        "starttime": "5004",
        "endtime": "5003",
        "startoff": 0,
        "endoff": 0,
        "offs": 0,
        "outtext1": "",
        "outtext2": "",
        "timeout": 1440,
        "sun": true,
        "mon": true,
        "tue": true,
        "wed": true,
        "thu": true,
        "fri": true,
        "sat": true,
        "jan": true,
        "feb": true,
        "mar": true,
        "apr": true,
        "may": true,
        "jun": true,
        "jul": true,
        "aug": true,
        "sep": true,
        "oct": true,
        "nov": true,
        "dec": true,
        "day1": 0,
        "month1": 0,
        "day2": 0,
        "month2": 0,
        "day3": 0,
        "month3": 0,
        "day4": 0,
        "month4": 0,
        "day5": 0,
        "month5": 0,
        "d1": 0,
        "w1": 0,
        "d2": 0,
        "w2": 0,
        "d3": 0,
        "w3": 0,
        "d4": 0,
        "w4": 0,
        "d5": 0,
        "w5": 0,
        "suspend": false,
        "random": false,
        "repeat": true,
        "atstart": true,
        "odd": false,
        "even": false,
        "x": 226,
        "y": 82,
        "wires": [
            [
                "92d3a16a.3c787",
                "57133786.2aee78",
                "ff944e81.b40e6"
            ],
            [],
            []
        ]
    },
    {
        "id": "1b13faad.87ba15",
        "type": "openhab2-in",
        "z": "141bd0c8.ae72df",
        "name": "",
        "controller": "17be1442.ca2f2c",
        "itemname": "StButtomTableNodeRed",
        "x": 244.0555419921875,
        "y": 306.9132080078125,
        "wires": [
            [],
            [
                "c407b89c.fa0ec8",
                "86772cd1.f3abb",
                "43987f1d.9f9c6"
            ]
        ]
    },
    {
        "id": "6b75f75b.f37638",
        "type": "and-gate",
        "z": "141bd0c8.ae72df",
        "name": "",
        "rules": [
            {
                "t": "eq",
                "v": "SHORT_PRESSED",
                "vt": "str",
                "propertyType": "msg",
                "property": "value",
                "topic": "1"
            },
            {
                "t": "eq",
                "v": "1",
                "vt": "str",
                "propertyType": "msg",
                "property": "payload",
                "topic": "2"
            }
        ],
        "outputTopic": "",
        "gateType": "and",
        "emitOnlyIfTrue": true,
        "x": 613.0624771118164,
        "y": 218.13195991516113,
        "wires": [
            [
                "69cfb12e.6dded"
            ]
        ]
    },
    {
        "id": "69cfb12e.6dded",
        "type": "openhab2-out",
        "z": "141bd0c8.ae72df",
        "name": "",
        "controller": "17be1442.ca2f2c",
        "itemname": "Dimmer_Temp_Light_Stue_LED",
        "topic": "",
        "payload": "ON",
        "x": 872.0555801391602,
        "y": 218.25348091125488,
        "wires": []
    },
    {
        "id": "92d3a16a.3c787",
        "type": "change",
        "z": "141bd0c8.ae72df",
        "name": "topic=2",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "2",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 394.5,
        "y": 130,
        "wires": [
            [
                "6b75f75b.f37638",
                "4037b0cb.e3d79",
                "cf5faaf7.a9b338"
            ]
        ]
    },
    {
        "id": "c407b89c.fa0ec8",
        "type": "change",
        "z": "141bd0c8.ae72df",
        "name": "topic=1",
        "rules": [
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "1",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 406,
        "y": 240,
        "wires": [
            [
                "6b75f75b.f37638",
                "932020fc.4e97",
                "80886bd8.3e6de8"
            ]
        ]
    },
    {
        "id": "86772cd1.f3abb",
        "type": "debug",
        "z": "141bd0c8.ae72df",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 451.5,
        "y": 349,
        "wires": []
    },
    {
        "id": "43987f1d.9f9c6",
        "type": "debug",
        "z": "141bd0c8.ae72df",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "topic",
        "x": 436,
        "y": 386,
        "wires": []
    },
    {
        "id": "932020fc.4e97",
        "type": "debug",
        "z": "141bd0c8.ae72df",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 636,
        "y": 283,
        "wires": []
    },
    {
        "id": "80886bd8.3e6de8",
        "type": "debug",
        "z": "141bd0c8.ae72df",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "topic",
        "x": 620.5,
        "y": 320,
        "wires": []
    },
    {
        "id": "57133786.2aee78",
        "type": "debug",
        "z": "141bd0c8.ae72df",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 440,
        "y": 47,
        "wires": []
    },
    {
        "id": "ff944e81.b40e6",
        "type": "debug",
        "z": "141bd0c8.ae72df",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "topic",
        "x": 424.5,
        "y": 84,
        "wires": []
    },
    {
        "id": "4037b0cb.e3d79",
        "type": "debug",
        "z": "141bd0c8.ae72df",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "false",
        "x": 612,
        "y": 99,
        "wires": []
    },
    {
        "id": "cf5faaf7.a9b338",
        "type": "debug",
        "z": "141bd0c8.ae72df",
        "name": "",
        "active": true,
        "console": "false",
        "complete": "topic",
        "x": 596.5,
        "y": 136,
        "wires": []
    },
    {
        "id": "17be1442.ca2f2c",
        "type": "openhab2-controller",
        "z": "",
        "name": "Openhab",
        "protocol": "http",
        "host": "192.168.1.109",
        "port": "8080",
        "path": "",
        "username": "",
        "password": ""
    }
]

Please try this.
Check what payload is send by StButtomTableNodeRed and report back please.
Or post the whole debug log. That would help very much


(Brian M. Pedersen) #18

thanks, but I have a working solution :slight_smile:
I just wish I a topic that I could use directly from OH item.

I’m not able to test the buttom at the moment, so if you want to see my test senario, you it here, it based on you suggestion but I needed to have the “and gate”-note set to payload for both input notes.

[{“id”:“3beede20.2a5162”,“type”:“openhab2-in”,“z”:“7815450d.2de7ec”,“name”:"",“controller”:“e6d015f.73ddee8”,“itemname”:“SwNoteRedTest”,“x”:987,“y”:249,“wires”:[[“d1f28535.7ccf88”],[]]},{“id”:“2da3c6c.f70303a”,“type”:“debug”,“z”:“7815450d.2de7ec”,“name”:"",“active”:true,“console”:“false”,“complete”:“payload”,“x”:1383,“y”:252,“wires”:[]},{“id”:“d1f28535.7ccf88”,“type”:“change”,“z”:“7815450d.2de7ec”,“name”:"",“rules”:[{“t”:“set”,“p”:“topic”,“pt”:“msg”,“to”:“item”,“tot”:“msg”}],“action”:"",“property”:"",“from”:"",“to”:"",“reg”:false,“x”:1017,“y”:113,“wires”:[[“2da3c6c.f70303a”,“d97f3399.c8b93”]]},{“id”:“d97f3399.c8b93”,“type”:“and-gate”,“z”:“7815450d.2de7ec”,“name”:"",“rules”:[{“t”:“eq”,“v”:“ON”,“vt”:“str”,“propertyType”:“msg”,“property”:“payload”,“topic”:“SwNoteRedTest”},{“t”:“eq”,“v”:“0”,“vt”:“str”,“propertyType”:“msg”,“property”:“payload”,“topic”:“Darkness”}],“outputTopic”:"",“gateType”:“and”,“emitOnlyIfTrue”:false,“x”:1375,“y”:164,“wires”:[[]]},{“id”:“1b760db2.7d3002”,“type”:“bigtimer”,“z”:“7815450d.2de7ec”,“outtopic”:“Darkness”,“outpayload1”:“1”,“outpayload2”:“0”,“name”:“Darkness”,“lat”:“55.6759”,“lon”:“12.5655”,“starttime”:“5004”,“endtime”:“5003”,“startoff”:0,“endoff”:0,“offs”:0,“outtext1”:"",“outtext2”:"",“timeout”:1440,“sun”:true,“mon”:true,“tue”:true,“wed”:true,“thu”:true,“fri”:true,“sat”:true,“jan”:true,“feb”:true,“mar”:true,“apr”:true,“may”:true,“jun”:true,“jul”:true,“aug”:true,“sep”:true,“oct”:true,“nov”:true,“dec”:true,“day1”:0,“month1”:0,“day2”:0,“month2”:0,“day3”:0,“month3”:0,“day4”:0,“month4”:0,“day5”:0,“month5”:0,“d1”:0,“w1”:0,“d2”:0,“w2”:0,“d3”:0,“w3”:0,“d4”:0,“w4”:0,“d5”:0,“w5”:0,“suspend”:false,“random”:false,“repeat”:true,“atstart”:true,“odd”:false,“even”:false,“x”:1184,“y”:408,“wires”:[[“d97f3399.c8b93”],[],[]]},{“id”:“e6d015f.73ddee8”,“type”:“openhab2-controller”,“z”:"",“name”:“Openhab”,“protocol”:“http”,“host”:“192.168.1.109”,“port”:“8080”,“path”:"",“username”:"",“password”:""}]


(Brian M. Pedersen) #19

Did you by any chance make some of the xiaomi node-red “bindings” work?


(Elias H.) #20

Don’t know why. But I can’t import your code.