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

Cleanup sense_link code and fix W1201 warning #64

Merged
merged 1 commit into from
Sep 15, 2023

Conversation

bdraco
Copy link
Contributor

@bdraco bdraco commented Sep 9, 2023

self.transport.sendto(encrypted_resp, addr)
else:
# Do not send response, but log for debugging
logging.debug(f"SENSE_RESPONSE disabled, response content: {response}")
_LOGGER.debug("SENSE_RESPONSE disabled, response content: %s", response)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was converting the json payload to a string and than throwing it away if debug logging was not enabled

else:
logging.debug(f"Ignoring non-emeter JSON from {addr}: {json_data}")
_LOGGER.debug(f"Ignoring non-emeter JSON from %s: %s", addr, json_data)
Copy link
Contributor Author

@bdraco bdraco Sep 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was converting the response payload to a string and than throwing it away if debug logging was not enabled

# Strip leading 4 bytes for...some reason
encrypted_resp = encrypted_resp[4:]

# Allow disabling response
if self.should_respond:
# Send response
logging.debug(f"Sending response: {response}")
logging.debug("Sending response: %s", response)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was converting the response payload to a string and than throwing it away if debug logging was not enabled

@bdraco bdraco marked this pull request as ready for review September 9, 2023 18:28
@kbickar kbickar merged commit 5e734b4 into scottbonline:stable Sep 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants