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

Add Dremel 3D Printer integration #85969

Merged
merged 14 commits into from May 31, 2023
Merged

Conversation

tkdrob
Copy link
Contributor

@tkdrob tkdrob commented Jan 15, 2023

Proposed change

Add the integration for the Dremel 3D Printer, models 3D20, 3D40 and 3D45. Dremel manufactures a high-tech 3D printer that does not integrate with OctoPrint. It has its own API built-in and, for the latest model (3D45), its own camera. This integration adds a config flow to add a Dremel 3D Printer based on its Host IP.

#72235 appears to have been abandoned. This is my own submission with much needed changes to keep up with the new standards. Only the sensor platform is exposed to start with to make review easier.

There is a custom integration in HACS so we already have it in the brands repo.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

Copy link
Contributor

@jbouwh jbouwh left a comment

Choose a reason for hiding this comment

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

General this looks good to me, but I cannot test it. Have only a question about the 2nd import.

requirements_all.txt Outdated Show resolved Hide resolved
api = await self.hass.async_add_executor_job(Dremel3DPrinter, host)
except (ConnectTimeout, HTTPError, JSONDecodeError):
errors = {"base": "cannot_connect"}
except Exception: # pylint: disable=broad-except
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you really need this broad exception? Is there no way to box this into known exception types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All the known exceptions are classified as cannot_connect. Is the broad except not standard for config_flow anymore?

Copy link
Member

Choose a reason for hiding this comment

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

It’s alright, it gives the best user experience because the flow doesn’t crash, just says something bad happened. However, you should log the exception _LOGGER.exception(…) to make sure we can see where the unknown error happened.

Copy link
Member

@balloob balloob left a comment

Choose a reason for hiding this comment

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

Few changes necessary. Looking already really good.

@home-assistant
Copy link

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant home-assistant bot marked this pull request as draft May 31, 2023 02:55
@balloob balloob mentioned this pull request May 31, 2023
22 tasks
@tkdrob tkdrob marked this pull request as ready for review May 31, 2023 16:16
@home-assistant home-assistant bot requested a review from balloob May 31, 2023 16:16
@balloob balloob merged commit a1e9cf1 into home-assistant:dev May 31, 2023
52 checks passed
@tkdrob tkdrob deleted the dremel_3d_printer branch May 31, 2023 21:41
@github-actions github-actions bot locked and limited conversation to collaborators Jun 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants