Skip to content

Commit

Permalink
Set correct entity category for all entites #25
Browse files Browse the repository at this point in the history
  • Loading branch information
ufozone committed Feb 24, 2024
1 parent 4e766a6 commit 5bc41b6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion custom_components/unifi_voucher/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
ButtonEntity,
ButtonEntityDescription,
)
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity import (
Entity,
EntityCategory,
)

from .const import (
DOMAIN,
Expand Down Expand Up @@ -62,6 +65,7 @@ async def async_setup_entry(
icon="mdi:update",
translation_key="update",
device_class=ButtonDeviceClass.UPDATE,
entity_category=EntityCategory.DIAGNOSTIC,
press_action=lambda coordinator: coordinator.async_update_vouchers(),
),
]
Expand Down
6 changes: 5 additions & 1 deletion custom_components/unifi_voucher/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
ImageEntity,
ImageEntityDescription,
)
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity import (
Entity,
EntityCategory,
)

import homeassistant.util.dt as dt_util

Expand All @@ -42,6 +45,7 @@ async def async_setup_entry(
translation_key=ATTR_QR_CODE,
icon="mdi:qrcode",
device_class=None,
entity_category=EntityCategory.DIAGNOSTIC,
),
]

Expand Down
8 changes: 7 additions & 1 deletion custom_components/unifi_voucher/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
NumberEntity,
NumberEntityDescription,
)
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.entity import (
Entity,
EntityCategory,
)

from .const import (
DOMAIN,
Expand All @@ -36,18 +39,21 @@ async def async_setup_entry(
key=CONF_VOUCHER_QUOTA,
icon="mdi:numeric-9-plus",
translation_key=CONF_VOUCHER_QUOTA,
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=CONF_VOUCHER_DURATION,
icon="mdi:clock-outline",
native_unit_of_measurement=UnitOfTime.HOURS,
translation_key=CONF_VOUCHER_DURATION,
entity_category=EntityCategory.CONFIG,
),
NumberEntityDescription(
key=CONF_VOUCHER_USAGE_QUOTA,
icon="mdi:database-sync",
native_unit_of_measurement=UnitOfInformation.MEGABYTES,
translation_key=CONF_VOUCHER_USAGE_QUOTA,
entity_category=EntityCategory.CONFIG,
),
]

Expand Down

0 comments on commit 5bc41b6

Please sign in to comment.