mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 17:27:19 +00:00
Update sensor.otp.markdown (#2990)
* Update sensor.otp.markdown * Minor changes and add container name
This commit is contained in:
parent
a24e142eaf
commit
f493074f7c
@ -34,11 +34,17 @@ Configuration variables:
|
|||||||
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:
|
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:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ pip install pyotp
|
$ pip3 install pyotp
|
||||||
$ python -c 'import pyotp; print("Token: " + pyotp.random_base32())'
|
$ python3 -c 'import pyotp; print("Token:", pyotp.random_base32())'
|
||||||
Token: IHEDPEBEVA2WVHB7
|
Token: IHEDPEBEVA2WVHB7
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To run in a Docker container:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
$ 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.
|
Copy and paste the token into your Home Assistant configuration and add it to your OTP generator. Verify that they generate the same code.
|
||||||
|
|
||||||
<p class='note warning'>
|
<p class='note warning'>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user