Custom TTS welcome messages for individual door lock key code users, via SmartThings bridge


#1

I’m new to HA, coming from a SmartThings setup previously. One thing I find lacking in HA and OpenZWave is support for door locks. Sure, you can lock and unlock most models but a lot of the other info presented by the device isn’t made available. One feature I love in SmartThings comes from a custom SmartApp called “Lock multi user management with notifications and automatic relock”. Among other things it allows for different automations based on what user code was used to unlock a door. Because I’m not skilled enough to write something like that in HA or OZW, I decided to use my ST hub to make it happen.

First I link HA with ST, and for that there is the famous Smartthings MQTT Bridge. This makes all devices in ST available to HA and vice-versa. The next challenge is making the unique unlock events available outside of the SmartApp, where they are fairly limited. This was easily solved by creating simulated switches for each user, (“Unlock Trigger Mom”, etc), in the ST IDE and then setting the SmartApp to turn on said switches when the user unlocks the door. To make those events available outside of ST, I include them into the MQTT Bridge SmartApp. Great, now the events are exposed to HA!

In my config file I then setup automations for each user such that they are greeted by a custom message on the Google Home each time they unlock the door. It also resets the switch in ST so it’s ready to go next time. Pretty simple and looks like this for my son who happens to also be a Ninja Turtle:

  - alias: Silas Unlock Routine
    trigger:
      platform: mqtt
      topic: smartthings/Unlock Trigger Silas/switch
      payload: 'on'
    action:
      - service: media_player.volume_set
        entity_id: media_player.living_room_home
        data:
          volume_level: 0.7
      - service: tts.google_say
        entity_id: media_player.living_room_home
        data:
          message: 'Welcome home Leonardo! Cowabunga Dude!'
      - service: mqtt.publish
        data:
          topic: 'smartthings/Unlock Trigger Silas/switch'
          payload: 'off'

There is a several second delay due to all the high latency things happening here but it’s actually perfect because that gives time for the person to enter first. One nice thing about this versus a presence tracking version is that it works for people who don’t have presence tracking established at my house. for example, my young son who doesn’t carry a phone, my mom, or even guests. I’ve been thinking of another good use for this at a friend’s house who has an AirBnb rental. She assigns a door code for guests when she can’t be there to greet them personally. It would be cool to have a welcome and basic instruction message for those instances.

Overall, this is pretty sweet and goes to show why HA is so awesome! It also shows me that there are still some things that my SmartThings hub does better and it’s fine to keep using the best of both platforms together. One day, I’d like to see better support for these features in OZW and HA and hope to acquire the skills to contribute to them.

Let me know if you like the project and if you have any ideas to improve it! Thanks!


I did it. I defeated the horrible Google Home "cast-start" prompt sound!
MQTT issues with sensors
#2

Amazingly elegant approach. I had been looking for a way to recognize individual door codes within HA and this solves it. Thank you so much for this!


#3

Great idea @hoffsta. I am migrating from ST now and also miss this feature. Question for you though? In ST how did you get the simulated swtich trigger from the user code of your lock? Did you use something like CoRE (or WebCore)?


#4

The SmartApp I linked in the original post takes care of that. It’s not free but I use it primarily because I already purchased it for quickly managing door codes for a vacation rental. I think there are other lock manager SmartApps out there that can do the same thing. I don’t think CORE alone can do it because it requires a custom device handler to expose the user.


#5

Okay I missd that. I already have it setup to do notifications based on the user in ST. I have my lock setup using the “Z-Wave Lock” DH but then to deal with it I use CoRE. As I trigger in a piston I use:

**Lock List** - name of lock
**Attribute** - lock
**Comparison** - changes to
**Value** - unlocked
**Interation** - Programmatic
**By user code(s)**) - Choose the code # 

Then you just add a **When true, do** and I guess now in this case turn on the corresponding virutal switch.

Thanks for the great idea though. Can’t wait to implement this idea in HA though.