Skip to content
This repository has been archived by the owner on Apr 30, 2022. It is now read-only.

Commit

Permalink
Use classifiers instead of resource type IDs (#23)
Browse files Browse the repository at this point in the history
Co-authored-by: Harley Watson <[email protected]>
  • Loading branch information
technofreak74 and unlobito authored May 15, 2021
1 parent 73f9345 commit b2c4f2a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions custom_components/hildebrandglow/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def handle_failed_auth(config: ConfigEntry, hass: HomeAssistant) -> None:
glow = hass.data[DOMAIN][entry]
resources = await hass.async_add_executor_job(glow.retrieve_resources)
for resource in resources:
if resource["resourceTypeId"] in GlowConsumptionCurrent.resourceTypeId:
if resource["classifier"] in GlowConsumptionCurrent.knownClassifiers:
sensor = GlowConsumptionCurrent(glow, resource)
new_entities.append(sensor)

Expand All @@ -62,10 +62,7 @@ class GlowConsumptionCurrent(Entity):

hass: HomeAssistant

resourceTypeId = [
"ea02304a-2820-4ea0-8399-f1d1b430c3a0", # Smart Meter, electricity consumption
"672b8071-44ff-4f23-bca2-f50c6a3ddd02", # Smart Meter, gas consumption
]
knownClassifiers = ["gas.consumption", "electricity.consumption"]

available = True

Expand Down

0 comments on commit b2c4f2a

Please sign in to comment.