mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +00:00
Fix bad metrics format for short metrics. (#13778)
This commit is contained in:
parent
bd93f10d3c
commit
7ea776dff4
@ -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])
|
||||
|
Loading…
x
Reference in New Issue
Block a user