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

DPTDict #1276

Closed
wants to merge 2 commits into from
Closed

DPTDict #1276

wants to merge 2 commits into from

Conversation

farmio
Copy link
Member

@farmio farmio commented Jun 3, 2023

Description

Use TypedDict as container for complex DPT values.
The first example is XYYColor.

Pros:

  • readable
  • no need to convert from dicts (from user input - eg. HAs knx.send) to other type
  • can probably be used to auto-create documentation

Cons:

  • lots of dict.get() needed
    no default values supported in TypedDict
  • no dot-notation supported
  • changing dict-schema would introduce breaking changes in the future (user input schema coupled to data schema)
  • no direct validation from user input - would need an extra step

currently total=False is used - maybe it would be better to switch to total=True

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code quality improvements to existing code or addition of tests

Checklist

  • The documentation has been adjusted accordingly
  • Tests have been added that prove the fix is effective or that the feature works
  • The changes are documented in the changelog (docs/changelog.md)

@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2023

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions.

Copy link

codecov bot commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.61%. Comparing base (6234e32) to head (18ea38f).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1276   +/-   ##
=======================================
  Coverage   96.61%   96.61%           
=======================================
  Files         151      151           
  Lines        9801     9813   +12     
=======================================
+ Hits         9469     9481   +12     
  Misses        332      332           
Files Coverage Δ
xknx/devices/light.py 99.59% <100.00%> (-0.01%) ⬇️
xknx/dpt/dpt.py 100.00% <100.00%> (ø)
xknx/dpt/dpt_color.py 100.00% <100.00%> (ø)

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.

None yet

1 participant