Hi,
I just discovered Voice Monkey yesterday when I googled your kind of lock.
What did you try to use for triggering the routines?
Since you later (at 3.) were telling Alexa can control your lock by what I think are actions, my suggestion is to trigger two Alexa routines by so called monkeys from VM (Voice Monkey) which would lock/unlock the lock and another routine which toggles the state of a dummy device, when the former actions were fired.
I use a Nuki lock for which I neither need the Nuki Skill, dummy device nor Voice Monkey 'cause its state is directly polled from the lock. I have two buttons who trigger shell_commands for lock/unlocking it and they also reflecting the state of the lock:
Based on this buttons I gave it quick shot and used a similar code but with VM and rest_commands
.
Clicking the HA button starts a script which triggers a VM monkey → which triggers an Alexa routine via the VM Skill → which fires the lock action. When the lock action completes another Alexa routine fires an action to toggle the state of a dummy light, which also changes the color of the circles in both buttons.
The chain HA buttons/script → VM monkeys → Alexa VM Skill → Alexa routine → than triggering the lock or a dummy light is surprisingly fast, but it takes a certain amount of time until the lock itself finishes…
How to start?
Register with Voice Monkey, create two monkeys and install the VM Skill.
Create two routines in Alexa, look in Smart Home
for the two monkeys you created (you might have to refresh the view in Alexa to see them) and use them as trigger. As action use the lock/unlock actions of the lock.
For the unlocking action I understand you need to send use a voice command (Alexa says?) a TTS message with the unlock code.
If this is working, means if the monkeys trigger your lock from the Manage Monkeys
page, you create two other routines which toggles the state of a proxy device HA is able to “see”/read - in the example code below it’s light.virtual_dummy
.
The trigger for this routines is the lock/unlock action of the lock and as action toggle the dummy light.
Now you can create two buttons in HA which trigger the monkeys by rest_commands (via scripts), locking/unlocking the lock and reflecting its state, respectively the state of its proxy.
Here’s the code for the buttons (I am not the creator of this code, I just altered it for this case):
type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: custom:button-card
tap_action:
action: call-service
service: script.dummyon
service_data: null
color_type: card
color: white
icon: hass:lock
name: locked
styles:
card:
- background-color: rgb(131,131,131)
- border-radius: 5%
- padding: 10%
- color: white
- font-size: 14px
- text-shadow: 0px 0px 0px black
- text-transform: capitalize
grid:
- position: relative
custom_fields:
notification:
- background-color: |
[[[
if (states['light.virtual_dummy'].state == 'on')
return "green";
return "red";
]]]
- border-radius: 50%
- position: absolute
- left: 60%
- top: 10%
- height: 28px
- width: 28px
- font-size: 0px
- line-height: 20px
custom_fields:
notification: |
[[[ return Math.floor(states['light.virtual_dummy'].state) ]]]
- type: custom:button-card
tap_action:
action: call-service
service: script.dummyoff
service_data: null
color_type: card
color: white
icon: hass:lock-open
name: unlocked
styles:
card:
- background-color: rgb(131,131,131)
- border-radius: 5%
- padding: 10%
- color: white
- font-size: 14px
- text-shadow: 0px 0px 0px black
- text-transform: capitalize
grid:
- position: relative
custom_fields:
notification:
- background-color: |
[[[
if (states['light.virtual_dummy'].state == 'off')
return "green";
return "red";
]]]
- border-radius: 50%
- position: absolute
- left: 60%
- top: 10%
- height: 28px
- width: 28px
- font-size: 0px
- line-height: 20px
custom_fields:
notification: |
[[[ return Math.floor(states['light.virtual_dummy'].state) ]]]
Create two scripts and use them in the above code.
dummyon:
alias: DummyOn
sequence:
- service: rest_command.trigger_monkey1
mode: single
dummyoff:
alias: DummyOff
sequence:
- service: rest_command.trigger_monkey2
mode: single
The rest_commands in my rest_commands.yaml
#voice monkey
trigger_monkey1:
url: https://api.voicemonkey.io/trigger
method: POST
verify_ssl: true
content_type: 'application/json; charset=utf-8'
payload: !secret monkey_payload_1
trigger_monkey2:
url: https://api.voicemonkey.io/trigger
method: POST
verify_ssl: true
content_type: 'application/json; charset=utf-8'
payload: !secret monkey_payload_2
The payloads used in secrets.yaml
, calling the monkeys dummyon
& dummyoff
(insert your tokens and the names of your monkeys)
monkey_payload_1: '{"access_token":"ATOKEN","secret_token":"STOKEN","monkey":"dummyon"}'
monkey_payload_2: '{"access_token":"ATOKEN","secret_token":"STOKEN","monkey":"dummyoff"}'
Good luck.