Fix SQL sensor (#67144)

This commit is contained in:
Paulus Schoutsen 2022-02-23 16:21:24 -08:00 committed by GitHub
parent 6364e81be5
commit fff74c66ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,7 @@
from __future__ import annotations
from datetime import date
import decimal
import logging
import re
@ -158,7 +159,7 @@ class SQLSensor(SensorEntity):
_LOGGER.debug("result = %s", res.items())
data = res[self._column_name]
for key, value in res.items():
if isinstance(value, float):
if isinstance(value, decimal.Decimal):
value = float(value)
if isinstance(value, date):
value = value.isoformat()