One-Time Password (OTP)
The otp
integrationIntegrations connect and integrate Home Assistant with your devices, services, and more. [Learn more] generates One-Time Passwords according to RFC6238
Configuration
To add the One-Time Password (OTP) integration to your Home Assistant instance, use this My button:
Manual configuration steps
If the above My button doesn’t work, you can also perform the following steps manually:
-
Browse to your Home Assistant instance.
-
In the bottom right corner, select the
Add Integration button. -
From the list, select One-Time Password (OTP).
-
Follow the instructions on screen to complete the setup.
Generating a token
A simple way to generate a token
for a new sensor is to run this snippet of Python code in your Home Assistant virtual environment:
$ pip3 install pyotp
$ python3 -c 'import pyotp; print("Token:", pyotp.random_base32())'
Token: IHEDPEBEVA2WVHB7
To run in a Docker container:
$ docker exec -it home-assistant python -c 'import pyotp; print("Token:", pyotp.random_base32())'
Token: IHEDPEBEVA2WVHB7
Copy and paste the token into your Home Assistant configuration and add it to your OTP generator. Verify that they generate the same code.
It is vital that your system clock is correct both on your Home Assistant instance and on your OTP generator device (e.g., your phone). If not, the generated codes will not match! Make sure NTP is running and syncing your time correctly before creating an issue.