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

Support intermittent serial comms #17

Closed
hanscomps opened this issue Sep 18, 2022 · 2 comments
Closed

Support intermittent serial comms #17

hanscomps opened this issue Sep 18, 2022 · 2 comments

Comments

@hanscomps
Copy link

hanscomps commented Sep 18, 2022


name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''


Describe the bug
For unknown reasons my currentcost usb-serial interface loses connection intermittently. In the process the script crashes and is dead/unresponsive until hass is restarted.

To Reproduce
Steps to reproduce the behaviour, including error message if any.

Expected behaviour
Gracefully handle any serial port failures and recover.
By adding a <try, except> over the reader.readline the scripts seems to recover properly. Probably have to add some delay or timeout in exception handling to prevent excessive logging.

    while True:
        try:
            line = await reader.readline()
            line = line.decode("utf-8").strip()
            _LOGGER.debug("Line Received: %s", line)
        except:
            _LOGGER.error("Error reading from serial port")

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop/Server/Device (please complete the following information):

  • Device used to run the Custom Component [e.g. Raspberry Pi, NUC]
  • Method of installation [e.g. via HACS or manual]
  • Version of the Custom Component installed?
  • Model of the Current Cost Device

Additional context
Add any other context about the problem here.

Logs
Please set the Current Cost Custom Component's logging level to debug and provide relevant logs section from Home-Assistant.
To Enable debug logging level, add this to your configuration.yaml and restart:

logger:
  default: error
  logs:
    custom_components.currentcost: debug
@lolouk44
Copy link
Owner

Fixed in 0.2.3

@lolouk44
Copy link
Owner

Thanks

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

No branches or pull requests

2 participants