Setting Home/Away functions via Node-RED

Someone shoot holes through my plan. I want HA/Node-RED to be able to know when either my wife and I, or only one of us is home and set things that have a Home/Away mode to the correct setting.

This is where I have started and I’m not sure that it is working as intended. Thoughts?

[
{
    "id": "626a9eee.c0c4f",
    "type": "tab",
    "label": "Home/Away Controller",
    "disabled": false,
    "info": "Control Home/Away Devices"
},
{
    "id": "3dc6a01d.1f5c8",
    "type": "function",
    "z": "626a9eee.c0c4f",
    "name": "Is Anyone Home?",
    "func": "var jonathanLocation = global.get(\"jonathanLocation\");\nvar taylorLocation  = global.get(\"taylorLocation\");\n\nif (jonathanLocation != \"home\" && taylorLocation != \"home\") {\n    msg.payload = \"away\";\n    return msg;\n} else {\n    msg.payload = \"home\";\n    return msg;\n}\n",
    "outputs": 1,
    "noerr": 0,
    "x": 530,
    "y": 200,
    "wires": [
        [
            "933f60f8.57b86"
        ]
    ]
},
{
    "id": "8ef890b.0eede7",
    "type": "api-call-service",
    "z": "626a9eee.c0c4f",
    "name": "Nest: Away",
    "server": "92954ff.98a11b",
    "service_domain": "climate",
    "service": "set_away_mode",
    "data": "{ \"away_mode\": \"on\" }",
    "mergecontext": "",
    "x": 1010,
    "y": 220,
    "wires": [
        []
    ]
},
{
    "id": "6b3569c1.d0a388",
    "type": "api-call-service",
    "z": "626a9eee.c0c4f",
    "name": "Nest: Home",
    "server": "92954ff.98a11b",
    "service_domain": "climate",
    "service": "set_away_mode",
    "data": "{ \"away_mode\": \"off\" }",
    "mergecontext": "",
    "x": 1010,
    "y": 180,
    "wires": [
        []
    ]
},
{
    "id": "933f60f8.57b86",
    "type": "switch",
    "z": "626a9eee.c0c4f",
    "name": "Outputs for Home/Away",
    "property": "payload",
    "propertyType": "msg",
    "rules": [
        {
            "t": "eq",
            "v": "home",
            "vt": "str"
        },
        {
            "t": "eq",
            "v": "away",
            "vt": "str"
        }
    ],
    "checkall": "true",
    "repair": false,
    "outputs": 2,
    "x": 770,
    "y": 200,
    "wires": [
        [
            "6b3569c1.d0a388",
            "c82f3996.256f88"
        ],
        [
            "8ef890b.0eede7",
            "f2f77c20.5282"
        ]
    ]
},
{
    "id": "f2f77c20.5282",
    "type": "api-call-service",
    "z": "626a9eee.c0c4f",
    "name": "Arlo: Armed",
    "server": "92954ff.98a11b",
    "service_domain": "camera",
    "service": "enable_motion_detection",
    "data": "{ \"entity_id\": \"camera.front_window, camera.antuique_record_player\" }",
    "mergecontext": "",
    "x": 1010,
    "y": 360,
    "wires": [
        []
    ]
},
{
    "id": "c82f3996.256f88",
    "type": "api-call-service",
    "z": "626a9eee.c0c4f",
    "name": "Arlo: Disarmed",
    "server": "92954ff.98a11b",
    "service_domain": "camera",
    "service": "disable_motion_detection",
    "data": "{ \"entity_id\": \"camera.front_window, camera.antuique_record_player\" }",
    "mergecontext": "",
    "x": 1020,
    "y": 320,
    "wires": [
        []
    ]
},
{
    "id": "3dfe2afa.47a106",
    "type": "comment",
    "z": "626a9eee.c0c4f",
    "name": "Set Nest Home/Away",
    "info": "",
    "x": 1040,
    "y": 140,
    "wires": []
},
{
    "id": "1b98b668.7390aa",
    "type": "comment",
    "z": "626a9eee.c0c4f",
    "name": "Arm/Disarm Arlo",
    "info": "",
    "x": 1020,
    "y": 280,
    "wires": []
},
{
    "id": "e9c44549.b2ce78",
    "type": "server-state-changed",
    "z": "626a9eee.c0c4f",
    "name": "Jonathan Location",
    "server": "92954ff.98a11b",
    "entityidfilter": "device_tracker.google_maps_****",
    "entityidfiltertype": "substring",
    "haltifstate": "",
    "x": 110,
    "y": 180,
    "wires": [
        [
            "6c88db56.d56e44"
        ]
    ]
},
{
    "id": "5df57d77.685084",
    "type": "server-state-changed",
    "z": "626a9eee.c0c4f",
    "name": "Taylor Location",
    "server": "92954ff.98a11b",
    "entityidfilter": "device_tracker.google_maps_****",
    "entityidfiltertype": "substring",
    "haltifstate": "",
    "x": 120,
    "y": 220,
    "wires": [
        [
            "a8c9173c.21c638"
        ]
    ]
},
{
    "id": "6c88db56.d56e44",
    "type": "function",
    "z": "626a9eee.c0c4f",
    "name": "jonathanLocation",
    "func": "global.set(\"jonathanLocation\", msg.data.new_state.state);\nconsole.log(\"Jonathan's location changed...\");",
    "outputs": 1,
    "noerr": 0,
    "x": 310,
    "y": 180,
    "wires": [
        [
            "3dc6a01d.1f5c8"
        ]
    ]
},
{
    "id": "a8c9173c.21c638",
    "type": "function",
    "z": "626a9eee.c0c4f",
    "name": "taylorLocation",
    "func": "global.set(\"taylorLocation\", msg.data.new_state.state);\nconsole.log(\"Taylors location changed...\")",
    "outputs": 1,
    "noerr": 0,
    "x": 320,
    "y": 220,
    "wires": [
        [
            "3dc6a01d.1f5c8"
        ]
    ]
},
{
    "id": "92954ff.98a11b",
    "type": "server",
    "z": "",
    "name": "homeassistant",
    "url": "http://192.168.0.250:8123",
    "pass": "****"
}
]

Also here is a photo of the flow so you can see the “wiring”:

I have the below setup … I had Bluetooth signal dropouts thats why delay 60sec and check if the status is still away before setting my boolean to true (in node TS left &Mum left)

I use a boolean for each family member and than can easily check and set the away boolean

Mine is similar to xx_Nexus_xx.

Im not sure why you need to use the globals/functions. You can use the current state node to pull the state directly from homeassistant.

1 Like

yes, I’m aware … I’m using the globals/functions so I can see the state changes directly in the frontend

Hello,

Nice job ! Is it possible to have un export of the Trigger node ? Just in order to understand how it works, because mine are not working … :frowning:

Thanks !

Here you go

[
    {
        "id": "2813fefc.7a7be2",
        "type": "trigger-state",
        "z": "96100229.c25d8",
        "name": "Home Set From Away to Home",
        "server": "21a5d722.1a2e58",
        "entityid": "input_select.home_mode",
        "debugenabled": false,
        "constraints": [
            {
                "id": "drck1l2wgz",
                "targetType": "this_entity",
                "targetValue": "",
                "propertyType": "current_state",
                "propertyValue": "new_state.state",
                "comparatorType": "is",
                "comparatorValueDatatype": "str",
                "comparatorValue": "Home"
            },
            {
                "id": "nx8sbykibq",
                "targetType": "this_entity",
                "targetValue": "",
                "propertyType": "previous_state",
                "propertyValue": "old_state.state",
                "comparatorType": "is",
                "comparatorValueDatatype": "str",
                "comparatorValue": "Away"
            }
        ],
        "constraintsmustmatch": "all",
        "outputs": 2,
        "customoutputs": [],
        "x": 175,
        "y": 607,
        "wires": [
            [
                "437aa889.e96cb8",
                "aac501e5.4e55"
            ],
            []
        ]
    },
    {
        "id": "21a5d722.1a2e58",
        "type": "server",
        "z": "",
        "name": "Home Assistant",
        "url": "",
        "pass": ""
    }
]

Many Thanks !

@nicp, would it possible to post the code for your 4 flows, I don’t fully understand how to create a home mode and then set it to home or away. Thanks!

Sorry for the newbie question but what are these nodes you are using?

image

These are the api-current-state nodes, I’m using the older non websockets version

Hi bwanajag, is there something specifically you are having trouble with?

I’m using an older version so this code may not help you much.

[
{
    "id": "87a22e69.27778",
    "type": "api-call-service",
    "z": "96100229.c25d8",
    "name": "Set Home Mode Home",
    "server": "21a5d722.1a2e58",
    "service_domain": "input_select",
    "service": "select_option",
    "data": "{ \"entity_id\":\"input_select.home_mode\", \"option\":\"Home\"  }",
    "mergecontext": "",
    "x": 1030,
    "y": 260,
    "wires": [
        []
    ]
},
{
    "id": "6c3a2160.17bd7",
    "type": "api-call-service",
    "z": "96100229.c25d8",
    "name": "Set Home Mode Away",
    "server": "21a5d722.1a2e58",
    "service_domain": "input_select",
    "service": "select_option",
    "data": "{ \"entity_id\":\"input_select.home_mode\", \"option\":\"Away\"  }",
    "mergecontext": "",
    "x": 1020,
    "y": 420,
    "wires": [
        []
    ]
},
{
    "id": "e11c9185.2ada3",
    "type": "trigger-state",
    "z": "96100229.c25d8",
    "name": "Nic iPhone away to home",
    "server": "21a5d722.1a2e58",
    "entityid": "device_tracker.nics_iphone",
    "debugenabled": false,
    "constraints": [
        {
            "id": "3wz11os97jh",
            "targetType": "this_entity",
            "targetValue": "",
            "propertyType": "current_state",
            "propertyValue": "new_state.state",
            "comparatorType": "is",
            "comparatorValueDatatype": "str",
            "comparatorValue": "home"
        },
        {
            "id": "wbmz063xpn",
            "targetType": "this_entity",
            "targetValue": "",
            "propertyType": "previous_state",
            "propertyValue": "old_state.state",
            "comparatorType": "is",
            "comparatorValueDatatype": "str",
            "comparatorValue": "not_home"
        }
    ],
    "constraintsmustmatch": "all",
    "outputs": 2,
    "customoutputs": [],
    "x": 150,
    "y": 320,
    "wires": [
        [
            "6482e5eb.5ca6cc",
            "8f9bf4ef.a96ed8"
        ],
        []
    ]
},
{
    "id": "59948012.5eb79",
    "type": "trigger-state",
    "z": "96100229.c25d8",
    "name": "Nic iPhone home to not_home",
    "server": "21a5d722.1a2e58",
    "entityid": "device_tracker.nics_iphone",
    "debugenabled": false,
    "constraints": [
        {
            "id": "nfrzw9ya7n",
            "targetType": "this_entity",
            "targetValue": "",
            "propertyType": "previous_state",
            "propertyValue": "old_state.state",
            "comparatorType": "is",
            "comparatorValueDatatype": "str",
            "comparatorValue": "home"
        },
        {
            "id": "kpadvctzfrj",
            "targetType": "this_entity",
            "targetValue": "",
            "propertyType": "current_state",
            "propertyValue": "new_state.state",
            "comparatorType": "is",
            "comparatorValueDatatype": "str",
            "comparatorValue": "not_home"
        }
    ],
    "constraintsmustmatch": "all",
    "outputs": 2,
    "customoutputs": [],
    "x": 170,
    "y": 460,
    "wires": [
        [
            "37f76f71.43a13"
        ],
        []
    ]
},
{
    "id": "66ab6408.2355fc",
    "type": "trigger-state",
    "z": "96100229.c25d8",
    "name": "Anna iPhone away to home",
    "server": "21a5d722.1a2e58",
    "entityid": "device_tracker.annas_iphone",
    "debugenabled": false,
    "constraints": [
        {
            "id": "3wz11os97jh",
            "targetType": "this_entity",
            "targetValue": "",
            "propertyType": "current_state",
            "propertyValue": "new_state.state",
            "comparatorType": "is",
            "comparatorValueDatatype": "str",
            "comparatorValue": "home"
        },
        {
            "id": "q1ce0fqwnw",
            "targetType": "this_entity",
            "targetValue": "",
            "propertyType": "previous_state",
            "propertyValue": "old_state.state",
            "comparatorType": "is",
            "comparatorValueDatatype": "str",
            "comparatorValue": "not_home"
        }
    ],
    "constraintsmustmatch": "all",
    "outputs": 2,
    "customoutputs": [],
    "x": 160,
    "y": 260,
    "wires": [
        [
            "6482e5eb.5ca6cc",
            "8f9bf4ef.a96ed8"
        ],
        []
    ]
},
{
    "id": "e89665b6.bab888",
    "type": "trigger-state",
    "z": "96100229.c25d8",
    "name": "Anna iPhone home to not_home",
    "server": "21a5d722.1a2e58",
    "entityid": "device_tracker.annas_iphone",
    "debugenabled": false,
    "constraints": [
        {
            "id": "nfrzw9ya7n",
            "targetType": "this_entity",
            "targetValue": "",
            "propertyType": "previous_state",
            "propertyValue": "old_state.state",
            "comparatorType": "is",
            "comparatorValueDatatype": "str",
            "comparatorValue": "home"
        },
        {
            "id": "1xl0ty2k8ej",
            "targetType": "this_entity",
            "targetValue": "",
            "propertyType": "current_state",
            "propertyValue": "new_state.state",
            "comparatorType": "is",
            "comparatorValueDatatype": "str",
            "comparatorValue": "not_home"
        }
    ],
    "constraintsmustmatch": "all",
    "outputs": 2,
    "customoutputs": [],
    "x": 170,
    "y": 400,
    "wires": [
        [
            "a288855e.bcc958"
        ],
        []
    ]
},
{
    "id": "d2c1c15e.e3e35",
    "type": "switch",
    "z": "96100229.c25d8",
    "name": "Home/Away/Hold",
    "property": "payload",
    "propertyType": "msg",
    "rules": [
        {
            "t": "eq",
            "v": "Home",
            "vt": "str"
        },
        {
            "t": "eq",
            "v": "Away",
            "vt": "str"
        },
        {
            "t": "eq",
            "v": "Hold",
            "vt": "str"
        }
    ],
    "checkall": "true",
    "repair": false,
    "outputs": 3,
    "x": 730,
    "y": 260,
    "wires": [
        [],
        [
            "87a22e69.27778"
        ],
        []
    ]
},
{
    "id": "6482e5eb.5ca6cc",
    "type": "api-current-state",
    "z": "96100229.c25d8",
    "name": "Home Mode",
    "server": "21a5d722.1a2e58",
    "halt_if": "",
    "override_topic": true,
    "override_payload": true,
    "entity_id": "input_select.home_mode",
    "x": 450,
    "y": 260,
    "wires": [
        [
            "d2c1c15e.e3e35"
        ]
    ]
},
{
    "id": "37f76f71.43a13",
    "type": "api-current-state",
    "z": "96100229.c25d8",
    "name": "Anna iPhone not home",
    "server": "21a5d722.1a2e58",
    "halt_if": "home",
    "override_topic": true,
    "override_payload": true,
    "entity_id": "device_tracker.annas_iphone",
    "x": 420,
    "y": 460,
    "wires": [
        [
            "915aaf18.5118a"
        ]
    ]
},
{
    "id": "a288855e.bcc958",
    "type": "api-current-state",
    "z": "96100229.c25d8",
    "name": "Nic iPhone not home",
    "server": "21a5d722.1a2e58",
    "halt_if": "home",
    "override_topic": true,
    "override_payload": true,
    "entity_id": "device_tracker.nics_iphone",
    "x": 420,
    "y": 400,
    "wires": [
        [
            "915aaf18.5118a"
        ]
    ]
},
{
    "id": "915aaf18.5118a",
    "type": "api-current-state",
    "z": "96100229.c25d8",
    "name": "Home Mode",
    "server": "21a5d722.1a2e58",
    "halt_if": "",
    "override_topic": true,
    "override_payload": true,
    "entity_id": "input_select.home_mode",
    "x": 630,
    "y": 420,
    "wires": [
        [
            "9ff493d6.66d07"
        ]
    ]
},
{
    "id": "9ff493d6.66d07",
    "type": "switch",
    "z": "96100229.c25d8",
    "name": "Home/Away/Hold",
    "property": "payload",
    "propertyType": "msg",
    "rules": [
        {
            "t": "eq",
            "v": "Home",
            "vt": "str"
        },
        {
            "t": "eq",
            "v": "Away",
            "vt": "str"
        },
        {
            "t": "eq",
            "v": "Hold",
            "vt": "str"
        }
    ],
    "checkall": "true",
    "repair": false,
    "outputs": 3,
    "x": 810,
    "y": 420,
    "wires": [
        [
            "6c3a2160.17bd7"
        ],
        [],
        []
    ]
},
{
    "id": "cf380a7d.42c188",
    "type": "comment",
    "z": "96100229.c25d8",
    "name": "Auto mode from iPhones",
    "info": "",
    "x": 150,
    "y": 200,
    "wires": []
},
{
    "id": "a9875210.05ccd",
    "type": "comment",
    "z": "96100229.c25d8",
    "name": "Actions on Away and Home",
    "info": "",
    "x": 160,
    "y": 560,
    "wires": []
},
{
    "id": "2813fefc.7a7be2",
    "type": "trigger-state",
    "z": "96100229.c25d8",
    "name": "Home Set From Away to Home",
    "server": "21a5d722.1a2e58",
    "entityid": "input_select.home_mode",
    "debugenabled": false,
    "constraints": [
        {
            "id": "drck1l2wgz",
            "targetType": "this_entity",
            "targetValue": "",
            "propertyType": "current_state",
            "propertyValue": "new_state.state",
            "comparatorType": "is",
            "comparatorValueDatatype": "str",
            "comparatorValue": "Home"
        },
        {
            "id": "nx8sbykibq",
            "targetType": "this_entity",
            "targetValue": "",
            "propertyType": "previous_state",
            "propertyValue": "old_state.state",
            "comparatorType": "is",
            "comparatorValueDatatype": "str",
            "comparatorValue": "Away"
        }
    ],
    "constraintsmustmatch": "all",
    "outputs": 2,
    "customoutputs": [],
    "x": 175,
    "y": 607,
    "wires": [
        [
            "437aa889.e96cb8",
            "aac501e5.4e55"
        ],
        []
    ]
},
{
    "id": "634c1c33.1901f4",
    "type": "trigger-state",
    "z": "96100229.c25d8",
    "name": "Home Set to Home",
    "server": "21a5d722.1a2e58",
    "entityid": "input_select.home_mode",
    "debugenabled": false,
    "constraints": [
        {
            "id": "pr9vnybcye",
            "targetType": "this_entity",
            "targetValue": "",
            "propertyType": "current_state",
            "propertyValue": "new_state.state",
            "comparatorType": "is",
            "comparatorValueDatatype": "str",
            "comparatorValue": "Home"
        }
    ],
    "constraintsmustmatch": "all",
    "outputs": 2,
    "customoutputs": [],
    "x": 130,
    "y": 740,
    "wires": [
        [
            "1d11800b.149dd",
            "b80a91d9.01019"
        ],
        []
    ]
},
{
    "id": "e7e851cb.5c383",
    "type": "trigger-state",
    "z": "96100229.c25d8",
    "name": "Home Set to Away",
    "server": "21a5d722.1a2e58",
    "entityid": "input_select.home_mode",
    "debugenabled": false,
    "constraints": [
        {
            "id": "vxso2k2o8h",
            "targetType": "this_entity",
            "targetValue": "",
            "propertyType": "current_state",
            "propertyValue": "new_state.state",
            "comparatorType": "is",
            "comparatorValueDatatype": "str",
            "comparatorValue": "Away"
        }
    ],
    "constraintsmustmatch": "all",
    "outputs": 2,
    "customoutputs": [],
    "x": 130,
    "y": 860,
    "wires": [
        [
            "1aa588af.03ff67",
            "b3e3f034.c513",
            "3d35ff86.af274",
            "ca41867f.3473e8",
            "4a084f80.0ba85",
            "957e0baa.20e808"
        ],
        []
    ]
},
{
    "id": "330d4410.adc65c",
    "type": "comment",
    "z": "96100229.c25d8",
    "name": "Prevents changing thermostat on Hold->Home",
    "info": "",
    "x": 220,
    "y": 660,
    "wires": []
},
{
    "id": "21a5d722.1a2e58",
    "type": "server",
    "z": "",
    "name": "Home Assistant",
    "url": "http://url",
    "pass": "pass"
}

]

1 Like

Ah yes. mine looks more like a plane then an arrow. Thanks

@nicp I noticed in the call service node “Set Home Mode Home” that you had an entity ID of input_select.home_mode. How/where did you create this entity? I’ve not done this before, not sure where to start.

Also, for your switches, what is the use case of “Hold”? Is this when someone is away but you want it to act like someone’s home?

Hi bwanajag,

This page explains how to setup an input_select in home assistant https://www.home-assistant.io/components/input_select/

The yaml I use is:

input_select:
  home_mode:
    name: Home Mode
    options:
     - Home
     - Away
     - Hold
    initial: Home
    icon: mdi:house

The home and away mode are triggered by if our mobile devices are present, the hold mode is used to disable the automations when we leave the house with a guest over (stops everything automatically turning off when we leave).

1 Like

@nicp A couple more questions (I’m doing this slowly, don’t have much time to designate to learning this), on your first flow, you have phones changing from away (not_home) to home, then the “current state” node (which I don’t understand what happens here, if either of the phones changes from away to home, it sets the current state node to Home?). After the current state node you go into the switch, which defines 3 outputs, home/away/hold. This is where it gets confusing, you have linked the “away” state to “set home mode home” call service.

Similarly, for the second flow, you add current states nodes for the phones, in-between the trigger and the home mode current state, why? Finally, you’ve pulled from the “home” state on the switch to feed the “set home mode away” for the final call service node.

I clearly am a newb at this, just trying to understand.

The current state node gets a state from home assistant and sets the msg.payload to that state. So for the first flow if a message is generated by with phone changing to home the second node gets the current homemode state and feeds it to the switch. The switch is setup to switch between home away and hold. So in this instance the second output is wired to then set the homemode to home.

To summarise if a phone changes from not_home to home, get the current homemode state, if the state is away, set it to home.

1 Like

For the second flow if a phone goes from home to not_home get the state of the other phone, if that phone is home then stop (we only want to set away if both phones are out of the house). Otherwise get the current state of the homemode, if it is home set it to away

Hi,
Hope you’re well and sorry for bumping an old thread.

I’m trying to figure this out and your comments have been really helpful. I’ve so far got this flow

If I manually set the state for home_mode to either Home or Away those parts work as expected and if I manually set my tracker to be home or not_home it shows the changes but I can’t the the two to link. I think I’ve got something wrong with my call service nodes for setting home mode to home/away.

Could you please give me a pointer?

[
    {
        "id": "b0242f35.84c88",
        "type": "tab",
        "label": "Heating",
        "disabled": false,
        "info": ""
    },
    {
        "id": "5f0901a3.e9ef9",
        "type": "trigger-state",
        "z": "b0242f35.84c88",
        "name": "Simon status",
        "server": "a1cb02fa.962a9",
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityid": "person.simon",
        "entityidfiltertype": "exact",
        "debugenabled": false,
        "constraints": [],
        "constraintsmustmatch": "all",
        "outputs": 2,
        "customoutputs": [],
        "outputinitially": false,
        "state_type": "str",
        "x": 90,
        "y": 60,
        "wires": [
            [
                "d6440e2a.6e468"
            ],
            []
        ]
    },
    {
        "id": "d6440e2a.6e468",
        "type": "api-current-state",
        "z": "b0242f35.84c88",
        "name": "Simon is home?",
        "server": "a1cb02fa.962a9",
        "version": 1,
        "outputs": 2,
        "halt_if": "home",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "override_topic": false,
        "entity_id": "person.simon",
        "state_type": "str",
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "blockInputOverrides": false,
        "x": 260,
        "y": 60,
        "wires": [
            [
                "e1224e41.c57da"
            ],
            [
                "20eb3554.2c115a"
            ]
        ]
    },
    {
        "id": "20eb3554.2c115a",
        "type": "switch",
        "z": "b0242f35.84c88",
        "name": "Home/Away/Hold",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "Away",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 450,
        "y": 80,
        "wires": [
            [
                "e11a542f.890db8"
            ]
        ]
    },
    {
        "id": "e11a542f.890db8",
        "type": "api-call-service",
        "z": "b0242f35.84c88",
        "name": "Set home mode to away",
        "server": "a1cb02fa.962a9",
        "version": 1,
        "debugenabled": false,
        "service_domain": "input_select",
        "service": "select_option",
        "entityId": "input_select.home_mode",
        "data": "{ \"entity_id\":\"input_select.home_mode\", \"option\":\"Away\" }",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 690,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "e1224e41.c57da",
        "type": "switch",
        "z": "b0242f35.84c88",
        "name": "Home/Away/Hold",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "Home",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 450,
        "y": 40,
        "wires": [
            [
                "6a199ad4.d8e794"
            ]
        ]
    },
    {
        "id": "6a199ad4.d8e794",
        "type": "api-call-service",
        "z": "b0242f35.84c88",
        "name": "Set home mode to home",
        "server": "a1cb02fa.962a9",
        "version": 1,
        "debugenabled": false,
        "service_domain": "input_select",
        "service": "select_option",
        "entityId": "input_select.home_mode",
        "data": "{ \"entity_id\":\"input_select.home_mode\", \"option\":\"Home\" }",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 690,
        "y": 40,
        "wires": [
            []
        ]
    },
    {
        "id": "8e054fff.bd3fd",
        "type": "comment",
        "z": "b0242f35.84c88",
        "name": "Is Simon home or not?",
        "info": "",
        "x": 120,
        "y": 20,
        "wires": []
    },
    {
        "id": "2b1c433f.4c393c",
        "type": "trigger-state",
        "z": "b0242f35.84c88",
        "name": "Home mode set to away",
        "server": "a1cb02fa.962a9",
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityid": "input_select.home_mode",
        "entityidfiltertype": "exact",
        "debugenabled": false,
        "constraints": [
            {
                "id": "fbbkae2wshu",
                "targetType": "this_entity",
                "targetValue": "",
                "propertyType": "current_state",
                "propertyValue": "new_state.state",
                "comparatorType": "is",
                "comparatorValueDatatype": "str",
                "comparatorValue": "Away"
            },
            {
                "id": "0dy7juhw0379",
                "targetType": "this_entity",
                "targetValue": "",
                "propertyType": "previous_state",
                "propertyValue": "old_state.state",
                "comparatorType": "is",
                "comparatorValueDatatype": "str",
                "comparatorValue": "Home"
            }
        ],
        "constraintsmustmatch": "all",
        "outputs": 2,
        "customoutputs": [],
        "outputinitially": false,
        "state_type": "str",
        "x": 130,
        "y": 200,
        "wires": [
            [
                "77178fa4.a68c3",
                "8e90cc29.447b9"
            ],
            []
        ]
    },
    {
        "id": "77178fa4.a68c3",
        "type": "api-call-service",
        "z": "b0242f35.84c88",
        "name": "Turn heating off",
        "server": "a1cb02fa.962a9",
        "version": 1,
        "debugenabled": false,
        "service_domain": "climate",
        "service": "turn_off",
        "entityId": "climate.upstairs_heating, climate.downstairs_heating",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 360,
        "y": 200,
        "wires": [
            []
        ]
    },
    {
        "id": "408805c9.0ca41c",
        "type": "trigger-state",
        "z": "b0242f35.84c88",
        "name": "Home mode set to home",
        "server": "a1cb02fa.962a9",
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityid": "input_select.home_mode",
        "entityidfiltertype": "exact",
        "debugenabled": false,
        "constraints": [
            {
                "id": "0v23otcyuneg",
                "targetType": "this_entity",
                "targetValue": "",
                "propertyType": "current_state",
                "propertyValue": "new_state.state",
                "comparatorType": "is",
                "comparatorValueDatatype": "str",
                "comparatorValue": "Home"
            },
            {
                "id": "vocp0fe8uda",
                "targetType": "this_entity",
                "targetValue": "",
                "propertyType": "previous_state",
                "propertyValue": "old_state.state",
                "comparatorType": "is",
                "comparatorValueDatatype": "str",
                "comparatorValue": "Away"
            }
        ],
        "constraintsmustmatch": "all",
        "outputs": 2,
        "customoutputs": [],
        "outputinitially": false,
        "state_type": "str",
        "x": 130,
        "y": 360,
        "wires": [
            [
                "8a2a76d8.c4cbe8"
            ],
            []
        ]
    },
    {
        "id": "8a2a76d8.c4cbe8",
        "type": "api-call-service",
        "z": "b0242f35.84c88",
        "name": "Turn heating on",
        "server": "a1cb02fa.962a9",
        "version": 1,
        "debugenabled": false,
        "service_domain": "climate",
        "service": "set_hvac_mode",
        "entityId": "climate.upstairs_heating, climate.downstairs_heating",
        "data": "{\"hvac_mode\":\"auto\"}",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 360,
        "y": 360,
        "wires": [
            []
        ]
    },
    {
        "id": "8e90cc29.447b9",
        "type": "api-current-state",
        "z": "b0242f35.84c88",
        "name": "Is lounge lamp on?",
        "server": "a1cb02fa.962a9",
        "version": 1,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "override_topic": false,
        "entity_id": "light.lounge_lamp",
        "state_type": "str",
        "state_location": "payload",
        "override_payload": "msg",
        "entity_location": "data",
        "override_data": "msg",
        "blockInputOverrides": false,
        "x": 370,
        "y": 247,
        "wires": [
            [
                "1cf8b0fb.0ad38f"
            ],
            []
        ]
    },
    {
        "id": "1cf8b0fb.0ad38f",
        "type": "api-call-service",
        "z": "b0242f35.84c88",
        "name": "Turn lounge lamp off",
        "server": "a1cb02fa.962a9",
        "version": 1,
        "debugenabled": false,
        "service_domain": "light",
        "service": "turn_off",
        "entityId": "light.lounge_lamp",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 590,
        "y": 248,
        "wires": [
            []
        ]
    },
    {
        "id": "6762ea4c.fda034",
        "type": "comment",
        "z": "b0242f35.84c88",
        "name": "If no one is home turn heating and lights off.",
        "info": "",
        "x": 190,
        "y": 160,
        "wires": []
    },
    {
        "id": "dab9b5c1.0cb918",
        "type": "comment",
        "z": "b0242f35.84c88",
        "name": "When returning home turn heating on.",
        "info": "",
        "x": 170,
        "y": 320,
        "wires": []
    },
    {
        "id": "a1cb02fa.962a9",
        "type": "server",
        "z": "",
        "name": "Home Assistant",
        "addon": true
    }
]

I’m unfortunately unable to import your flow, as I’m using the latest version. I’m positive that the answer is in there too. :man_facepalming:t3:

Thanks!

Have you tried like this?

image