Skip to content

Commit a94d646

Browse files
AmpioRossoAmpioRossojbouwh
authored
Elro K1 connector is not connecting to HA #17 (#22)
* Ignore fles * Show exception information in fire_alarm_demo Check command result for ST_answer_OK message and continue before checking if the result is valid JSON * Updated version * Follow coding guideliens Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com> * Remove commented line for additional logging information Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com> * Exception handling in demo1 Use better naming for the exception Remove pass if an exception is caught --------- Co-authored-by: AmpioRosso <ampioroso@gmail.com> Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
1 parent 10d73ce commit a94d646

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,4 @@ venv.bak/
108108

109109
# vscode
110110
.vscode/*
111+
.vs/*

elro/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Elro connects P1 API."""
22

3-
__version__ = "0.5.4"
3+
__version__ = "0.5.4.1"

elro/api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@ async def async_process_command(
240240
else None,
241241
)
242242
self._protocol.datagram_data = self._loop.create_future()
243+
if (
244+
raw_data[0].decode("utf-8").strip().casefold()
245+
== "{ST_answer_OK}".casefold()
246+
):
247+
continue
243248
data = validate_json(raw_data[0])
244249
params = data["params"]
245250
cmd_id = params["data"]["cmdId"]

examples/fire_alarm_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ async def async_demo1(self) -> None:
3838
print(
3939
f"{key} ({item.get('name')}): status={item['device_state']} data={item['device_status_data']}"
4040
)
41-
except Exception: # pylint: disable=broad-except
42-
pass
41+
except Exception as err: # pylint: disable=broad-except
42+
print(f"Exception caught {err.args}")
4343
finally:
4444
await asyncio.sleep(INTERVAL)
4545

0 commit comments

Comments
 (0)