From 586e36906d204978087648851cffdb31e1c659fd Mon Sep 17 00:00:00 2001
From: Otto Winter <otto@otto-winter.com>
Date: Thu, 8 Apr 2021 14:37:55 +0200
Subject: [PATCH] Fix sensor.sensor_schema interface changed (#1659)

---
 esphome/components/sensor/__init__.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/esphome/components/sensor/__init__.py b/esphome/components/sensor/__init__.py
index a10c5d7326..c5df0ca97c 100644
--- a/esphome/components/sensor/__init__.py
+++ b/esphome/components/sensor/__init__.py
@@ -1,4 +1,5 @@
 import math
+from typing import Optional
 
 import esphome.codegen as cg
 import esphome.config_validation as cv
@@ -180,8 +181,12 @@ SENSOR_SCHEMA = cv.MQTT_COMPONENT_SCHEMA.extend(
 )
 
 
-def sensor_schema(unit_of_measurement_, icon_, accuracy_decimals_, device_class_):
-    # type: (str, str, int, str) -> cv.Schema
+def sensor_schema(
+    unit_of_measurement_: str,
+    icon_: str,
+    accuracy_decimals_: int,
+    device_class_: Optional[str] = DEVICE_CLASS_EMPTY,
+) -> cv.Schema:
     schema = SENSOR_SCHEMA
     if unit_of_measurement_ != UNIT_EMPTY:
         schema = schema.extend(