Skip to content

Commit 327f38c

Browse files
authored
Merge pull request #12 from 0xAlon/update_deprecated_functionality
Fix deprecated functionality
2 parents b9e8da3 + f3efb60 commit 327f38c

File tree

8 files changed

+17
-15
lines changed

8 files changed

+17
-15
lines changed

custom_components/dolphin/__init__.py

100755100644
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
3939
hass.data.setdefault(DOMAIN, {})
4040
hass.data[DOMAIN][entry.entry_id] = coordinator
4141

42-
# Set up all platforms for this device/entry.
43-
for platform in PLATFORMS:
44-
hass.async_create_task(
45-
hass.config_entries.async_forward_entry_setup(entry, platform)
46-
)
42+
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
4743

4844
return True
4945

custom_components/dolphin/climate.py

100755100644
Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
from typing import Any
33
from typing import Callable, List
44
from homeassistant.config_entries import ConfigEntry
5+
from homeassistant.const import UnitOfTemperature
56
from homeassistant.helpers.entity import Entity
6-
from homeassistant.helpers.typing import HomeAssistantType
7+
import homeassistant.core
78
from homeassistant.helpers.update_coordinator import CoordinatorEntity
89
from .coordinator import UpdateCoordinator
910
from homeassistant.helpers.entity import DeviceInfo
@@ -14,7 +15,6 @@
1415
HVACMode,
1516
ClimateEntity,
1617
)
17-
from homeassistant.const import TEMP_CELSIUS
1818
from homeassistant.components.climate.const import HVACMode
1919

2020
OPERATION_LIST = [HVACMode.HEAT, HVACMode.OFF]
@@ -25,7 +25,7 @@
2525

2626

2727
async def async_setup_entry(
28-
hass: HomeAssistantType,
28+
hass: homeassistant.core.HomeAssistant,
2929
entry: ConfigEntry,
3030
async_add_entities: Callable[[List[Entity], bool], None],
3131
) -> None:
@@ -40,7 +40,10 @@ async def async_setup_entry(
4040

4141
class DolphinWaterHeater(CoordinatorEntity, ClimateEntity):
4242
_attr_hvac_modes = OPERATION_LIST
43-
_attr_temperature_unit = TEMP_CELSIUS
43+
_attr_temperature_unit = UnitOfTemperature.CELSIUS
44+
_enable_turn_on_off_backwards_compatibility = False
45+
_attr_supported_features = (ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.TURN_OFF |
46+
ClimateEntityFeature.TURN_ON)
4447

4548
def __init__(self, hass, coordinator, device):
4649
CoordinatorEntity.__init__(self, coordinator)
@@ -49,7 +52,7 @@ def __init__(self, hass, coordinator, device):
4952

5053
self._name = device
5154

52-
self._unit = TEMP_CELSIUS
55+
self._unit = UnitOfTemperature.CELSIUS
5356
self._current_temperature = None
5457
self._attr_target_temperature_step = 1
5558

@@ -132,6 +135,9 @@ def device_info(self) -> DeviceInfo:
132135
name=self.name,
133136
)
134137

138+
async def async_turn_off(self) -> None:
139+
await self.async_set_hvac_mode(HVACMode.OFF)
140+
135141
async def async_set_temperature(self, **kwargs: Any) -> None:
136142
"""Set temperature."""
137143

custom_components/dolphin/config_flow.py

100755100644
File mode changed.

custom_components/dolphin/const.py

100755100644
File mode changed.

custom_components/dolphin/coordinator.py

100755100644
File mode changed.

custom_components/dolphin/manifest.json

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
"documentation": "https://github.com/0xAlon/dolphin",
66
"issue_tracker": "https://github.com/0xAlon/dolphin",
77
"codeowners": ["@0xAlon"],
8-
"version": "1.0.0",
8+
"version": "1.0.1",
99
"iot_class": "cloud_polling"
1010
}

custom_components/dolphin/sensor.py

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from homeassistant.components.sensor import SensorEntity
44
from homeassistant.config_entries import ConfigEntry
55
from homeassistant.helpers.entity import Entity
6-
from homeassistant.helpers.typing import HomeAssistantType
6+
import homeassistant.core
77
from homeassistant.helpers.update_coordinator import CoordinatorEntity
88
from .coordinator import UpdateCoordinator
99
from homeassistant.helpers.entity import DeviceInfo, async_generate_entity_id
@@ -17,7 +17,7 @@
1717

1818

1919
async def async_setup_entry(
20-
hass: HomeAssistantType,
20+
hass: homeassistant.core.HomeAssistant,
2121
entry: ConfigEntry,
2222
async_add_entities: Callable[[List[Entity], bool], None],
2323
) -> None:

custom_components/dolphin/switch.py

100755100644
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from homeassistant.components.switch import SwitchEntity
44
from homeassistant.config_entries import ConfigEntry
55
from homeassistant.helpers.entity import Entity
6-
from homeassistant.helpers.typing import HomeAssistantType
6+
import homeassistant.core
77
from homeassistant.helpers.update_coordinator import CoordinatorEntity
88
from .coordinator import UpdateCoordinator
99
from homeassistant.helpers.entity import DeviceInfo, async_generate_entity_id
@@ -17,7 +17,7 @@
1717

1818

1919
async def async_setup_entry(
20-
hass: HomeAssistantType,
20+
hass: homeassistant.core.HomeAssistant,
2121
entry: ConfigEntry,
2222
async_add_entities: Callable[[List[Entity], bool], None],
2323
) -> None:

0 commit comments

Comments
 (0)