1
0
mirror of https://github.com/elisspace/core.git synced 2026-08-31 16:34:00 +00:00

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

This commit is contained in:
Michael Kutý
2018-04-10 08:20:47 +02:00
committed by Fabian Affolter
parent bd93f10d3c
commit 7ea776dff4

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])