Fix bad metrics format for short metrics. (#13778)

This commit is contained in:
Michael Kutý authored and Fabian Affolter committed 2018-04-10 08:20:47 +02:00
1 parent bd93f10d3c
commit 7ea776dff4
1 file changed
+3
+3
View File
@@ -185,6 +185,9 @@ class Metrics(object):
unit = state.attributes.get(ATTR_UNIT_OF_MEASUREMENT)
metric = state.entity_id.split(".")[1]
if '_' not in str(metric):
metric = state.entity_id.replace('.', '_')
try:
int(metric.split("_")[-1])
metric = "_".join(metric.split("_")[:-1])