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

Implement inverter.py own logger / Python 3.9 retro-compatibility / Restore .connected attribute #35

Merged
merged 8 commits into from
Apr 3, 2024

Commits on Apr 2, 2024

  1. Retro-compatibility with python 3.9

    This is a proposal to replace the `match/case/case...` by `if/elif/elif.../else` in the function `.decode()` to ensure compatibility with python 3.9 and earlier.
    The use of `match/case` in this function is the only place in the whole package where a construction requires python >= 3.10. The proposed modification seems worth because python 3.9 is still widely used; it is e.g. the version available in Debian/oldstable repositories, which is still supported.
    hchiper authored Apr 2, 2024
    Configuration menu
    Copy the full SHA
    4b6f3f7 View commit details
    Browse the repository at this point in the history
  2. Reintroduce .connected attrubute

    This is a proposal to reintroduce the '.connected` attribute.
    Its suppression in recent versions of the module causes errors in programs using earlier versions.
    In this proposal, an equivalent is reintroduced, now as a property, relying directly on the new `.isConnected()` method.
    hchiper authored Apr 2, 2024
    Configuration menu
    Copy the full SHA
    4e7ca33 View commit details
    Browse the repository at this point in the history
  3. Merge pull request #1 from hchiper/hchiper-patch-python39

    Retro-compatibility with python 3.9
    hchiper authored Apr 2, 2024
    Configuration menu
    Copy the full SHA
    824bac8 View commit details
    Browse the repository at this point in the history
  4. Merge pull request #2 from hchiper/hchiper-patch-connected

    Reintroduce `.connected` attrubute
    hchiper authored Apr 2, 2024
    Configuration menu
    Copy the full SHA
    cae92f4 View commit details
    Browse the repository at this point in the history
  5. Implement sun2000_modbus.inverter own logger

    This proposal implements an own logger for the `sun2000_modbus.inverter` module. 
    Before, it was using the default "root" logger. If a program using the module needed to mute its log messages, the only option was to mute the "root" logger, which also muted messages from all other loggers.
    A module-specific logger can be tuned without impact on other loggers and its messages will clearly display their origin as "sun2000_modbus.inverter" instead of "root".
    
    Usage examples (in a custom program):
    1°) catch the logger
        inv_log = logging.getLogger("sun2000_modbus.inverter")
    2°) use one of the following instructions
        inv_log.setLevel(logging.INFO)  # original behaviour
        inv_log.setLevel(logging.ERROR)  # or any other level
        inv_log.disabled = True  # disables this logger only
    hchiper authored Apr 2, 2024
    Configuration menu
    Copy the full SHA
    f0f8085 View commit details
    Browse the repository at this point in the history
  6. Merge pull request #3 from hchiper/hchiper-patch-logging

    Implement sun2000_modbus.inverter own logger
    hchiper authored Apr 2, 2024
    Configuration menu
    Copy the full SHA
    162216b View commit details
    Browse the repository at this point in the history

Commits on Apr 3, 2024

  1. Number formatting according to locale

    This proposal implements the formatting numbers with the proper thousand separator and decimal sign according to the locale for the `.read_formatted()` function.
    
    To use this feature, a module should at first
    `
        import locale
        locale.setlocale(locale.LC_ALL, '')
    `
    and then call `.read_formatted()` with the named parameter `use_locale` set to `True`, for example: `read_formatted(register, use_locale=True)`.
    hchiper authored Apr 3, 2024
    Configuration menu
    Copy the full SHA
    74cc685 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0f4f125 View commit details
    Browse the repository at this point in the history