Skip to content

Suggestion: Support unknown codes in SelectionBase #197

@rhammen

Description

@rhammen

The SelectionBase Class maps a numeric output of the luxtronik controller to a String value.
This works great....,
... as long as the codes dictionary used for the mapping is up to date.

Over time, the luxtronik firmware may add additional numeric values to several parameters/calculations that use the SelectionBase class.
Most obvious case is probably the HeatpumpCode class, where new models need to be added. ErrorCodes is another obvious one.
And are we really sure there are/won't be no other operation modes than currently defined?

Currently, if the numeric value is not present in the codes dictionary, None is returned.
This means that until this library adds the new values to the codes dictionary, users will get a None response.
In the BenPru/Luxtronik issue list I saw several screenshots of users having HeatpumpModel = "None" as a result of this.

I'm not sure returning None the best approach, since it may suggest a problem with the luxtronik controller while it is in fact an outdated codes dictionary in this library. At least it is confusing to the users: why is the Model or ErrorCode None for my heatpump?
My suggestion therefore would be to return (a string of) the numeric value, instead of None, when the numeric value is not found in the dictionary.
Something like f'Unknown_{value}' could also be an option.

I am willing to make a PR for this, but I first like to check how the maintainers or others look at this suggestion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions