mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Fix implicit-return in konnected (#122915)
* Fix implicit-return in konnected * Adjust * Adjust * Adjust tests
This commit is contained in:
parent
6a89080ce7
commit
b7f5236a0a
@ -102,13 +102,12 @@ class KonnectedSwitch(SwitchEntity):
|
|||||||
if resp.get(ATTR_STATE) is not None:
|
if resp.get(ATTR_STATE) is not None:
|
||||||
self._set_state(self._boolean_state(resp.get(ATTR_STATE)))
|
self._set_state(self._boolean_state(resp.get(ATTR_STATE)))
|
||||||
|
|
||||||
def _boolean_state(self, int_state):
|
def _boolean_state(self, int_state: int | None) -> bool | None:
|
||||||
if int_state is None:
|
|
||||||
return False
|
|
||||||
if int_state == 0:
|
if int_state == 0:
|
||||||
return self._activation == STATE_LOW
|
return self._activation == STATE_LOW
|
||||||
if int_state == 1:
|
if int_state == 1:
|
||||||
return self._activation == STATE_HIGH
|
return self._activation == STATE_HIGH
|
||||||
|
return None
|
||||||
|
|
||||||
def _set_state(self, state):
|
def _set_state(self, state):
|
||||||
self._attr_is_on = state
|
self._attr_is_on = state
|
||||||
|
@ -700,4 +700,4 @@ async def test_connect_retry(hass: HomeAssistant, mock_panel) -> None:
|
|||||||
async_fire_time_changed(hass, utcnow() + timedelta(seconds=21))
|
async_fire_time_changed(hass, utcnow() + timedelta(seconds=21))
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
await async_update_entity(hass, "switch.konnected_445566_actuator_6")
|
await async_update_entity(hass, "switch.konnected_445566_actuator_6")
|
||||||
assert hass.states.get("switch.konnected_445566_actuator_6").state == "off"
|
assert hass.states.get("switch.konnected_445566_actuator_6").state == "unknown"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user