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

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.

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.

Hi, thanks! :slight_smile:

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?? :frowning:

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 ```)

``` 
   code goes here 
```

See this post for more details - How to share code or flow json

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

[{"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}]

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.

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!! :slight_smile:
Cheers,
Tim

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