When calender is off, send msg when person is home

Hi.
My goal with this automation is to send a message to the phone the first time person is home after “work time”.
It should just trigger first arrival after work, and not trigger if the calendar hasn’t been on (changed to off).

  • calendar.samayeh_turnus is on in the planed work-time, and off in the planed free-time
  • person.samayeh is home when home, and not_home when away
  • mobile_app_samayeh_sin_iphone is the phone to notify

This is what I have, but it is not working.:


JSON:

[{"id":"61bd339573e1c67d","type":"ha-wait-until","z":"cbdda1d3e0543731","name":"Wait until person.samayeh = home","server":"ce440416.77f1e8","version":0,"outputs":1,"entityId":"person.samayeh","entityIdFilterType":"exact","property":"attributes.state","comparator":"is","value":"home","valueType":"str","timeout":0,"timeoutType":"num","timeoutUnits":"seconds","entityLocation":"","entityLocationType":"none","checkCurrentState":true,"blockInputOverrides":true,"x":580,"y":2180,"wires":[["58cdd4ac8656ef2c"]]},{"id":"606103b8a6649b0f","type":"server-state-changed","z":"cbdda1d3e0543731","name":"calendar.samayeh_turnus off?","server":"ce440416.77f1e8","version":3,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"calendar.samayeh_turnus","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"off","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":0,"forType":"num","forUnits":"minutes","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":260,"y":2180,"wires":[["61bd339573e1c67d"],[]]},{"id":"58cdd4ac8656ef2c","type":"api-call-service","z":"cbdda1d3e0543731","name":"Notify Samayeh","server":"ce440416.77f1e8","version":3,"debugenabled":false,"service_domain":"notify","service":"mobile_app_samayeh_sin_iphone","entityId":"","data":"{\t   \"message\":\"Test Message\",\t   \"title\":\"Welcome Home\"\t}","dataType":"jsonata","mergecontext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":840,"y":2180,"wires":[[]]},{"id":"ce440416.77f1e8","type":"server","name":"Home Assistant","version":1,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true}]

I think the problem is the “Wait until” node, but i can’t find out what.
Tried both empty, attributes.state and state in Wait Until. I think it is waiting forever.
Anyone know?

It should be state in wait until.
But, I don’t know if this is just some translation thing, but my states of person is “Home” and “not_home” when I look in developer tools.
I know device trackers say “home”, but perhaps this is actually “Home”?

I’m not home now so I can only see the history.

I will try to send myself a message for each this evening then :slight_smile:

Make the debug complete message instead.
And make three of them, one for each “line”. That way it will be easier for you to debug it.

Like this?

That will make it easy for sure.

Sometimes when you connect to many nodes to one debug it’s hard to know what route the message took.
Now each node will trigger a debug. That will be messy in the debug window, but you can trace it using the node name in the upper corner, I think you just need to click on the node name of the debug message and it will highlight where it is.

One of your nodes is in waiting mode. Maybe you need to disable it and enable it again to clear it for the test.

I just copypasted the node and removed the old one, should be ok now (btw, how do I disable/enable?)

Double click on the node to get the properties, at the bottom there is a enable/disable.

But you need to disable then send out the update… I can’t remember what it’s called, but clicking the red button. Then enable and click it again.

And you know you can just set the states in developer tools.
You don’t have to wait for her to come home.

You can just set the calendar to off, then her to home.
Then just reset it to on and work if you need to test again.

I had to use device_tracker connected to the person to test, and i now hink I got it. :slight_smile:

This one is the one that worked (smal h):

Wait Until: state
is: home

Now I just have to wait for the real-life test :slight_smile:
PS: Disable/Enable did not reset the node, but duplicating worked.

Huh… It usually works for me.
But then again I don’t think I have ever tried to reset a wait until node.

If there is more than one thing in the calendar then this could fire multiple times.
You could solve that with a trigger node, so that it only lets through the first message of the day

Thanks.
It worked also i reality :smiley: