virtual-keys

hacs_badge

Create login link for Home Assistant that you can share with guests.

image

Installation

HACS installation

You need to install HACS first.

Because HACS doesn't support both Integration and Plugin in the same repository, you need to install it twice, once as an Integration and once as a Plugin (Lovelace).

  • add "Custom repositories" to HACS, paste the URL of this repository and select "Lovelace" as category

  • go to HACS -> Frontend, Explore and Download Repositories, search for "virtual keys" and install it

  • in HACS "Custom repositories" delete the URL of this repository

  • add "Custom repositories" to HACS, paste the URL of this repository and this time select "Integration" as category

  • go to HACS -> Integrations, Explore and Download Repositories, search for "virtual keys" and install it

  • add to configuration.yaml:

virtual_keys:

panel_custom:
  - name: virtual-keys-panel
    require_admin: true
    url_path: virtual-keys
    sidebar_title: Virtual Keys
    sidebar_icon: mdi:key-variant
    module_url: /local/community/virtual-keys/virtual-keys.js
  • restart Home Assistant

Use case

I want to share a "virtual key" with my friends that is valid for a limited time and that they can use to access specific entities in Home Assistant like the fron gate. The key is actually a link to my Home Assistant that can be opened in a browser.

To make this work, I need to make some additional steps (after installing Virtual Keys):

  • create a new user in Home Assistant eg. "guest"

  • create a new group eg. "guests" and add the user "guest" to it, and also the devices you want to give access to, eg "cover.front_gate", instructions here

  • create a new View (tab) in the default Lovelace UI and add the entities you want to give access to, eg. "cover.front_gate", set the visibility to only show to user "guest".

  • install kiosk-mode and configure it set "kiosk" mode for user "guest"

Ths is it, you can now create Virtual Keys and share the link.