mirror of
https://github.com/esphome/esphome.git
synced 2025-09-03 03:42:20 +01:00
Support SDS011 component. (#467)
* Support SDS011 component. * improve if condition * Check update interval is multiple of minute * do not allow update intervals longer than 30 min * fix sensor schema name * remove query_mode * Warn if rx_only mode used together with update interval * Allow update intervals below 1min Messed that up before, as the docs say update intervals below 1min are allowed * Use update interval in minutes * use set_update_interval_min() to set update interval
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from collections import OrderedDict
|
||||
|
||||
from esphome.core import CORE, HexInt, Lambda, TimePeriod, TimePeriodMicroseconds, \
|
||||
TimePeriodMilliseconds, TimePeriodSeconds
|
||||
TimePeriodMilliseconds, TimePeriodSeconds, TimePeriodMinutes
|
||||
from esphome.helpers import cpp_string_escape, indent_all_but_first_and_last
|
||||
|
||||
# pylint: disable=unused-import, wrong-import-order
|
||||
@@ -286,6 +286,8 @@ def safe_exp(
|
||||
return IntLiteral(int(obj.total_milliseconds))
|
||||
if isinstance(obj, TimePeriodSeconds):
|
||||
return IntLiteral(int(obj.total_seconds))
|
||||
if isinstance(obj, TimePeriodMinutes):
|
||||
return IntLiteral(int(obj.total_minutes))
|
||||
if isinstance(obj, (tuple, list)):
|
||||
return ArrayInitializer(*[safe_exp(o) for o in obj])
|
||||
raise ValueError(u"Object is not an expression", obj)
|
||||
|
Reference in New Issue
Block a user