Here is a screen shot of my flow. Do I need to modify it show the input is managed through the state node you created that puts Derek or Melissa leaves?
If you use the below in a trigger state node, the 1st ouptut will only happen if both are “off” otherwise the 2nd output will be used.
You can then turn the TV off/on linking to the appropriate output.
If I read your flow correctly, the pair of nodes should replace all of the top left four in your flow, and can go straight to your ‘away’ and ‘living room tv off’ service call nodes.
I would suggest that you try and keep the names of your nodes correct for what they are doing - you have nodes called “Home” and “Away” for both leaving and arriving and it is difficult to read.
@mikep99 is correct that a trigger node can be used to do this, and that would probably be the best answer for you here. How you do something like this depends on personal choice - the trigger node is powerful, but the condition tests are all ‘AND’, which is fine in your case, but for ‘OR’ conditions it is necessary to use JSONata to perform the conditional test. For myself, I like to use JSONata when I can.
There are other ways that you could improve on this flow, however getting it to work is the first key step and then you can come back and improve it later.
It looked good on paper but for some reason it did not work. If I click either of the input_boolean.derek or input_boolean.melissa independently it still turns off the TV and Away is activated. The Home seems to work just fine.
Any suggestions?
Since zones was updated, there is a new entity called zone.home
, that is what @NathanCu is referencing. Rather than use input booleans to mark weather you are home or not create a person in HA for each of you.
For each person add their device tracker/s. You do not need to use gps unless you want to. I use a bluetooth and wifi sensor.
Once that is done zone.home
will return a number of how many persons are home. So >= 1
someone is home. < 1
no one is home.
I am not sure if I have missed something or not. But I have tried to make this a simple as you guys have shown me. In my zone.home it shows (2) persons (person.derek) & (person.melissa). I have setup the events state node that when the zone.home is <1 turn off the TV. If I go to the developers tools and change state from Home to Away on both device trackers Living Room TV does not get triggered. But below the events state node there is s little red 2 underneath.
Change the state of zone.home
to 0
. It does not have a state of home or away, it will always be a number. It is a count of how many people are home.
So lets try to have you guys give me the best way to achieve my goals. I am still new to this whole “HA & NR” interaction.
Goal #1
When myself or my wife comes home turn on “Living Room TV” since we usually do not come home at the same time I need to make sure when the other party comes home that the automation to turn on “Living Room TV” does not get duplicated and then turn off TV.
Goal #2
When both of us leave turn off “Living Room TV” but once again we usually do not leave at the same time so if one of us leaves do not turn off TV until both parties are gone. Sometimes one of us maybe be home and the other party may go to the store and come back so we don’t want to duplicate a automation when they leave and come back while the other party was home the whole time.
You can disregard anything I have already started if you feel I am not headed down the best path.
Mike’s solution above already does this.
You’re fighting two concepts here.
First the concept of whole home occupancy.
You do this as described by adding trackers to person objecs and then tracking the numeric state of the home zone.
All the this should be setup and WORKING (at least reviewing dev tools - you should be able to see the count.
Once all this is setup you either use builtin automations or in this case node red. You chose node red.
This flow will start on a numeric state for the home zone. State changes will be sent. I’d probably put a condition node with options for >=1, <1, and error state. Your greater than branch is home. Trigger your return stuff. Other branch is away. Trigger the away.
Make sure all the first part works before you try to setup the node red flow to respond to it. Have you made sure that part works?
To Everybody who assisted thanks. I was able to setup the automation with just (3) nodes. Wow. Now that I finally was able to get that up and running would love to have more insight on some of your automations you use for your house.
Looking for a little help. Just did the latest update and now my NR / HA automation is no longer working. I was using zone.home to trigger turning on / off my TV based on if there was anybody home. It used to show how many people were home based on a numeric value in the zone.home. Now it just shows running all the time. If I change the If state <=1 it turns off the TV. If I change it to =>1 it turns it back on like it is supposed to. Why would the zone.home state not be working anymore? I also have the “Ignore state change event when:” Current state equals previous state. “Ticked”
updated what…?
HA updates have a breaking change that now requires the latest version of the Node Red Companion integration (v3.1.7 or better).
Replace deprecated HomeAssistantType with HomeAssistant
I am running v3.1.9
Interesting. There isn’t a version 3.1.9
3.1.7 with the fix, then 4.0.0 being the latest
Understood.
That is Node-RED
I am talking about the HA Node-RED Companion integration in HA that communicates back to Node-RED.
There has been a change in HA to deprecate HomeAssistantType. When I updated my HA, my NR stuff fell over as the companion was trying to talk HomeAssistantType, and it now needs to talk HomeAssistant.
Fixed by updating the NR Companion. At least for me it did.
Awesome. Where do I do that?
https://github.com/zachowj/hass-node-red?tab=readme-ov-file#installation
I assume you have this integration installed in HA. I assume it needs updating…
I greatly appreciate the help on the update. But unfortunately that did not solve the problem.