Need advice on using Echo with motion sensor


#23

I would suggest something like this:

if motion changes to active
then
   send announcement
end if
While motion is active
    wait 2 minutes        <--never cancel tasks
    send announcement
end while

The only issue will be if the motion ca=hanges to inactive and back to active within the two minutes. Blocking that would require more complex logic.


#24

Therein lies the problemā€¦ the idea is to prevent multiple announcements, due to the location of the sensor. The Sensor will definitely change from active to inactive to active to inactive multiple times when someone is moving about the garage. It seems like a 2 minute cooldown period would be a simple thing, but so far it isnā€™t.


#25

And moving the Sensor is not an option.


#26

As long as someone is moving about, it should never go to inactive. Usually, you need to be still for 30+ seconds for it to go to inactive but it depends on your DTH. If you really want to block no matter what, I would suggest something like:

datetime notifyTimer

if motion changes to active
then
   cancel all pending tasks
   if $now>notifyTimer
   then
      send announcement
      set variable notifyTime=addMinutes($now,2)
   end if
end if
While motion is active
    wait 2 minutes        <--never cancel tasks
    send announcement
    set variable notifyTime=addMinutes($now,2)
end while

#27

The Sensor is located about 7 feet / a little over 2 meters from the south wall of the garage and.points north. Our freezer and my beer fridge sit against the south wall, so the sensor frequently cycles from active to inactive and back to active.


#28

Ahh, we see the source of the problem now. LOL

OK, see if my logic above helps. I think you need a ā€˜cancel all pending tasksā€™ in the first if to keep things straight. I edited my post above to show where.


#29

Forgive my ignorance, but how do I insert the ā€˜cancel all pending tasksā€™ command? Iā€™m trying to insert an anonymized snapshot, but itā€™s not working. I was able to get the anonymized piston ID, itā€™s ooxzs.


#32

try under LOCATION


#33

To add a bit to what Ike saidā€¦ Notice this command is in the ā€œgenericā€ section (non-device).

pic

This means this command should be available in nearly all blocks.
(Location, Lightbulb, Motion Sensor, Switch, Thermostat, etc)


#34

Iā€™m beyond frustrated.l appreciate your help, but itā€™s like weā€™re speaking two different languages. I understand mostlyo when itā€™s in a Piston, but arrows and dashes are frustrating me to no end. .I canā€™t make sense of it. I havenā€™t been doing this long.


#35

Iā€™m done for now. I canā€™t even get a freaking anonomized snapshot to load.


#36

In my opinion, webCoRE is much easier to program on a full PC browser.


#37

lol, we moved almost 3 years ago. My PC is still sitting in my closet.


#38

I get by quite well without it, between my phone and 2 tablets.


#39

Sorryā€¦ I was referring to this:

ā€¦ and this:

I was suggesting to look at the Dashboard from another device, operating system or browserā€¦
(It will likely resolve your UI issues)


#40

I understand.


#41

Hereā€™s what I have:


#42

It looks good, but one small change is required.

On line 17, you can edit the variable up top to say (no value set)

pic

Doing this will allow the body of the piston to write new data to that variable.


#43

Hereā€™s how it looks now:

And the Log:

Logs

7/8/2020, 1:40:44 PM +697ms
+1ms ā•”Received event [227].test = 1594230044697 with a delay of 0ms
+65ms ā•‘RunTime Analysis CS > 22ms > PS > 23ms > PE > 20ms > CE
+68ms ā•‘Runtime (38298 bytes) successfully initialized in 23ms (v0.3.110.20191009) (66ms)
+69ms ā•‘ā•”Execution stage started
+80ms ā•‘ā•‘Condition #4 evaluated false (6ms)
+82ms ā•‘ā•‘Condition group #3 evaluated false (state did not change) (8ms)
+84ms ā•‘ā•šExecution stage complete. (15ms)
+85ms ā•šEvent processed successfully (85ms)


#44

Iā€™m at work (using my work computer with Windows Vista, meh), so I canā€™t really test it until I get home. Will let you know how it turns out.