Help with setting a variable defining which device was last active


#1

I’m totally lost here…

I’m trying to create a piston that will define a variable declaring which motion sensor was last active.

This is not working, and I have a feeling is not even close…

Ultimately what I’m trying to do is get my echo announcements to play in the room with the most recent motion sensor activity.

I don’t want to use “is active”, because theoretically I could still be in the room, but out of the eye of the motion sensor.

I’m open to suggestions if anyone else is handling this a different way.


#2

I have a piston for each room updating a global variable if there is motion and a timer that removes itself from the global device variable after a set amount of time.

I started off doing it within one piston but in the end I just settled with one piston per room, less headache.


#3

Would you mind sharing that piston? I can’t seem to think out of the box…thanks for your help


#4

here’s what i came up with…

I can program which echo speaks announcements based on the @motion global variable value…


#5

I’m going to post mine when I get to a PC.


#6

This is similar, but easier to update when you add more motion sensors. You just specify them all in one local variable and the piston will subscribe to all of their events.