# Node-RED home/away HA helper says away when it should be home

**URL:** <https://discourse.nodered.org/t/node-red-home-away-ha-helper-says-away-when-it-should-be-home/75046>\
**Category:** General\
**Tags:** docker, home-assistant\
**Created:** [11 February 2023 19:59 UTC](https://discourse.nodered.org/t/node-red-home-away-ha-helper-says-away-when-it-should-be-home/75046 "2023-02-11T19:59:34Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mothy\_Tim](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mothy_tim/32/75935_2.png) [@Mothy\_Tim](https://discourse.nodered.org/u/Mothy_Tim)\
**Post date:** [11 February 2023 19:59 UTC](https://discourse.nodered.org/t/node-red-home-away-ha-helper-says-away-when-it-should-be-home/75046/1 "2023-02-11T19:59:34Z")

</div>

Hi, I have a strange problem I set up a Home assistant helper for Home/Away that works with Homekit it switches correctly and shows as Home on the dashboard but in Node-RED events: state node it's reversed and shows Away and vice-versa when Away in home assistant shows as Home in Node-RED, what could cause this, please?

Node-RED v3.0.2 running in docker.

---

<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:** [12 February 2023 15:24 UTC](https://discourse.nodered.org/t/node-red-home-away-ha-helper-says-away-when-it-should-be-home/75046/2 "2023-02-12T15:24:15Z")

</div>

Welcome to the forum @Mothy_Tim

How are you displaying the status in node red?

Export the nodes leading to the display node (Ctrl+E) and paste the flow here so we can see what you are doing. Also show us the data that is coming into the flow.

Note that if the problem is in Home Assistant nodes then we are unlikely to be able to help much as few here use HA, preferring to do everything in node-red.

---

<div class="post-metadata">

**Author:** ![Mothy\_Tim](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mothy_tim/32/75935_2.png) [@Mothy\_Tim](https://discourse.nodered.org/u/Mothy_Tim)\
**Post date:** [12 February 2023 17:49 UTC](https://discourse.nodered.org/t/node-red-home-away-ha-helper-says-away-when-it-should-be-home/75046/3 "2023-02-12T17:49:26Z")

</div>

Hi, thanks! 🙂

Ok so I tried to upload flow but it says new users can't do that!! So then I tried pasting the json code into the window and then it says to many characters?? ☹

---

<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:** [12 February 2023 18:33 UTC](https://discourse.nodered.org/t/node-red-home-away-ha-helper-says-away-when-it-should-be-home/75046/4 "2023-02-12T18:33:07Z")

</div>

How many nodes did you export? To show what we need it should only be a handful. You should be able to paste it in directly. 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:** ![Mothy\_Tim](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mothy_tim/32/75935_2.png) [@Mothy\_Tim](https://discourse.nodered.org/u/Mothy_Tim)\
**Post date:** [12 February 2023 18:36 UTC](https://discourse.nodered.org/t/node-red-home-away-ha-helper-says-away-when-it-should-be-home/75046/5 "2023-02-12T18:36:35Z")

</div>

Hi, it was 6 nodes? I've reduced that to the first 3 nodes here:

```auto
[{"id":"d49e97da5a73d2e3","type":"server-state-changed","z":"1520a58bac137e53","name":"home/away","server":"c747eabbe685a486","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_select.homekit_all_presence_trigger","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"home","halt_if_type":"str","halt_if_compare":"is_not","outputs":2,"output_only_on_state_change":true,"for":"8","forType":"num","forUnits":"hours","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":134,"y":236,"wires":[["f27bf17b428f87de"],["3a2cb2ac2a57b727"]]},{"id":"f27bf17b428f87de","type":"api-current-state","z":"1520a58bac137e53","name":"vacation mode on?","server":"c747eabbe685a486","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.vacation_mode","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"true","valueType":"str"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":346,"y":236,"wires":[["5497122674778db2"],[]]},{"id":"3a2cb2ac2a57b727","type":"api-call-service","z":"1520a58bac137e53","name":"vacation mode off","server":"c747eabbe685a486","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.vacation_mode"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"data"}],"queue":"none","output_location":"payload","output_location_type":"msg","x":346,"y":284,"wires":[[]]},{"id":"c747eabbe685a486","type":"server","name":"Home Assistant","version":5,"addon":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":true,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

```

---

<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:** [12 February 2023 18:40 UTC](https://discourse.nodered.org/t/node-red-home-away-ha-helper-says-away-when-it-should-be-home/75046/6 "2023-02-12T18:40:04Z")

</div>

Those are all HA nodes. If it is the HA nodes that are getting it wrong then I can't help as I don't use HA. If it is node-red that is not displaying the HA data correctly then you need to show us what is coming out of the HA nodes (use debug nodes to do that) and how you are trying to display it.

---

<div class="post-metadata">

**Author:** ![Mothy\_Tim](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mothy_tim/32/75935_2.png) [@Mothy\_Tim](https://discourse.nodered.org/u/Mothy_Tim)\
**Post date:** [12 February 2023 21:34 UTC](https://discourse.nodered.org/t/node-red-home-away-ha-helper-says-away-when-it-should-be-home/75046/7 "2023-02-12T21:34:12Z")

</div>

Hi Colin,

Thanks for helping, but I've worked out the issue! I was about to copy the debug to post here, when I noticed that the state was "All Home", I had it set to if the state is not "Home", missing the word "All"!! Works now!! 🙂  
Cheers,  
Tim

---

<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:** [13 April 2023 21:34 UTC](https://discourse.nodered.org/t/node-red-home-away-ha-helper-says-away-when-it-should-be-home/75046/8 "2023-04-13T21:34:53Z")

</div>

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