One-Time Password (OTP)
The otp
integration集成将 Home Assistant 与您的设备、服务等连接和集成。 [Learn more] generates One-Time Passwords according to RFC6238
配置
要将 One-Time Password (OTP) integration 添加到您的 Home Assistant 实例中,请使用此 My 按钮:
手动配置步骤
如果上述 My 按钮不起作用,您也可以手动执行以下步骤:
-
浏览到您的 Home Assistant 实例。
-
转到
设置 > 设备与服务。 -
在右下角,选择
Add Integration 按钮。 -
从列表中选择 One-Time Password (OTP)。
-
按照屏幕上的说明完成设置。
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.