Fix Datadog boolean metrics (#37273)

Explicitly cast boolean metrics to integers
This commit is contained in:
Rick Sherman authored and GitHub committed 2020-07-05 12:50:51 -05:00
1 parent 992793295c
commit b56f4bd9f8
2 files changed
+4 -2

No files matched your search

@@ -82,6 +82,7 @@ def setup(hass, config):
for key, value in states.items():
if isinstance(value, (float, int)):
attribute = f"{metric}.{key.replace(' ', '_')}"
value = int(value) if isinstance(value, bool) else value
statsd.gauge(attribute, value, sample_rate=sample_rate, tags=tags)
_LOGGER.debug("Sent metric %s: %s (tags: %s)", attribute, value, tags)