mirror of
https://github.com/esphome/esphome.git
synced 2024-12-29 17:47:51 +01:00
Fix sensor.sensor_schema interface changed (#1659)
This commit is contained in:
parent
e6f8e73705
commit
586e36906d
@ -1,4 +1,5 @@
|
|||||||
import math
|
import math
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
import esphome.codegen as cg
|
import esphome.codegen as cg
|
||||||
import esphome.config_validation as cv
|
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_):
|
def sensor_schema(
|
||||||
# type: (str, str, int, str) -> cv.Schema
|
unit_of_measurement_: str,
|
||||||
|
icon_: str,
|
||||||
|
accuracy_decimals_: int,
|
||||||
|
device_class_: Optional[str] = DEVICE_CLASS_EMPTY,
|
||||||
|
) -> cv.Schema:
|
||||||
schema = SENSOR_SCHEMA
|
schema = SENSOR_SCHEMA
|
||||||
if unit_of_measurement_ != UNIT_EMPTY:
|
if unit_of_measurement_ != UNIT_EMPTY:
|
||||||
schema = schema.extend(
|
schema = schema.extend(
|
||||||
|
Loading…
Reference in New Issue
Block a user