# Use switch node to filter different devices

**URL:** <https://discourse.nodered.org/t/use-switch-node-to-filter-different-devices/10823>\
**Category:** General\
**Created:** [5 May 2019 07:54 UTC](https://discourse.nodered.org/t/use-switch-node-to-filter-different-devices/10823 "2019-05-05T07:54:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel1411](https://avatars.discourse-cdn.com/v4/letter/d/bc79bd/32.png) [@daniel1411](https://discourse.nodered.org/u/daniel1411)\
**Post date:** [5 May 2019 07:54 UTC](https://discourse.nodered.org/t/use-switch-node-to-filter-different-devices/10823/1 "2019-05-05T07:54:17Z")

</div>

Hi,

I am using Node red and [Hass.io](http://Hass.io) and want to listen to events from Aqara click,  
but i have more than 1 button (different entity\_id) and each button can be press single, double....  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/6/67e706ea23821db0ec5b5e8a0a4e3bcd39833268.jpeg)

1- What i need to set in the switch node to split per entity\_id  
2-What i need to set in the switch node to split per click\_type

Tnx  
Daniel.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [5 May 2019 08:11 UTC](https://discourse.nodered.org/t/use-switch-node-to-filter-different-devices/10823/2 "2019-05-05T08:11:34Z")

</div>

Your debug shows msg.payload and your switch shows global.payload, which is different (if it starts with global or flow it’s a context value which you can read about in the docs)

Looking in more depth you actually want to switch based on an item in a nested object within msg.payload (and then in a nested nested object)

If you don’t understand javascript objects and arrays then reading one of the online tutorials is definitely time well spent.

There’s also a page in the docs that will help you get the right path to anything you can display in the debug panel

[https://nodered.org/docs/user-guide/messages](https://nodered.org/docs/user-guide/messages)
