Franck Nijhof c464056402
Making our website faster, cleaner and prettier (#9853)
* 🔥 Removes octopress.js

* 🔥 Removes use of root_url var

* 🔥 Removes Octopress generator reference from feed

* 🔥 Removes delicious support

* 🔥 Removes support for Pinboard

* 🔥 Removes support for Disqus

* 🔥 Removes support for Google Plus

* ↩️ Migrate custom after_footer to default template

* ↩️ Migrate custom footer to default template

* ↩️ Migrate custom header to default template

* 🔥 Removes unused template files

* 🚀 Places time to read directly in post template

* 🚀 Removes unneeded capture from archive_post.html template

* 🔥 🚀 Removes unused, but heaving sorting call in component page

* 🚀 Merged javascripts into a single file

* 🔥 Removes more uses of root_url

* 🚀 Removal of unneeded captures from head

* 🔥 🚀 Removal of expensive liquid HTML compressor

* 🔥 Removes unneeded templates

* 🚀 Replaces kramdown with GitHub's CommonMark 🚀

* 💄 Adds Prism code syntax highlighting

*  Adds support for redirect in Netlify

* ↩️ 🔥 Let Netlify handle all developer doc redirects

* ✏️ Fixes typo in redirects file: Netify -> Netlify

* 🔥 Removes unused .themes folder

* 🔥 Removes unused aside.html template

* 🔥 Removes Disqus config leftover

* 🔥 Removes rouge highlighter config

* 🔥 Removes Octopress 🎉

* 💄 Adjust code block font size and adds soft wraps

* 💄 Adds styling for inline code blocks

* 💄 Improve styling of note/warning/info boxes + div support

* 🔨 Rewrites all note/warning/info boxes
2019-07-15 22:17:54 +02:00

2.0 KiB

title, description, logo, ha_category, ha_iot_class, ha_release, ha_qa_scale, redirect_from
title description logo ha_category ha_iot_class ha_release ha_qa_scale redirect_from
OTP Sensor Instructions on how to add One-Time Password (OTP) sensors into Home Assistant. home-assistant.png
Utility
Local Polling 0.49 internal
/components/sensor.otp/

The otp sensor generates One-Time Passwords according to RFC6238 that is compatible with most OTP generators available, including Google Authenticator. You can use this when building custom security solutions and want to use "rolling codes", that change every 30 seconds.

Configuration

To enable the OTP sensor, add the following lines to your configuration.yaml:

# Example configuration.yaml entry
sensor:
  - platform: otp
    token: SHARED_SECRET_TOKEN

{% configuration %} name: description: Name of the sensor to use in the frontend. required: false default: OTP Sensor type: string token: description: The shared secret you use in your OTP generator (e.g., Google Authenticator on your phone). required: true type: string {% endconfiguration %}

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 server 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.