Add test and bugfix

This commit is contained in:
Stephen Tierney 2021-02-06 20:32:17 +11:00 committed by steve
parent 251889a9e2
commit b65cc21212
2 changed files with 23 additions and 14 deletions

View file

@ -18,23 +18,23 @@ CONF_WFAC = 'wfac'
UNIT_COUNTS = '#'
UNIT_UVI = 'UVI'
ltr390_gain_t = ltr390_ns.enum('ltr390_gain_t')
LTR390GAIN = ltr390_ns.enum('LTR390GAIN')
GAIN_OPTIONS = {
"X1": ltr390_gain_t.LTR390_GAIN_1,
"X3": ltr390_gain_t.LTR390_GAIN_3,
"X6": ltr390_gain_t.LTR390_GAIN_6,
"X9": ltr390_gain_t.LTR390_GAIN_9,
"X18": ltr390_gain_t.LTR390_GAIN_18,
"X1": LTR390GAIN.LTR390_GAIN_1,
"X3": LTR390GAIN.LTR390_GAIN_3,
"X6": LTR390GAIN.LTR390_GAIN_6,
"X9": LTR390GAIN.LTR390_GAIN_9,
"X18": LTR390GAIN.LTR390_GAIN_18,
}
ltr390_resolution_t = ltr390_ns.enum('ltr390_resolution_t')
LTR390RESOLUTION = ltr390_ns.enum('LTR390RESOLUTION')
RES_OPTIONS = {
20: ltr390_resolution_t.LTR390_RESOLUTION_20BIT,
19: ltr390_resolution_t.LTR390_RESOLUTION_19BIT,
18: ltr390_resolution_t.LTR390_RESOLUTION_18BIT,
17: ltr390_resolution_t.LTR390_RESOLUTION_17BIT,
16: ltr390_resolution_t.LTR390_RESOLUTION_16BIT,
13: ltr390_resolution_t.LTR390_RESOLUTION_13BIT,
20: LTR390RESOLUTION.LTR390_RESOLUTION_20BIT,
19: LTR390RESOLUTION.LTR390_RESOLUTION_19BIT,
18: LTR390RESOLUTION.LTR390_RESOLUTION_18BIT,
17: LTR390RESOLUTION.LTR390_RESOLUTION_17BIT,
16: LTR390RESOLUTION.LTR390_RESOLUTION_16BIT,
13: LTR390RESOLUTION.LTR390_RESOLUTION_13BIT,
}
CONFIG_SCHEMA = cv.Schema({
@ -47,7 +47,7 @@ CONFIG_SCHEMA = cv.Schema({
cv.Optional(CONF_UV): sensor.sensor_schema(UNIT_COUNTS, ICON_BRIGHTNESS_5, 1),
cv.Optional(CONF_GAIN, default="X3"): cv.enum(GAIN_OPTIONS),
cv.Optional(CONF_RESOLUTION, default="18"): cv.enum(RES_OPTIONS),
cv.Optional(CONF_RESOLUTION, default=18): cv.enum(RES_OPTIONS),
cv.Optional(CONF_WFAC, default=1.0): cv.float_range(min=1.0),
}).extend(cv.polling_component_schema('60s')).extend(i2c.i2c_device_schema(0x53))

View file

@ -565,6 +565,15 @@ sensor:
humidity:
name: 'Living Room Humidity 6'
update_interval: 15s
- platform: ltr390
uv:
name: "LTR390 UV"
uvi:
name: "LTR390 UVI"
light:
name: "LTR390 Light"
als:
name: "LTR390 ALS"
- platform: max6675
name: 'Living Room Temperature'
cs_pin: GPIO23