Node Red automation

I created this node-red automation about a year ago and now i have a slight hiccup. When I leave in the morning and the TV is off once my device tracker leaves the property it turns on the TV. This is happens because the home.zone is changing from (2) to (1). I have a node that states if >=1 turn on TV. The thought process I have is when it goes from “0” to “1” turn on the TV because someone at this point should be arriving at the house. Please see logs below. Any suggestions would be greatly appreciated.

Screenshot 2024-12-11 210844
971×295 16.9 KB

Garage Door Light turned off

5:49:56 AM - 15 hours ago

LIving Room TV turned on

5:45:57 AM - 15 hours ago

LIving Room TV turned on

5:45:57 AM - 15 hours ago

Derek boolean away triggered by state of Derek Witcher was detected away

5:45:49 AM - 15 hours ago - Traces

Home changed to 1

5:45:49 AM - 15 hours ago

Derek boolean away triggered by state of Derek Phone was detected away

5:45:49 AM - 15 hours ago - Traces

Everyone home changed to Away triggered by state of Derek Phone was detected away

5:45:49 AM - 15 hours ago

Derek Witcher was detected away

5:45:49 AM - 15 hours ago

To have it trigger only when the previous state is zero, you can use jsonata.

image

$prevEntity().state = 0 and $entity().state > 0

Let me give that a try and I will let you know.

Thanks