# Check entity state inside function node

**URL:** https://discourse.nodered.org/t/check-entity-state-inside-function-node/71631
**Category:** General
**Tags:** home-assistant
**Created:** [2 December 2022 23:55 UTC](https://discourse.nodered.org/t/check-entity-state-inside-function-node/71631 "2022-12-02T23:55:17Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sd\_dracula](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@sd\_dracula](https://discourse.nodered.org/u/sd_dracula)
#### Post date: [2 December 2022 23:55 UTC](https://discourse.nodered.org/t/check-entity-state-inside-function-node/71631/1 "2022-12-02T23:55:17Z")

</div>

I have a function node like this:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/0/308101adb5872314cd24e9b1109ca24001715bca.png)  
And a home assistant entity like so:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/1/411fd11bd58e32ba944289dc131158ce5ca80a00.png)  
I need to add an if/else condition in this function that checks the on/off value of the home assistant entity but not sure how to call it inside the function node, can someone advise?

---

<div class="post-metadata">

### Author: ![craigcurtin](https://avatars.discourse-cdn.com/v4/letter/c/94ad74/32.png) [@craigcurtin](https://discourse.nodered.org/u/craigcurtin)
#### Post date: [3 December 2022 00:20 UTC](https://discourse.nodered.org/t/check-entity-state-inside-function-node/71631/2 "2022-12-03T00:20:52Z")

</div>

There are limited people on here who use NR and HA - you would be better off asking this in the NR subforum on the HA official forums.

Craig

---

<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: [3 December 2022 07:29 UTC](https://discourse.nodered.org/t/check-entity-state-inside-function-node/71631/3 "2022-12-03T07:29:41Z")

</div>

Is the entity in the message going into the function? If so there’s a great page in the docs ([Working with messages : Node-RED](https://nodered.org/docs/user-guide/messages)) that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

![BX00Cy7yHi](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd1f333a9e043b061b39917c328b0094d3e52d30.gif)

If you can't make it work then use the copy path button described above to copy the message contents and paste it here so we can see what is there.

---

<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: [1 February 2023 07:30 UTC](https://discourse.nodered.org/t/check-entity-state-inside-function-node/71631/4 "2023-02-01T07:30:05Z")

</div>

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