1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-25 05:03:52 +01:00

Convert sensor_schema to use kwargs (#2094)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Otto Winter
2021-08-01 12:21:32 +02:00
committed by GitHub
parent 81ae6709e4
commit 5c65f9f9ad
115 changed files with 1337 additions and 1371 deletions

View File

@@ -6,7 +6,6 @@ from esphome.const import (
CONF_ID,
CONF_OVERSAMPLING,
CONF_RANGE,
DEVICE_CLASS_EMPTY,
ICON_MAGNET,
STATE_CLASS_MEASUREMENT,
STATE_CLASS_NONE,
@@ -80,10 +79,16 @@ def validate_enum(enum_values, units=None, int=True):
field_strength_schema = sensor.sensor_schema(
UNIT_MICROTESLA, ICON_MAGNET, 1, DEVICE_CLASS_EMPTY, STATE_CLASS_MEASUREMENT
unit_of_measurement=UNIT_MICROTESLA,
icon=ICON_MAGNET,
accuracy_decimals=1,
state_class=STATE_CLASS_MEASUREMENT,
)
heading_schema = sensor.sensor_schema(
UNIT_DEGREES, ICON_SCREEN_ROTATION, 1, DEVICE_CLASS_EMPTY, STATE_CLASS_NONE
unit_of_measurement=UNIT_DEGREES,
icon=ICON_SCREEN_ROTATION,
accuracy_decimals=1,
state_class=STATE_CLASS_NONE,
)
CONFIG_SCHEMA = (