Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debug logs for EDL21 #92763

Merged
merged 1 commit into from
May 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions homeassistant/components/edl21/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ def __init__(
self._name = config.get(CONF_NAME)
self._proto = SmlProtocol(config[CONF_SERIAL_PORT])
self._proto.add_listener(self.event, ["SmlGetListResponse"])
LOGGER.debug(
"Initialized EDL21 for %s on %s",
config.get(CONF_NAME),
config[CONF_SERIAL_PORT],
)

async def connect(self) -> None:
"""Connect to an EDL21 reader."""
Expand All @@ -352,6 +357,7 @@ async def connect(self) -> None:
def event(self, message_body) -> None:
"""Handle events from pysml."""
assert isinstance(message_body, SmlGetListResponse)
LOGGER.debug("Received sml message for %s: %s", self._name, message_body)

electricity_id = None
for telegram in message_body.get("valList", []):
Expand All @@ -360,6 +366,7 @@ def event(self, message_body) -> None:
break

if electricity_id is None:
LOGGER.debug("No electricity id found in sml message for %s", self._name)
return
electricity_id = electricity_id.replace(" ", "")

Expand Down