# Philips Hue Tap Flow

**URL:** <https://discourse.nodered.org/t/philips-hue-tap-flow/85423>\
**Category:** General\
**Tags:** function-node\
**Created:** [11 February 2024 17:00 UTC](https://discourse.nodered.org/t/philips-hue-tap-flow/85423 "2024-02-11T17:00:37Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![wise3](https://avatars.discourse-cdn.com/v4/letter/w/49beb7/32.png) [@wise3](https://discourse.nodered.org/u/wise3)\
**Post date:** [11 February 2024 17:00 UTC](https://discourse.nodered.org/t/philips-hue-tap-flow/85423/1 "2024-02-11T17:00:37Z")

</div>

Hello,  
i'm trying to adapt this excellent node flow

[https://flows.nodered.org/flow/c95d562d4858cbe1bf80fee95ba9815f?fbclid=IwAR3-tjjPPwWiTE-3W0XmurX5JN5mSCBqfY0aCg3RswcNnhLhnA-fgM-mgwk](https://flows.nodered.org/flow/c95d562d4858cbe1bf80fee95ba9815f?fbclid=IwAR3-tjjPPwWiTE-3W0XmurX5JN5mSCBqfY0aCg3RswcNnhLhnA-fgM-mgwk) to convert it to my own device controlled by Z2M but I can't get anywhere because I'm too much of a novice :-(.  
What I'd like is if the music is playing on the Sonos "Move" and I turn the knob left or right, the volume adapts.  
If I press Button 4 and within 3 seconds I turn the wheel left or right, then the brightness decreases or increases.  
However, the values I take from the Dial and manipulate in the functions don't work properly.  
Could someone please help me ☹

Below is "my" Flow, which is a bit of a mess ☹

I can't upload my Json file and if i copy paste my Json Flow i have a 422 error ☹ and don't know how to add this. I try also to upload file but not authorize.  
[Flow Hue Dial 5\_05\_Avec Dim et Volume chgt mais chaotique.json](https://discourse.nodered.org/uploads/short-url/oSCE0My3RaWACRfLVSp1Xq2KkGS.json) (68.2 KB)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [11 February 2024 19:45 UTC](https://discourse.nodered.org/t/philips-hue-tap-flow/85423/2 "2024-02-11T19:45:00Z")

</div>

I've just set you as a new user, see if you can upload your flow now.

---

<div class="post-metadata">

**Author:** ![wise3](https://avatars.discourse-cdn.com/v4/letter/w/49beb7/32.png) [@wise3](https://discourse.nodered.org/u/wise3)\
**Post date:** [11 February 2024 20:08 UTC](https://discourse.nodered.org/t/philips-hue-tap-flow/85423/3 "2024-02-11T20:08:05Z")

</div>

Hello, Thank you very much for your help 🙂

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [11 February 2024 20:23 UTC](https://discourse.nodered.org/t/philips-hue-tap-flow/85423/4 "2024-02-11T20:23:38Z")

</div>

Hi @wise3

So, problem.

This is what the average user will see when they import your flow:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/7/c734c1e245bc9568c3b6bb1e212a6f1dd889a115.png)

(I had to zoom out there is that much!)

1. Not that many of us here use Home automation.
  - thats why you see lots of red dotted wires and unknown nodes
  - and even if we did, we do NOT have you configuration or your HA server or your physical equipment

2. We don't have access to your MQTT broker so we have no idea what values pass through your flows
3. You have exported a HUGE flow - is it _REALLY_ necessary?

If you want help, I suspect you will need to

- break this down into the smallest possible flow that demonstrates your need.
- remove HA and MQTT nodes and replace them with `change` or `inject` nodes that _simulate_ your HA and MQTT values
- tell us what values you expect to be output from a given input.

Hope that helps.

---

<div class="post-metadata">

**Author:** ![wise3](https://avatars.discourse-cdn.com/v4/letter/w/49beb7/32.png) [@wise3](https://discourse.nodered.org/u/wise3)\
**Post date:** [11 February 2024 20:43 UTC](https://discourse.nodered.org/t/philips-hue-tap-flow/85423/5 "2024-02-11T20:43:03Z")

</div>

Hi [Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)

First of all, thank you for taking the time to read. Because as you can see, the flow is VERY big :-(.  
If I've left all the nodes, it's because I thought it might be useful to see all my tests... But I have to admit that I'm "afraid" of deleting some of them.  
I thought it would be easy to replace the Mqtt server for "helper" and then put device type identical to mine, i.e. theSonos Move et The Philips Tap Dial ( [https://www.zigbee2mqtt.io/devices/8719514440937\_8719514440999.html#philips-8719514440937%252F8719514440999](https://www.zigbee2mqtt.io/devices/8719514440937_8719514440999.html#philips-8719514440937%252F8719514440999) ) and a light controller[https://www.zigbee2mqtt.io/devices/TS0505B\_1.html#tuya-ts0505b\_1](https://www.zigbee2mqtt.io/devices/TS0505B_1.html#tuya-ts0505b_1)

I can try to remove some nodes, but as I know that some nodes may be useful for taking over a variable, I'm afraid of deleting some of them.

I've been trying in vain for over 1 month to convert this flow for use with my type of device and I must admit I'm desperate lol

Here here it is a printscreen with the name of my node

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/8/b80122af26b4cf43d98fb7bd05f16c5610f07b05.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:** [11 February 2024 21:35 UTC](https://discourse.nodered.org/t/philips-hue-tap-flow/85423/6 "2024-02-11T21:35:08Z")

</div>

> [@wise3](#):
>
> I can try to remove some nodes

You don't need to remove nodes. Just select the few important nodes, copy them, and paste them into a new flow tab. Then, on that tab, add the inject and debug nodes etc so that you can demonstrate the problem. Then mark those nodes and export them to the clipboard and paste them here as described in this canned text:

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote `````)

````auto
``` 
   code goes here 
```

````

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<div class="post-metadata">

**Author:** ![wise3](https://avatars.discourse-cdn.com/v4/letter/w/49beb7/32.png) [@wise3](https://discourse.nodered.org/u/wise3)\
**Post date:** [11 February 2024 22:01 UTC](https://discourse.nodered.org/t/philips-hue-tap-flow/85423/7 "2024-02-11T22:01:07Z")

</div>

Hello Colin

I've isolated a "behavior" that I'd like to control with the Philips Hue wheel. This behavior is the color temperature, which ranges from Warm White (500) to Cool White (153).  
At the moment, I can only switch from Warm White to Cool White with a single step. But I'd like it to decrease or increase by 2, for example, each time I turn the dial.

I can see that this exists but I can't put it into practice.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/d/3d00ad7eec73ff802079bf5afe24981f5bdb920a.png)

```auto
[
    {
        "id": "33f7254cd40140ee",
        "type": "inject",
        "z": "8d595d2b5ddfea11",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "dial_rotate_right_step",
        "payloadType": "str",
        "x": 200,
        "y": 260,
        "wires": [
            [
                "f7fb988ebf4c67e3"
            ]
        ]
    },
    {
        "id": "f7fb988ebf4c67e3",
        "type": "switch",
        "z": "8d595d2b5ddfea11",
        "name": "Switch on Dial Rotate Right",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "dial_rotate_right_step",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "dial_rotate_right_slow",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "dial_rotate_right_fast",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 3,
        "x": 490,
        "y": 340,
        "wires": [
            [
                "3353c06cab4d553b"
            ],
            [
                "3353c06cab4d553b"
            ],
            [
                "3353c06cab4d553b"
            ]
        ]
    },
    {
        "id": "95235b012bad7d34",
        "type": "switch",
        "z": "8d595d2b5ddfea11",
        "name": "Switch on Dial Rotate Left",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "dial_rotate_left_step",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "dial_rotate_left_slow",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "dial_rotate_left_fast",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 3,
        "x": 470,
        "y": 420,
        "wires": [
            [
                "2ca7525c925a19fb"
            ],
            [
                "2ca7525c925a19fb"
            ],
            [
                "2ca7525c925a19fb"
            ]
        ]
    },
    {
        "id": "f9e473071b383bf0",
        "type": "inject",
        "z": "8d595d2b5ddfea11",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "dial_rotate_left_step",
        "payloadType": "str",
        "x": 190,
        "y": 540,
        "wires": [
            [
                "95235b012bad7d34"
            ]
        ]
    },
    {
        "id": "3353c06cab4d553b",
        "type": "api-call-service",
        "z": "8d595d2b5ddfea11",
        "name": "Light UP",
        "server": "92ab386eaaffa3ef",
        "version": 5,
        "debugenabled": false,
        "domain": "light",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "light.zig"
        ],
        "data": "{\t \"color_temp\": 500}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1120,
        "y": 180,
        "wires": [
            [
                "7436f915208cbde6"
            ]
        ]
    },
    {
        "id": "2ca7525c925a19fb",
        "type": "api-call-service",
        "z": "8d595d2b5ddfea11",
        "name": "Light Down",
        "server": "92ab386eaaffa3ef",
        "version": 5,
        "debugenabled": false,
        "domain": "light",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "light.zig"
        ],
        "data": "{\t \"color_temp\": 153}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1130,
        "y": 520,
        "wires": [
            [
                "fdc460fab1aa2204"
            ]
        ]
    },
    {
        "id": "7436f915208cbde6",
        "type": "debug",
        "z": "8d595d2b5ddfea11",
        "name": "WarmColor",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1320,
        "y": 180,
        "wires": []
    },
    {
        "id": "fdc460fab1aa2204",
        "type": "debug",
        "z": "8d595d2b5ddfea11",
        "name": "Coldcolor",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1300,
        "y": 520,
        "wires": []
    },
    {
        "id": "92ab386eaaffa3ef",
        "type": "server",
        "name": "Home Assistant",
        "version": 5,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30",
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": ": ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "default",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": false
    }
]

```

---

<div class="post-metadata">

**Author:** ![wise3](https://avatars.discourse-cdn.com/v4/letter/w/49beb7/32.png) [@wise3](https://discourse.nodered.org/u/wise3)\
**Post date:** [12 February 2024 21:47 UTC](https://discourse.nodered.org/t/philips-hue-tap-flow/85423/8 "2024-02-12T21:47:33Z")

</div>

Hello,

i progress a little 🙂 Not alone with help of ChatGPT but don't replace help of all of you expert.

But don't know if i use correctly the state and use to much ressource. May be there are nodes which don't be reason for existing.  
No i must find a way if the light is not "ON", it switch on this one at the correct temp color.

```auto
[
    {
        "id": "8d595d2b5ddfea11",
        "type": "tab",
        "label": "TestTemperature",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "33f7254cd40140ee",
        "type": "inject",
        "z": "8d595d2b5ddfea11",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "dial_rotate_right_step",
        "payloadType": "str",
        "x": 280,
        "y": 460,
        "wires": [
            [
                "f7fb988ebf4c67e3"
            ]
        ]
    },
    {
        "id": "f7fb988ebf4c67e3",
        "type": "switch",
        "z": "8d595d2b5ddfea11",
        "name": "Switch on Dial Rotate Right",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "dial_rotate_right_step",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "dial_rotate_right_slow",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "dial_rotate_right_fast",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 3,
        "x": 570,
        "y": 540,
        "wires": [
            [
                "493c92ddcccf8207"
            ],
            [
                "493c92ddcccf8207"
            ],
            [
                "493c92ddcccf8207"
            ]
        ]
    },
    {
        "id": "95235b012bad7d34",
        "type": "switch",
        "z": "8d595d2b5ddfea11",
        "name": "Switch on Dial Rotate Left",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "dial_rotate_left_step",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "dial_rotate_left_slow",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "dial_rotate_left_fast",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 3,
        "x": 550,
        "y": 620,
        "wires": [
            [
                "64b398cce0301e19"
            ],
            [
                "64b398cce0301e19"
            ],
            [
                "64b398cce0301e19"
            ]
        ]
    },
    {
        "id": "f9e473071b383bf0",
        "type": "inject",
        "z": "8d595d2b5ddfea11",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "dial_rotate_left_step",
        "payloadType": "str",
        "x": 270,
        "y": 740,
        "wires": [
            [
                "95235b012bad7d34"
            ]
        ]
    },
    {
        "id": "3353c06cab4d553b",
        "type": "api-call-service",
        "z": "8d595d2b5ddfea11",
        "name": "Light UP",
        "server": "92ab386eaaffa3ef",
        "version": 5,
        "debugenabled": false,
        "domain": "light",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "light.zig"
        ],
        "data": "payload",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1220,
        "y": 420,
        "wires": [
            [
                "8f2317f90cb7781a"
            ]
        ]
    },
    {
        "id": "7436f915208cbde6",
        "type": "debug",
        "z": "8d595d2b5ddfea11",
        "name": "WarmColor",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1590,
        "y": 440,
        "wires": []
    },
    {
        "id": "fdc460fab1aa2204",
        "type": "debug",
        "z": "8d595d2b5ddfea11",
        "name": "Coldcolor",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1440,
        "y": 720,
        "wires": []
    },
    {
        "id": "e5179f6abd6ab5ec",
        "type": "function",
        "z": "8d595d2b5ddfea11",
        "name": "GoToWarm",
        "func": "// Récupérer la valeur actuelle de \"color_temp\" depuis le contexte\n//var currentColorTemp = context.get('currentColorTemp') || 154;\nvar currentColorTemp = flow.get('Temp') || 154;\n// Ajouter 10 à la valeur actuelle de \"color_temp\"\nvar newColorTemp = currentColorTemp + 32;\n\n// Limiter la nouvelle valeur de \"color_temp\" à 500\nnewColorTemp = Math.min(newColorTemp, 500);\n\n// Mettre à jour la valeur de \"color_temp\" dans le contexte\ncontext.set('currentColorTemp', newColorTemp);\n\n// Mettre à jour le payload avec la nouvelle valeur de \"color_temp\"\nmsg.payload = {\n \"color_temp\": newColorTemp\n};\n\nreturn msg;\n",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1030,
        "y": 440,
        "wires": [
            [
                "3353c06cab4d553b",
                "41e22f30acd99c1a"
            ]
        ]
    },
    {
        "id": "247a82eee85cefcb",
        "type": "inject",
        "z": "8d595d2b5ddfea11",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 730,
        "y": 440,
        "wires": [
            [
                "e5179f6abd6ab5ec"
            ]
        ]
    },
    {
        "id": "3690ccfbbb7c0d84",
        "type": "inject",
        "z": "8d595d2b5ddfea11",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 970,
        "y": 800,
        "wires": [
            [
                "586f4cbd8a2e4a58"
            ]
        ]
    },
    {
        "id": "41e22f30acd99c1a",
        "type": "debug",
        "z": "8d595d2b5ddfea11",
        "name": "debug 72",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1280,
        "y": 540,
        "wires": []
    },
    {
        "id": "68561378b6fe68ed",
        "type": "mqtt in",
        "z": "8d595d2b5ddfea11",
        "name": "",
        "topic": "zigbee2mqtt/HueSwitch/action",
        "qos": "2",
        "datatype": "auto-detect",
        "broker": "99709302a818dd3b",
        "nl": false,
        "rap": true,
        "rh": 0,
        "inputs": 0,
        "x": 220,
        "y": 580,
        "wires": [
            [
                "f7fb988ebf4c67e3",
                "95235b012bad7d34"
            ]
        ]
    },
    {
        "id": "493c92ddcccf8207",
        "type": "api-current-state",
        "z": "8d595d2b5ddfea11",
        "name": "",
        "server": "92ab386eaaffa3ef",
        "version": 3,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "light.zig",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 840,
        "y": 540,
        "wires": [
            [
                "e5179f6abd6ab5ec"
            ]
        ]
    },
    {
        "id": "8f2317f90cb7781a",
        "type": "api-current-state",
        "z": "8d595d2b5ddfea11",
        "name": "",
        "server": "92ab386eaaffa3ef",
        "version": 3,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "light.zig",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 1420,
        "y": 320,
        "wires": [
            [
                "7436f915208cbde6"
            ]
        ]
    },
    {
        "id": "fbfec0d1669d9a0b",
        "type": "api-current-state",
        "z": "8d595d2b5ddfea11",
        "name": "",
        "server": "92ab386eaaffa3ef",
        "version": 3,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "light.zig",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 1300,
        "y": 620,
        "wires": [
            [
                "fdc460fab1aa2204"
            ]
        ]
    },
    {
        "id": "586f4cbd8a2e4a58",
        "type": "function",
        "z": "8d595d2b5ddfea11",
        "name": "GoToCold",
        "func": "// Récupérer la valeur actuelle de \"color_temp\" depuis le contexte\nvar currentColorTemp = flow.get('Temp') || 500;\n\n// Soustrait 10 à la valeur actuelle de \"color_temp\"\nvar newColorTemp = currentColorTemp - 32;\n\n// Limiter la nouvelle valeur de \"color_temp\" à 154\nnewColorTemp = Math.max(newColorTemp, 154);\n\n// Mettre à jour la valeur de \"color_temp\" dans le contexte\ncontext.set('currentColorTemp', newColorTemp);\n\n// Mettre à jour le payload avec la nouvelle valeur de \"color_temp\"\nmsg.payload = {\n \"color_temp\": newColorTemp\n};\n\nreturn msg;\n",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 1040,
        "y": 720,
        "wires": [
            [
                "7093f6a761b273c5"
            ]
        ]
    },
    {
        "id": "57284b3dd2a6b7aa",
        "type": "api-call-service",
        "z": "8d595d2b5ddfea11",
        "name": "Light Down",
        "server": "92ab386eaaffa3ef",
        "version": 5,
        "debugenabled": false,
        "domain": "light",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "light.zig"
        ],
        "data": "{\t \"color_temp\": 153}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1210,
        "y": 820,
        "wires": [
            []
        ]
    },
    {
        "id": "7093f6a761b273c5",
        "type": "api-call-service",
        "z": "8d595d2b5ddfea11",
        "name": "Light DOWN",
        "server": "92ab386eaaffa3ef",
        "version": 5,
        "debugenabled": false,
        "domain": "light",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "light.zig"
        ],
        "data": "payload",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1210,
        "y": 740,
        "wires": [
            [
                "fbfec0d1669d9a0b"
            ]
        ]
    },
    {
        "id": "64b398cce0301e19",
        "type": "api-current-state",
        "z": "8d595d2b5ddfea11",
        "name": "",
        "server": "92ab386eaaffa3ef",
        "version": 3,
        "outputs": 1,
        "halt_if": "",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "light.zig",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "override_topic": false,
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "x": 820,
        "y": 680,
        "wires": [
            [
                "586f4cbd8a2e4a58"
            ]
        ]
    },
    {
        "id": "61815ce19ba3d2d5",
        "type": "server-state-changed",
        "z": "8d595d2b5ddfea11",
        "name": "",
        "server": "92ab386eaaffa3ef",
        "version": 5,
        "outputs": 1,
        "exposeAsEntityConfig": "",
        "entityId": "light.zig",
        "entityIdType": "exact",
        "outputInitially": true,
        "stateType": "str",
        "ifState": "",
        "ifStateType": "str",
        "ifStateOperator": "is",
        "outputOnlyOnStateChange": false,
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": true,
        "ignoreCurrentStateUnavailable": true,
        "outputProperties": [
            {
                "property": "media",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            }
        ],
        "x": 280,
        "y": 80,
        "wires": [
            [
                "cf754db00946cbc5",
                "41f6bea9fca80071",
                "c4ad8bc0a6d228ec"
            ]
        ]
    },
    {
        "id": "41f6bea9fca80071",
        "type": "debug",
        "z": "8d595d2b5ddfea11",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "media.new_state.attributes.color_temp",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 670,
        "y": 100,
        "wires": []
    },
    {
        "id": "cf754db00946cbc5",
        "type": "change",
        "z": "8d595d2b5ddfea11",
        "name": "save Brightness and Temperature",
        "rules": [
            {
                "t": "set",
                "p": "Temp",
                "pt": "flow",
                "to": "media.new_state.attributes.color_temp",
                "tot": "msg"
            },
            {
                "t": "set",
                "p": "Bright",
                "pt": "flow",
                "to": "media.new_state.attributes.brightness",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 640,
        "y": 160,
        "wires": [
            [
                "b98b770842e756f5"
            ]
        ]
    },
    {
        "id": "c4ad8bc0a6d228ec",
        "type": "debug",
        "z": "8d595d2b5ddfea11",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "media.new_state.attributes.brightness",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 670,
        "y": 40,
        "wires": []
    },
    {
        "id": "b98b770842e756f5",
        "type": "debug",
        "z": "8d595d2b5ddfea11",
        "name": "debug 73",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 1010,
        "y": 160,
        "wires": []
    },
    {
        "id": "ad43504401a2b40c",
        "type": "api-call-service",
        "z": "8d595d2b5ddfea11",
        "name": "Light Up",
        "server": "92ab386eaaffa3ef",
        "version": 5,
        "debugenabled": false,
        "domain": "light",
        "service": "turn_on",
        "areaId": [],
        "deviceId": [],
        "entityId": [
            "light.zig"
        ],
        "data": "{\t \"color_temp\": 500}",
        "dataType": "jsonata",
        "mergeContext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1200,
        "y": 280,
        "wires": [
            []
        ]
    },
    {
        "id": "92ab386eaaffa3ef",
        "type": "server",
        "name": "Home Assistant",
        "version": 5,
        "addon": true,
        "rejectUnauthorizedCerts": true,
        "ha_boolean": "y|yes|true|on|home|open",
        "connectionDelay": true,
        "cacheJson": true,
        "heartbeat": false,
        "heartbeatInterval": "30",
        "areaSelector": "friendlyName",
        "deviceSelector": "friendlyName",
        "entitySelector": "friendlyName",
        "statusSeparator": ": ",
        "statusYear": "hidden",
        "statusMonth": "short",
        "statusDay": "numeric",
        "statusHourCycle": "default",
        "statusTimeFormat": "h:m",
        "enableGlobalContextStore": false
    },
    {
        "id": "99709302a818dd3b",
        "type": "mqtt-broker",
        "name": "",
        "broker": "192.168.1.77",
        "port": "1883",
        "clientid": "",
        "autoConnect": true,
        "usetls": false,
        "protocolVersion": "4",
        "keepalive": "60",
        "cleansession": true,
        "autoUnsubscribe": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthRetain": "false",
        "birthPayload": "",
        "birthMsg": {},
        "closeTopic": "",
        "closeQos": "0",
        "closeRetain": "false",
        "closePayload": "",
        "closeMsg": {},
        "willTopic": "",
        "willQos": "0",
        "willRetain": "false",
        "willPayload": "",
        "willMsg": {},
        "userProps": "",
        "sessionExpiry": ""
    }
]

```

---

<div class="post-metadata">

**Author:** ![wise3](https://avatars.discourse-cdn.com/v4/letter/w/49beb7/32.png) [@wise3](https://discourse.nodered.org/u/wise3)\
**Post date:** [8 May 2024 10:44 UTC](https://discourse.nodered.org/t/philips-hue-tap-flow/85423/9 "2024-05-08T10:44:36Z")

</div>

Hello,

i don't know if it could help someone but here is the Flow at this moment 🙂  
NOT perfect and certainly not Clear because there is many try.  
Now i try to find a way to do in my "TriActionHueTap" how to make a "Double button\_1\_press\_release" for example. then Triple etc:  
[HueDial9\_1.json](https://discourse.nodered.org/uploads/short-url/9agM0U0FWg4oC7QQNDCjxPDGQXG.json) (70.7 KB)

---

<div class="post-metadata">

**Author:** ![wise3](https://avatars.discourse-cdn.com/v4/letter/w/49beb7/32.png) [@wise3](https://discourse.nodered.org/u/wise3)\
**Post date:** [29 May 2024 16:34 UTC](https://discourse.nodered.org/t/philips-hue-tap-flow/85423/10 "2024-05-29T16:34:08Z")

</div>

Hello I find a way with a subflow for double Triple etc.  
But now i Try to find a way for this sequence for example:  
"Hold Button 4 and in the same Time double clic button 1" -- Output.

Here is the evolution of "my" flow  
[https://pastebin.com/vSPd9fDh](https://pastebin.com/vSPd9fDh)

Someone to help me? ☹

---

<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:** [27 August 2024 16:34 UTC](https://discourse.nodered.org/t/philips-hue-tap-flow/85423/11 "2024-08-27T16:34:36Z")

</div>

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