I’m trying to figure out how to get the unlocking user registerd after upgrading to zwave.js.
While listening to zwave_js_event i get this response. How can i use this in an template to set who the user is?
"event_type": "zwave_js_event",
"data": {
"type": "notification",
"domain": "zwave_js",
"node_id": 35,
"home_id": xxxxxxxxx,
"device_id": "xxxxxxxxxxxxxx",
"label": "Keypad unlock operation",
"parameters": {
"userId": 5 <==== The user i want ==========
}
}
In openZwave i got this with a sensor from the lock and this code:
{% set mapper = {
'0':'Master',
'1':'User1',
'2':'User2',
'3':'User3',
'4':'User4',
'5':'User5'} %}
{% set selection = trigger.event.data') %}
{{ mapper[selection] if selection in mapper else 'error' }}
I’m sorry but I’m confused with this. I am moving from automations that took the friendly name from the binary_sensor that the lock code triggered…. Are you putting this map in an automation and replacing the name? Like:
message: “{{mapper}}’s key unlocked the front door”
Could I please see your action section of an automation because I’m having trouble figuring out how to lay this out in my message template.
EDIT: Nvm, I think I got it… I’ll update with the code when I’m done thanks… I’m not sure why I was confused anymore…
Hi, it was not my intention to make U upset. But with your suggestion it didn’t work, this due to small difference. So I thank you for your help in the right direction.
I’m not upset.
But I’m 100% sure that my suggestion is correct, it’s equivalent to the one you marked as a solution.
You put some double quotes around it yourself, which made it not work.
The difference that made it work is that parameters is without [ ] and that the numbers that give user is without single quotes. So my double quotes had nothing to do with it. The only thing I did with mark as solution is that I wanted to show what suggestion that worked for me.
Thanks for your feedback, I now understand this form of template a little better. My automation now work as intended and I’m happy with that. Thank you for your help.
/Andreas