Skip to content

Commit

Permalink
Generate entity_id to fix #20
Browse files Browse the repository at this point in the history
  • Loading branch information
toreamun committed Dec 28, 2021
1 parent bc73e37 commit 9d749de
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions custom_components/amshan/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from amshan.autodecoder import AutoDecoder
import amshan.obis_map as obis_map
from homeassistant import util
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
Expand Down Expand Up @@ -279,6 +280,10 @@ def __init__(
self._scale_factor = (
int(scale_factor) if scale_factor == floor(scale_factor) else scale_factor
)
self.entity_id = (
"sensor."
f"{self._meter_info.manufacturer}_{util.slugify(entity_description.name)}"
).lower()

@staticmethod
def is_measure_id_supported(measure_id: str) -> bool:
Expand Down

0 comments on commit 9d749de

Please sign in to comment.