diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index cf6d74b..469a379 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.9", "3.10"] + python-version: ["3.11"] steps: - uses: actions/checkout@v2 diff --git a/custom_components/reef_pi/__init__.py b/custom_components/reef_pi/__init__.py index 2269373..6f20082 100644 --- a/custom_components/reef_pi/__init__.py +++ b/custom_components/reef_pi/__init__.py @@ -7,6 +7,7 @@ from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from homeassistant.exceptions import ConfigEntryAuthFailed +from homeassistant.helpers.entity import DeviceInfo from async_timeout import timeout from datetime import timedelta @@ -134,22 +135,18 @@ def __init__(self, hass, session, config_entry): ) @property - def device_info(self): - info = { - 'identifiers': { + def device_info(self) -> DeviceInfo: + + return DeviceInfo( + configuration_url = self.configuration_url, + identifiers={ (DOMAIN, self.unique_id) }, - 'default_name': self.default_name, - 'default_manufacturer': MANUFACTURER, - "default_model" : "Reef PI", - "configuration_url": self.configuration_url - } - if self.info: - info['model'] = self.info["model"] - info['sw_version'] = self.info["version"] - info['name'] = self.info["name"] - info['default_name'] = self.info["name"] - return info + manufacturer = MANUFACTURER, + model = self.info["model"] if self.info["model"] else "Reef PI", + name = self.info["name"] if self.info["name"] else self.default_name, + sw_version = self.info["name"] if self.info["name"] else None, + ) async def update_capabilities(self): _LOGGER.debug("Fetching capabilities") diff --git a/custom_components/reef_pi/manifest.json b/custom_components/reef_pi/manifest.json index 33ee590..c793374 100644 --- a/custom_components/reef_pi/manifest.json +++ b/custom_components/reef_pi/manifest.json @@ -1,6 +1,6 @@ { "domain": "reef_pi", - "version": "0.3.6", + "version": "0.3.7", "name": "Reef PI Integration", "config_flow": true, "documentation": "https://github.com/tdragon/reef-pi-hass-custom", @@ -13,7 +13,8 @@ ], "dependencies": [], "codeowners": [ - "@tdragon", "@alex255" + "@tdragon", + "@alex255" ], "iot_class": "local_polling" -} +} \ No newline at end of file diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..2f4c80e --- /dev/null +++ b/pytest.ini @@ -0,0 +1,2 @@ +[pytest] +asyncio_mode = auto diff --git a/requirements_test.txt b/requirements_test.txt index 2e28e57..b4f72b6 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,4 +1,4 @@ httpx>=0.21.0 pytest>=6.2.5 -pytest-homeassistant-custom-component==0.12.21 +pytest-homeassistant-custom-component==0.13.56 pytest-asyncio>=0.19