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

Improve BTicino support #497

Merged
merged 3 commits into from
Jun 18, 2024
Merged

Conversation

speijnik
Copy link
Contributor

@speijnik speijnik commented May 7, 2024

Improves overall BTicino support for various devices:

  • set base classes for BNAS, BNIL and BNDL devices explicitly, omitting firmware and power mixins as these devices provide neither
  • set the climate_type property of a room correctly if the climate feature is provided by a BNTH device
  • set reachable property to True if climate is provided via BNTH device

speijnik added 3 commits May 7, 2024 22:56
Firmware versions for these devices are always reported to be `1`, so the
`FirmwareMixin` can be omitted.

Both `BNIL` and `BNLD` do not report power consumption, so the `PowerMixin`
should be omitted.

Signed-off-by: Stephan Peijnik-Steinwender <[email protected]>
Signed-off-by: Stephan Peijnik-Steinwender <[email protected]>
Signed-off-by: Stephan Peijnik-Steinwender <[email protected]>
@speijnik speijnik requested review from jabesq and cgtobi as code owners May 7, 2024 22:25
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @speijnik - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟢 Security: all looks good
  • 🟡 Testing: 1 issue found
  • 🟢 Complexity: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@@ -37,7 +44,7 @@ class BNMS(Shutter):
"""BTicino motorized shade."""


class BNAS(Shutter):
class BNAS(ShutterMixin, Module):
Copy link

Choose a reason for hiding this comment

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

suggestion (code_clarification): Consider adding a comment explaining the use of ShutterMixin in BNAS.

Since ShutterMixin is being introduced, a brief comment on its role or functionality could help maintain clarity.

Suggested change
class BNAS(ShutterMixin, Module):
class BNAS(ShutterMixin, Module):
"""BTicino automatic shutter.
ShutterMixin: Provides methods for controlling shutter position and state.
"""

Comment on lines +88 to +89
elif "BNTH" in self.device_types:
self.climate_type = DeviceType.BNTH
Copy link

Choose a reason for hiding this comment

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

issue (code_refinement): Addition of BNTH device type handling is missing feature addition in the features set.

Consider adding relevant features to the features set for BNTH, similar to other device types.

Comment on lines +97 to +98
# BNTH is wired, so the room is always reachable
self.reachable = True
Copy link

Choose a reason for hiding this comment

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

issue (edge_case_not_handled): Assumption that BNTH rooms are always reachable may not hold in all cases.

Consider edge cases where hardware or network issues might render the BNTH device unreachable despite being wired.

self.reachable = raw_data.get("reachable")
if self.climate_type == DeviceType.BNTH:
# BNTH is wired, so the room is always reachable
self.reachable = True
Copy link

Choose a reason for hiding this comment

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

issue (testing): Missing test for reachable property logic with BNTH devices.

A test should be added to confirm that the reachable property is set to True when the climate_type is BNTH, as this is a new behavior that needs verification.

@jabesq jabesq merged commit 6469940 into jabesq-org:development Jun 18, 2024
4 checks passed
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