Skip to content

Commit

Permalink
Refactor Delonghi Primadonna device and select
Browse files Browse the repository at this point in the history
modules

Signed-off-by: Serge Arbuzov <info@whitediver.com>
  • Loading branch information
Arbuzov committed Nov 16, 2023
1 parent 65ff499 commit fe3d305
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion custom_components/delonghi_primadonna/device.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Delongi primadonna device description"""
import asyncio
from enum import IntFlag
import logging
import uuid
from binascii import hexlify
from enum import IntFlag

from bleak import BleakClient
from bleak.exc import BleakDBusError, BleakError
Expand Down
9 changes: 4 additions & 5 deletions custom_components/delonghi_primadonna/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from .const import AVAILABLE_PROFILES, DOMAIN, POWER_OFF_OPTIONS
from .device import (AvailableBeverage,
BeverageEntityFeature,
DelonghiDeviceEntity,
DelongiPrimadonna)
from .device import (AvailableBeverage, BeverageEntityFeature,
DelonghiDeviceEntity, DelongiPrimadonna)

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -62,7 +60,8 @@ class BeverageSelect(DelonghiDeviceEntity, SelectEntity):
_attr_current_option = [*AvailableBeverage][0]
_attr_translation_key = 'make_beverage'
_attr_icon = 'mdi:coffee'
_attr_supported_features: BeverageEntityFeature = BeverageEntityFeature.MAKE_BEVERAGE
_attr_supported_features: BeverageEntityFeature \
= BeverageEntityFeature.MAKE_BEVERAGE

async def async_select_option(self, option: str) -> None:
"""Select beverage action"""
Expand Down
2 changes: 1 addition & 1 deletion custom_components/delonghi_primadonna/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ make_beverage:
default: "none"
selector:
select:
translation_key: "fan_speed"
# translation_key: "make_beverage"
options:
- "none"
- "steam"
Expand Down
6 changes: 6 additions & 0 deletions custom_components/delonghi_primadonna/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
"name": "Включить"
}
},
"services": {
"beverage": {
"name": "Напиток",
"description": "Приготовить напиток"
}
},
"switch": {
"cup_light": {
"name": "Подсветка чашки"
Expand Down

0 comments on commit fe3d305

Please sign in to comment.