Door unocked alert based on usedCode


#1

I have a front door lock pester piston that sends a text and an audible “spoken” alert over google home when someone forgets to lock the door, and repeats every 5 minutes until someone locks the door.

That works, but I want to have the text message go out to the last person that unlocked the door based on which code was used to unlock the door (when possible)

3) What is happening/not happening?
When code 3 is used, and the door remains unlocked for the set time, The 2nd if statement is running, but not the first one as I intend, however {$args.usedCode} is swapping with “3” in the text message (line 53)

**4) Post a Green Snapshot of the piston)

Thank you.


#2

How is {$args.usedCode} determined? Do you have the trace logs for the piston? This quite often will clue in on the design issue. You section statement is more like a catch all statement so for some reason it is not identifying the user code 3 so it falls into the catch all even though it seems to be using 3 in the spoken text.

Last, my own question! How are you getting Google Home to initiate spoke speech from a piston?


#3

Hi,

Thanks for the reply. I’m not sure how $args.usedCode is determined, and I think that is a great question. I saw an example of someone else using it so I tried it myself… and it sort of works. I haven’t figured out how to determine which data is available in webcore when I’m building pistons, so I rely heavily on other examples. How does it know that ${args} is even talking about an argument from the door lock event?!

I’ll try to figure out how to get some logs and report back.

As far as how I’m using the google home. I’m using version .01 of smart-cast (I didn’t know there was an update until you asked)

It’s a bit hacky, and requires a server running node.js, but it works! Most people use a rasberry pi.


#4

Yea, I would think $arg would need to be defined. Im assuming its a global variable hes has defined. I could be wrong as ive never messed with $aqr. I dont see usedcode as anything defined by the system variables.

On the main piston screen set trace to ON! you will be able to see the logic it takes in the piston script. Then scroll down and set Logging level to Medium. This is where the logs will be produced. you can hit the test button at that point and it should produce some logs to look at.