Was using webcore but it is no longer working on smartthings.
I was trying to start a piston when a certain code is used to unlock the lock then it will send to voice monkey and then to Alexa. Cannot see where you can set up
Many drivers report the code ID that was used as part of the âextra dataâ of an event:
And HTTP Actions can be used to communicate with the Voice Monkey API:
Sorry still having a difficult time figuring it out. Basically want user code 2 to send http.
Can you share more details about what youâve tried so far?
The first link in my reply above has more details and an example rule screenshot.
I am using the "Alexa Multi-trigger " device in ST to enable sending the info to Alexa:
I have a variable set up in Sharptools to set the $User variable depending on the code from the lock:
I have a rule in Sharptools that checks the codename sent from the lock: $context.event.data.codeName
Based on the value in $User I turn on the appropriate Alexa Multi-trigger switch in my rule:
Then in Alexa I announce âWelcome HomeâŚâ if the switch is turned on:
I suppose there may be other ways (and maybe simpler) of doing this, but this is what I was able to figure out on my own and it works for me.
Why type of variable. Text number
Antonio Stifano
Thanks for sharing, @John_Kelton !
As John demonstrated with his rule and as shown in your WebCoRE example, you would normally want to trigger off the door lock
attribute changing to unlocked
In Johnâs case, it looks like he has named each of the codes, so heâs accessing the codeName
within the extra event data, but if you want the codeId
, you would adjust your rule accordingly.
â
Hereâs a video showing how to set it up. I originally intended this as a brief video, but I guess I got a bit carried away showing a few approaches!
I see that youâre replying via email. Make sure to check the video included in my last reply which walks through the whole process end to endâŚ
Thanks. I will try and figure it out that way.
I got that working.
However I was working on another rule with the lock. Just wanted when any code was pressed it would turn on a light between sunset and sundown. However light turns on all the time and the lock doesnât work
properly. It will trigger the light even unlocking manually.
Thanks for sharing the screenshots. The rule in your screenshots doesnât appear to be configured that way.
I would strongly recommend reading through some of the documentation on the Rule Engine as that will give you a good understanding of the fundamentals of how rules work in SharpTools:
Keep in mind that rules are triggered when any of the configured trigger events occur. So in your case, the rule will run at 10 minutes after sunset, then again 10 minutes before sunrise, and anytime the Back Door lock
attribute value changes.
When the rule is triggered, it will execute the Rule Flow from top-to-bottom.
So the first action that sets the variable $Code
wonât work as expected with the sunset and sunrise trigger since those wonât have a $context.event.data.Method
. (Furthermore, you may need to use the lowercase method
instead of Method
unless your lock reports that value in a non-standard way).
Then when the IF Condition block is hit, the rule will check if that Lamp switch
is off
or the time is after Sunset or the time is before sunrise or the $Code
is Keypad
. When any of those conditions are true, it will proceed to the then path and take the actions youâve configured. Keep in mind that you can edit the IF Condition block and change it to AND instead of OR.
So youâll want to make sure that the conditions are configured as you would expect and make sure to adjust them accordingly - I suspect you wanted to AND some of the conditions together and perhaps nest a condition for before sunrise or after sunset. Similar to the capitalization of the data attribute name mentioned above, youâll want to double check that the reported value is correct as itâs usually a lowercase keypad
.
PS. For future reference, you can use the Rule Screenshot feature to get a single screenshot for the whole rule that is easier to share.
Thank you.
Antonio Stifano
I have been reading posts. I havenât seen anything with locks and time. I have tried trigger with sunset and sunrise. I have tried if commands with sunset and sunrise. Doesnât seem to work. If I remove the sunset and sunrise the rule works. Not sure if I can use time with locks.
Thereâs no restrictions around using time with locks.
If I understand what you are looking for correctly, you would want to remove the sunset/sunrise triggers, then use a nested condition for the time.
Triggers
'Back Door - lock' changes to 'unlocked'
Flow
IF '$context.event.data.method' is 'keypad'
AND 'Lamp - switch' is 'off'
THEN
IF 'Current Time' is before 'Sunrise'
OR 'Current Time' is after 'Sunset'
THEN
Command: 'Lamp' 'on()'
Delay '600 seconds'
Command 'Lamp' 'off()'
Pay particular attention to the use of OR vs AND conditions in the example above and the use of nesting.
The logic above would say that anytime the Back Door is unlocked, we should run the flow. If the method that was used to unlock was keypad and the lamp is currently off, then run the nested condition to check if the time is before sunrise or after sunset. Only if both sets of conditions are true, then the innermost set of commands would run to turn the light on, wait 600 seconds, then turn it back off.
Why nested conditions?
The reason we are using nested conditions here is you want to mix AND logic with OR logic. So in the outer condition, we have all of the conditions that we need to AND together (eg. unlocked with keypad and the light is off). Then only if thatâs true will it check the nested IF condition.
And we need to use an OR condition with the time as we want the rule to continue to run when itâs either before sunrise or after sunset⌠and since we want to mix that with two conditions that must both be true (eg. AND), we use a separate condition for those.
Other Thoughts
Keep in mind that this kind of logic where you turn something on, wait, then turn it back off can also be tricky.
If the door gets unlocked multiple times in a short period of time, youâll have two executions of the rule running.
So the first will turn the light on and start waiting 10 minutes. Then if another occurs within the 10 minutes, it will turn the light on (no effect since itâs already on) and start waiting 10 minutes.
But the timer from the first run would hit first and turn the lamp off before the second timer hits.
t0 t10
on() â wait(10m) â off()
^
t1 | t11
on() â wait(10m) | â off()
|
|
//The light gets turned off at t10 from the first execution
// which is 1 minute short of when you might have expected
// it to turn off based on the second execution
That looks close. Youâll likely want to use an OR condition in the nested condition though.
Tap the âEditâ button at the bottom of the IF Condition block, then scroll up to the top of the IF Condition block and change from âallâ (AND) to âanyâ (OR), then save the IF condition block.
Thanks. Itâs working
Antonio Stifano