# Little problem with flow / function

**URL:** <https://discourse.nodered.org/t/little-problem-with-flow-function/70997>\
**Category:** General\
**Created:** [21 November 2022 16:57 UTC](https://discourse.nodered.org/t/little-problem-with-flow-function/70997 "2022-11-21T16:57:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rimmel](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@rimmel](https://discourse.nodered.org/u/rimmel)\
**Post date:** [21 November 2022 16:57 UTC](https://discourse.nodered.org/t/little-problem-with-flow-function/70997/1 "2022-11-21T16:57:36Z")

</div>

Hi,  
i´m new to node-red and new to this forum.  
until now i´m using domoticz with zigbee, mqtt and wifi.

since a few days i try to set up my new sonoff NSPanel. the two relais buttons are no problem and working fine with domoticz.  
my issues started with the touch panel / touch buttons.

in the screenshot i got a, more or less, working flow.  
i got the information from my domoticz, the idx of my device.

which leads into the following function:

```auto
{
    "type": "object",
    "properties": {
        "payload.nvalue": { "type": "string" }
     },
     "if": {
        "properties": {
            "payload.nvalue": { 
              "enum": ["1"] 
            }
        }
    },
    "then": { 
      "relation":[{"id":"1","online":true,"params":{"switch":"on"}}]
    }
}

```

in general it seems that the command arrives at the nspanel, and is switching. but it seems that both functions, on and off, were triggert both and so it happen that the button will turn on and after a second off again.  
it happen if i toggle the button, on or off, both trigger both functions. so turn on -\> nspanel button will go on and off after a second.

hope someone can help me to fix it, would be really great.

 ![DomoFlow](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/f/6f517be015c2ddc1813d7ee2db0dc2c5ad3c3d32.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [21 November 2022 17:15 UTC](https://discourse.nodered.org/t/little-problem-with-flow-function/70997/2 "2022-11-21T17:15:56Z")

</div>

That does not appear to be a node-red function. Where does that function definition go?

---

<div class="post-metadata">

**Author:** ![rimmel](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@rimmel](https://discourse.nodered.org/u/rimmel)\
**Post date:** [21 November 2022 17:18 UTC](https://discourse.nodered.org/t/little-problem-with-flow-function/70997/3 "2022-11-21T17:18:50Z")

</div>

Hi,

after i tried some little other things, or better the other direction i got it ...

i added two switches between idx and the functions.

 ![domoflow_1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/4/44545aba0f839b4bb30ecbd19ca408dcf46d05bc.png)

this is how it works.

now i can toggle the button in my domoticz and through node red it will be toggled on my nspanel touch screen.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [20 January 2023 17:19 UTC](https://discourse.nodered.org/t/little-problem-with-flow-function/70997/4 "2023-01-20T17:19:19Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
