diff --git a/.gitignore b/.gitignore index 04181b6..9412e45 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,10 @@ console_logger.py test.py __pycache__ + +# IDE configurations +/.idea + +# Development environment +/.venv +/venv diff --git a/README.md b/README.md index b7ecc2e..2574753 100644 --- a/README.md +++ b/README.md @@ -63,12 +63,12 @@ The default entity names are listed below. Note that some entities can be missed ### water_heater.*kettle_model* This is main entity to control water boiling and heating. There are five operation modes: -* Off - the kettle is off, not heating at all. -* Heat - just heat water to the desired temperature and keep this temperature. Without boiling. Useful when water already boiled and you need just to warm it up. -* Boil - boil water and turn off (switch to "Off" mode). -* Boil+heat - boil water, wait until temperature drops to the desired temperature and keep this temperature. -* Lamp - use kettle as night light, color changes between the selected ones (see below). -* Light - use kettle as night light but keep the only one selected color (see below). +* `off` - the kettle is off, not heating at all. +* `heat` - just heat water to the desired temperature and keep this temperature. Without boiling. Useful when water already boiled and you need just to warm it up. +* `boli` - boil water and turn off (switch to "Off" mode). +* `boil_heat` - boil water, wait until temperature drops to the desired temperature and keep this temperature. +* `lamp` - use kettle as night light, color changes between the selected ones (see below). +* `light` - use kettle as night light but keep the only one selected color (see below). ### light.*kettle_model*_light (Light) This entity allows to control the "Light" mode. You can select brightness and color when this mode is active. The "Light" mode will be enabled automatically when this virtual light is on. @@ -112,7 +112,7 @@ Diagnostic entity, shows percent of successfull connections and polls. sequence: - service: water_heater.set_operation_mode data: - operation_mode: Boil + operation_mode: boil target: entity_id: water_heater.skykettle_rk_g211 ``` @@ -131,7 +131,7 @@ sequence: sequence: - service: water_heater.set_operation_mode data: - operation_mode: Boil+Heat + operation_mode: boil_heat target: entity_id: water_heater.skykettle_rk_g211 - service: water_heater.set_temperature diff --git a/custom_components/skykettle/icons.json b/custom_components/skykettle/icons.json new file mode 100644 index 0000000..b74ea21 --- /dev/null +++ b/custom_components/skykettle/icons.json @@ -0,0 +1,24 @@ +{ + "entity": { + "water_heater": { + "skykettle": { + "default": "mdi:kettle", + "state": { + "off": "mdi:kettle-off" + }, + "state_attributes": { + "operation_mode": { + "default": "mdi:kettle-off", + "state": { + "boil": "mdi:kettle-steam", + "boil_heat": "mdi:kettle-steam-outline", + "heat": "mdi:heat-wave", + "lamp": "mdi:lightbulb-night", + "light": "mdi:lightbulb" + } + } + } + } + } + } +} diff --git a/custom_components/skykettle/manifest.json b/custom_components/skykettle/manifest.json index ac3c313..34a47f5 100644 --- a/custom_components/skykettle/manifest.json +++ b/custom_components/skykettle/manifest.json @@ -3,8 +3,9 @@ "name": "SkyKettle", "codeowners": ["@clusterm"], "config_flow": true, - "dependencies": ["bluetooth_adapters", "bleak_retry_connector"], + "dependencies": ["bluetooth_adapters"], "documentation": "https://github.com/ClusterM/skykettle-ha/blob/master/README.md", + "integration_type": "device", "iot_class": "local_polling", "issue_tracker": "https://github.com/ClusterM/skykettle-ha/issues", "requirements": [], diff --git a/custom_components/skykettle/skykettle.py b/custom_components/skykettle/skykettle.py index 1356301..cd120a6 100644 --- a/custom_components/skykettle/skykettle.py +++ b/custom_components/skykettle/skykettle.py @@ -50,11 +50,11 @@ class SkyKettle(): MODE_LAMP = 0x03 MODE_GAME = 0x04 MODE_NAMES = { - MODE_BOIL: "Boil", - MODE_HEAT: "Heat", - MODE_BOIL_HEAT: "Boil+Heat", - MODE_LAMP: "Lamp", - MODE_GAME: "Light" + MODE_BOIL: "boil", + MODE_HEAT: "heat", + MODE_BOIL_HEAT: "boil_heat", + MODE_LAMP: "lamp", + MODE_GAME: "light" } LIGHT_BOIL = 0x00 diff --git a/custom_components/skykettle/translations/en.json b/custom_components/skykettle/translations/en.json index 3092fa2..272abd0 100644 --- a/custom_components/skykettle/translations/en.json +++ b/custom_components/skykettle/translations/en.json @@ -48,5 +48,20 @@ } } } + }, + "entity": { + "water_heater": { + "skykettle": { + "name": "Kettle", + "state": { + "off": "Off", + "boil": "Boiling", + "boil_heat": "Boiling + Heating", + "heat": "Heating", + "lamp": "Nightlight", + "light": "Light" + } + } + } } } diff --git a/custom_components/skykettle/translations/ru.json b/custom_components/skykettle/translations/ru.json index 57b8038..4a91d54 100644 --- a/custom_components/skykettle/translations/ru.json +++ b/custom_components/skykettle/translations/ru.json @@ -49,5 +49,20 @@ } } } + }, + "entity": { + "water_heater": { + "skykettle": { + "name": "Чайник", + "state": { + "off": "Выключено", + "boil": "Кипячение", + "boil_heat": "Кипячение + Подогрев", + "heat": "Подогрев", + "lamp": "Ночник", + "light": "Подсветка" + } + } + } } } diff --git a/custom_components/skykettle/translations/water_heater.en.json b/custom_components/skykettle/translations/water_heater.en.json deleted file mode 100644 index e7572c5..0000000 --- a/custom_components/skykettle/translations/water_heater.en.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "entity_component": { - "_": { - "state": { - "off": "Off", - "Boil": "Boiling", - "Boil+Heat": "Boiling + Heating", - "Heat": "Heating", - "Lamp": "Lamp", - "Light": "Light" - } - } - } -} diff --git a/custom_components/skykettle/translations/water_heater.ru.json b/custom_components/skykettle/translations/water_heater.ru.json deleted file mode 100644 index 9e0dcbd..0000000 --- a/custom_components/skykettle/translations/water_heater.ru.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "entity_component": { - "_": { - "state": { - "off": "Выключено", - "Boil": "Кипячение", - "Boil+Heat": "Кипячение + Подогрев", - "Heat": "Подогрев", - "Lamp": "Светильник", - "Light": "Подсветка" - } - } - } -} diff --git a/custom_components/skykettle/water_heater.py b/custom_components/skykettle/water_heater.py index b6bf139..192a977 100644 --- a/custom_components/skykettle/water_heater.py +++ b/custom_components/skykettle/water_heater.py @@ -23,6 +23,9 @@ async def async_setup_entry(hass, entry, async_add_entities, discovery_info=None class SkyWaterHeater(WaterHeaterEntity): """Representation of a SkyKettle water_heater device.""" + _attr_has_entity_name = True + _attr_name = None + _attr_translation_key = "skykettle" def __init__(self, hass, entry): """Initialize the water_heater device.""" @@ -44,15 +47,6 @@ def kettle(self): def unique_id(self): return self.entry.entry_id + "_water_heater" - @property - def name(self): - """Name of the entity.""" - return (FRIENDLY_NAME + " " + self.entry.data.get(CONF_FRIENDLY_NAME, "")).strip() - - @property - def icon(self): - return "mdi:kettle" - @property def device_class(self): return None