Skip to content

Commit

Permalink
Add beverage selector options to translations
Browse files Browse the repository at this point in the history
Signed-off-by: Serge Arbuzov <[email protected]>
  • Loading branch information
Arbuzov committed Nov 18, 2023
1 parent e633679 commit f8f0e71
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 27 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@


[![Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=Arbuzov&repository=home_assistant_delonghi_primadonna&category=integration)


[![Open your Home Assistant instance and start setting up a new integration.](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=home_assistant_delonghi_primadonna)

![Company logo](https://brands.home-assistant.io/delonghi_primadonna/logo.png)
Expand Down
4 changes: 4 additions & 0 deletions custom_components/delonghi_primadonna/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
hass.data[DOMAIN] = {}
delonghi_device = DelongiPrimadonna(entry.data, hass)
hass.data[DOMAIN][entry.unique_id] = delonghi_device
_LOGGER.warning('Device id %s', entry.unique_id)
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

async def make_beverage(call: ServiceCall) -> None:
_LOGGER.warning('Make beverage %s', call.data)
await delonghi_device.beverage_start(call.data['beverage'])

hass.services.async_register(
Expand All @@ -47,6 +49,8 @@ async def make_beverage(call: ServiceCall) -> None:
make_beverage,
schema=vol.Schema({
vol.Required('beverage'): vol.In([*AvailableBeverage]),
vol.Optional('entity_id'): vol.Coerce(str),
vol.Optional('device_id'): vol.Coerce(str),
})
)

Expand Down
1 change: 1 addition & 0 deletions custom_components/delonghi_primadonna/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def __init__(self):


BEVERAGE_COMMANDS = {
AvailableBeverage.NONE: BeverageCommand(DEBUG, DEBUG),
AvailableBeverage.STEAM: BeverageCommand(STEAM_ON, STEAM_OFF),
AvailableBeverage.LONG: BeverageCommand(LONG_ON, LONG_OFF),
AvailableBeverage.COFFEE: BeverageCommand(COFFE_ON, COFFE_OFF),
Expand Down
2 changes: 1 addition & 1 deletion custom_components/delonghi_primadonna/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
"documentation": "https://github.com/Arbuzov/home_assistant_delonghi_primadonna",
"iot_class": "local_polling",
"issue_tracker": "https://github.com/Arbuzov/home_assistant_delonghi_primadonna/issues",
"version": "1.5.3-beta"
"version": "1.5.3"
}
3 changes: 3 additions & 0 deletions custom_components/delonghi_primadonna/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ make_beverage:
# supported_features:
# - delonghi_primadonna.BeverageEntityFeature.MAKE_BEVERAGE
fields:
entity_id:
description: "some select"
example: "someexample"
beverage:
name: Beverage
description: Beverage to prepare
Expand Down
45 changes: 32 additions & 13 deletions custom_components/delonghi_primadonna/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,6 @@
"name": "Turn on"
}
},
"services": {
"make_beverage": {
"name": "Make beverage",
"description": "Prepare a beverage from the list below",
"fields": {
"beverage": {
"name": "Beverage",
"description": "Beverage to prepare"
}
}
}
},
"switch": {
"cup_light": {
"name": "Cup light"
Expand All @@ -66,5 +54,36 @@
"name": "Sounds"
}
}
},
"services": {
"make_beverage": {
"name": "Make beverage",
"description": "Prepare a beverage from the list below",
"fields": {
"beverage": {
"name": "Beverage",
"description": "Beverage to prepare"
},
"entity_id": {
"name": "Entity ID",
"description": "Entity ID of the coffee machine"
}
}
}
},
"selector": {
"beverage": {
"options": {
"none": "None",
"steam": "Steam",
"long": "Long",
"coffee": "Coffee",
"dopio": "Dopio",
"hot_water": "Hot water",
"espresso": "Espresso",
"americano": "Americano",
"espresso2": "Espresso 2"
}
}
}
}
}
45 changes: 32 additions & 13 deletions custom_components/delonghi_primadonna/translations/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,6 @@
"name": "Включить"
}
},
"services": {
"make_beverage": {
"name": "Приготовить напиток",
"description": "Приготовить напиток из заданного списка",
"fields": {
"beverage": {
"name": "Напиток",
"description": "Напиток который будет приготовлен"
}
}
}
},
"switch": {
"cup_light": {
"name": "Подсветка чашки"
Expand All @@ -66,5 +54,36 @@
"name": "Звук кнопок"
}
}
},
"services": {
"make_beverage": {
"name": "Приготовить напиток",
"description": "Приготовить напиток из заданного списка",
"fields": {
"beverage": {
"name": "Напиток",
"description": "Напиток который будет приготовлен"
},
"entity_id": {
"name": "Сущность",
"description": "Сущность которая будет использована для приготовления напитка"
}
}
}
},
"selector": {
"beverage": {
"options": {
"none": "Нет",
"steam": "Пар",
"long": "Лунго",
"coffee": "Кофе",
"dopio": "Допио",
"hot_water": "Горячая вода",
"espresso": "Эспрессо",
"americano": "Американо",
"espresso2": "Эспрессо 2"
}
}
}
}
}

0 comments on commit f8f0e71

Please sign in to comment.