# IKEA motion sensor

**URL:** <https://discourse.nodered.org/t/ikea-motion-sensor/20781>\
**Category:** General\
**Created:** [23 January 2020 17:20 UTC](https://discourse.nodered.org/t/ikea-motion-sensor/20781 "2020-01-23T17:20:38Z")\
**Posts on this page:** 1\
**Showing post:** 7

<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:** [24 January 2020 15:26 UTC](https://discourse.nodered.org/t/ikea-motion-sensor/20781/7 "2020-01-24T15:26:11Z")

</div>

You can do all that in one go using a Change node configured like this  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/c/dcb58f72a9f86319b8f6c4d942cb122efd074912.png)  
That JSONata expression tests msg.payload.occupancy and if it is true sets the payload to ON, otherwise it sets it to OFF.

For future reference when you posting a flow do it as described in this post so that it is importable.

> [@How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506):
>
> To share code samples or flow json in this forum, you need to take care to format it properly so that it is displayed correctly. The easiest way to do that is to click the 'Preformatted Text' button in the toolbar: [image] Then paste in your code or flow json. You should end up with three back-tick characters - ``` - on their own line before and after the code. On standard US English keyboards, this is on the same key as the ~ character. Using the backticks will ens…

---

_[View the full topic](https://discourse.nodered.org/t/ikea-motion-sensor/20781)._
