Skip to content

Commit

Permalink
Fixed deprecation warning for device category
Browse files Browse the repository at this point in the history
  • Loading branch information
CJNE committed Mar 10, 2022
1 parent e50a8f4 commit 4941a6b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions custom_components/myenergi/entity.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""MyenergiEntity class"""
import logging

from homeassistant.helpers.entity import EntityCategory
from homeassistant.helpers.update_coordinator import CoordinatorEntity

from .const import DOMAIN
Expand All @@ -18,6 +19,8 @@ def __init__(self, coordinator, device, config_entry, meta=None):
self.meta = {"attrs": {}}
else:
self.meta = meta
if self.meta.get("category", None) is not None:
self.meta["category"] = EntityCategory(self.meta["category"])

@property
def device_info(self):
Expand Down Expand Up @@ -68,6 +71,9 @@ def __init__(self, coordinator, config_entry, meta):
self.config_entry = config_entry
self.coordinator = coordinator
self.meta = meta
if meta is not None:
if self.meta.get("category", None) is not None:
self.meta["category"] = EntityCategory(self.meta["category"])

@property
def device_info(self):
Expand Down

0 comments on commit 4941a6b

Please sign in to comment.