Skip to content

Commit 69184b7

Browse files
mehumanfabaff
authored andcommitted
Update sensor.otp.markdown (home-assistant#2990)
* Update sensor.otp.markdown * Minor changes and add container name
1 parent bb3bffd commit 69184b7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

source/_components/sensor.otp.markdown

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,17 @@ Configuration variables:
3434
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:
3535

3636
```shell
37-
$ pip install pyotp
38-
$ python -c 'import pyotp; print("Token: " + pyotp.random_base32())'
37+
$ pip3 install pyotp
38+
$ python3 -c 'import pyotp; print("Token:", pyotp.random_base32())'
3939
Token: IHEDPEBEVA2WVHB7
4040
```
4141

42+
To run in a Docker container:
43+
44+
```shell
45+
$ docker exec -it home-assistant python -c 'import pyotp; print("Token:", pyotp.random_base32())'
46+
Token: IHEDPEBEVA2WVHB7
47+
```
4248
Copy and paste the token into your Home Assistant configuration and add it to your OTP generator. Verify that they generate the same code.
4349

4450
<p class='note warning'>

0 commit comments

Comments
 (0)