mirror of
https://github.com/esphome/esphome.git
synced 2025-09-02 19:32:19 +01:00
Fix filter_out: nan filer (#486)
* Fix filter_out nan filter Fixes https://github.com/esphome/issues/issues/138 * Add test
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from collections import OrderedDict
|
||||
import math
|
||||
|
||||
from esphome.core import CORE, HexInt, Lambda, TimePeriod, TimePeriodMicroseconds, \
|
||||
TimePeriodMilliseconds, TimePeriodSeconds, TimePeriodMinutes
|
||||
@@ -260,6 +261,8 @@ class FloatLiteral(Literal):
|
||||
self.float_ = value
|
||||
|
||||
def __str__(self):
|
||||
if math.isnan(self.float_):
|
||||
return u"NAN"
|
||||
return u"{:f}f".format(self.float_)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user