mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 01:38:02 +00:00
Bump aiocomelit to 0.3.0 (#102340)
* Bump aiocomelit to 0.3.0 * missing string
This commit is contained in:
parent
5eb0a33795
commit
c574cefc30
@ -16,7 +16,7 @@ import homeassistant.helpers.config_validation as cv
|
||||
from .const import _LOGGER, DEFAULT_PORT, DOMAIN
|
||||
|
||||
DEFAULT_HOST = "192.168.1.252"
|
||||
DEFAULT_PIN = "111111"
|
||||
DEFAULT_PIN = 111111
|
||||
|
||||
|
||||
def user_form_schema(user_input: dict[str, Any] | None) -> vol.Schema:
|
||||
@ -31,7 +31,7 @@ def user_form_schema(user_input: dict[str, Any] | None) -> vol.Schema:
|
||||
)
|
||||
|
||||
|
||||
STEP_REAUTH_DATA_SCHEMA = vol.Schema({vol.Required(CONF_PIN): str})
|
||||
STEP_REAUTH_DATA_SCHEMA = vol.Schema({vol.Required(CONF_PIN): cv.positive_int})
|
||||
|
||||
|
||||
async def validate_input(
|
||||
|
@ -5,7 +5,3 @@ _LOGGER = logging.getLogger(__package__)
|
||||
|
||||
DOMAIN = "comelit"
|
||||
DEFAULT_PORT = 80
|
||||
|
||||
# Entity states
|
||||
STATE_OFF = 0
|
||||
STATE_ON = 1
|
||||
|
@ -68,7 +68,7 @@ class ComelitSerialBridge(DataUpdateCoordinator):
|
||||
)
|
||||
|
||||
async def _async_update_data(self) -> dict[str, Any]:
|
||||
"""Update router data."""
|
||||
"""Update device data."""
|
||||
_LOGGER.debug("Polling Comelit Serial Bridge host: %s", self._host)
|
||||
logged = False
|
||||
try:
|
||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
from typing import Any
|
||||
|
||||
from aiocomelit import ComelitSerialBridgeObject
|
||||
from aiocomelit.const import COVER, COVER_CLOSE, COVER_OPEN, COVER_STATUS
|
||||
from aiocomelit.const import COVER, STATE_COVER, STATE_OFF, STATE_ON
|
||||
|
||||
from homeassistant.components.cover import STATE_CLOSED, CoverDeviceClass, CoverEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@ -60,9 +60,9 @@ class ComelitCoverEntity(
|
||||
|
||||
def _current_action(self, action: str) -> bool:
|
||||
"""Return the current cover action."""
|
||||
is_moving = self.device_status == COVER_STATUS.index(action)
|
||||
is_moving = self.device_status == STATE_COVER.index(action)
|
||||
if is_moving:
|
||||
self._last_action = COVER_STATUS.index(action)
|
||||
self._last_action = STATE_COVER.index(action)
|
||||
return is_moving
|
||||
|
||||
@property
|
||||
@ -77,11 +77,11 @@ class ComelitCoverEntity(
|
||||
if self._last_state in [None, "unknown"]:
|
||||
return None
|
||||
|
||||
if self.device_status != COVER_STATUS.index("stopped"):
|
||||
if self.device_status != STATE_COVER.index("stopped"):
|
||||
return False
|
||||
|
||||
if self._last_action:
|
||||
return self._last_action == COVER_STATUS.index("closing")
|
||||
return self._last_action == STATE_COVER.index("closing")
|
||||
|
||||
return self._last_state == STATE_CLOSED
|
||||
|
||||
@ -97,18 +97,18 @@ class ComelitCoverEntity(
|
||||
|
||||
async def async_close_cover(self, **kwargs: Any) -> None:
|
||||
"""Close cover."""
|
||||
await self._api.set_device_status(COVER, self._device.index, COVER_CLOSE)
|
||||
await self._api.set_device_status(COVER, self._device.index, STATE_OFF)
|
||||
|
||||
async def async_open_cover(self, **kwargs: Any) -> None:
|
||||
"""Open cover."""
|
||||
await self._api.set_device_status(COVER, self._device.index, COVER_OPEN)
|
||||
await self._api.set_device_status(COVER, self._device.index, STATE_ON)
|
||||
|
||||
async def async_stop_cover(self, **_kwargs: Any) -> None:
|
||||
"""Stop the cover."""
|
||||
if not self.is_closing and not self.is_opening:
|
||||
return
|
||||
|
||||
action = COVER_OPEN if self.is_closing else COVER_CLOSE
|
||||
action = STATE_OFF if self.is_closing else STATE_ON
|
||||
await self._api.set_device_status(COVER, self._device.index, action)
|
||||
|
||||
@callback
|
||||
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
||||
from typing import Any
|
||||
|
||||
from aiocomelit import ComelitSerialBridgeObject
|
||||
from aiocomelit.const import LIGHT
|
||||
from aiocomelit.const import LIGHT, STATE_OFF, STATE_ON
|
||||
|
||||
from homeassistant.components.light import LightEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@ -12,7 +12,7 @@ from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import DOMAIN, STATE_OFF, STATE_ON
|
||||
from .const import DOMAIN
|
||||
from .coordinator import ComelitSerialBridge
|
||||
|
||||
|
||||
|
@ -6,5 +6,5 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/comelit",
|
||||
"iot_class": "local_polling",
|
||||
"loggers": ["aiocomelit"],
|
||||
"requirements": ["aiocomelit==0.2.0"]
|
||||
"requirements": ["aiocomelit==0.3.0"]
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
"user": {
|
||||
"data": {
|
||||
"host": "[%key:common::config_flow::data::host%]",
|
||||
"port": "[%key:common::config_flow::data::port%]",
|
||||
"pin": "[%key:common::config_flow::data::pin%]"
|
||||
}
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ aiobafi6==0.9.0
|
||||
aiobotocore==2.6.0
|
||||
|
||||
# homeassistant.components.comelit
|
||||
aiocomelit==0.2.0
|
||||
aiocomelit==0.3.0
|
||||
|
||||
# homeassistant.components.dhcp
|
||||
aiodiscover==1.5.1
|
||||
|
@ -197,7 +197,7 @@ aiobafi6==0.9.0
|
||||
aiobotocore==2.6.0
|
||||
|
||||
# homeassistant.components.comelit
|
||||
aiocomelit==0.2.0
|
||||
aiocomelit==0.3.0
|
||||
|
||||
# homeassistant.components.dhcp
|
||||
aiodiscover==1.5.1
|
||||
|
@ -16,3 +16,5 @@ MOCK_CONFIG = {
|
||||
}
|
||||
|
||||
MOCK_USER_DATA = MOCK_CONFIG[DOMAIN][CONF_DEVICES][0]
|
||||
|
||||
FAKE_PIN = 5678
|
||||
|
@ -10,7 +10,7 @@ from homeassistant.const import CONF_HOST, CONF_PIN, CONF_PORT
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.data_entry_flow import FlowResultType
|
||||
|
||||
from .const import MOCK_USER_DATA
|
||||
from .const import FAKE_PIN, MOCK_USER_DATA
|
||||
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
@ -108,7 +108,7 @@ async def test_reauth_successful(hass: HomeAssistant) -> None:
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={
|
||||
CONF_PIN: "other_fake_pin",
|
||||
CONF_PIN: FAKE_PIN,
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
@ -150,7 +150,7 @@ async def test_reauth_not_successful(hass: HomeAssistant, side_effect, error) ->
|
||||
result = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
user_input={
|
||||
CONF_PIN: "other_fake_pin",
|
||||
CONF_PIN: FAKE_PIN,
|
||||
},
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user