Skip to content

Deprecate imap_content_sensor#90429

Merged
MartinHjelmare merged 13 commits into
home-assistant:devfrom
jbouwh:deprecate-imap_email_content
Apr 3, 2023
Merged

Deprecate imap_content_sensor#90429
MartinHjelmare merged 13 commits into
home-assistant:devfrom
jbouwh:deprecate-imap_email_content

Conversation

@jbouwh
Copy link
Copy Markdown
Contributor

@jbouwh jbouwh commented Mar 28, 2023

Proposed change

Deprecate the imap_email_content_integrations. The IMAP server config can be migrated to the imap integration with a repair flow. A yaml configuration is generated to set up a template sensor and is shown in the flow to allow the user to copy and past the config into configuration.yaml.

Base on the original configuration:

sensor:
  - platform: imap_email_content
    name: Notifications
    server: imap.example.com
    port: 993
    username: user@example.com
    password: LdH0@gv!
    folder: INBOX.Notification
    value_template: "{{ subject }}"

The repair flow will look like:
afbeelding

The next step:
afbeelding

If the IMAP config is migrated but the user has not removed the imap_email_content configuration from configuration.yaml the next time Home Assistant is started, then a non fixable issue is created.
With that warning again is shown how to setup a template sensor with together with the imap config entry.

afbeelding

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
  • I have followed the perfect PR recommendations
  • 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:

@jbouwh jbouwh marked this pull request as ready for review March 28, 2023 21:49
Comment thread homeassistant/components/imap_email_content/sensor.py Outdated
Comment thread homeassistant/components/imap_email_content/sensor.py Outdated
@jbouwh jbouwh force-pushed the deprecate-imap_email_content branch from 42919ee to f6ff0b1 Compare March 29, 2023 20:09
Comment thread homeassistant/components/imap_email_content/strings.json Outdated
Comment thread homeassistant/components/imap_email_content/sensor.py Outdated
Comment thread homeassistant/components/imap_email_content/repairs.py Outdated
Comment thread homeassistant/components/imap_email_content/repairs.py Outdated
Comment thread homeassistant/components/imap_email_content/repairs.py Outdated
Comment thread homeassistant/components/imap_email_content/repairs.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft March 29, 2023 22:26
@home-assistant
Copy link
Copy Markdown
Contributor

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.

jbouwh and others added 2 commits March 30, 2023 07:39
Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
@jbouwh
Copy link
Copy Markdown
Contributor Author

jbouwh commented Mar 30, 2023

@MartinHjelmare Created an import flow. If that fails the issue is replaced with a non fixable issue.
Not sure how to check if the import already was done other than calling the source import step.

TODO: Add tests for imap import flow

Comment thread homeassistant/components/imap/config_flow.py Outdated
Comment thread homeassistant/components/imap/config_flow.py Outdated
Comment thread homeassistant/components/imap/config_flow.py Outdated
Comment thread tests/components/imap/test_config_flow.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft March 31, 2023 11:17
@MartinHjelmare
Copy link
Copy Markdown
Member

The rest looks good!

@jbouwh jbouwh marked this pull request as ready for review March 31, 2023 11:54
@home-assistant home-assistant Bot requested a review from MartinHjelmare March 31, 2023 11:54
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Great!

Comment thread homeassistant/components/imap_email_content/repairs.py Outdated
@jbouwh jbouwh added the smash Indicator this PR is close to finish for merging or closing label Mar 31, 2023
Comment thread tests/components/imap_email_content/test_repairs.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft April 1, 2023 08:33
Comment thread homeassistant/components/imap_email_content/repairs.py Outdated
Comment thread tests/components/imap_email_content/test_repairs.py Outdated
@jbouwh jbouwh removed the smash Indicator this PR is close to finish for merging or closing label Apr 1, 2023
@jbouwh jbouwh marked this pull request as ready for review April 1, 2023 11:22
@home-assistant home-assistant Bot requested a review from MartinHjelmare April 1, 2023 11:22
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Thanks!

@MartinHjelmare MartinHjelmare merged commit 580b20b into home-assistant:dev Apr 3, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 4, 2023
@jbouwh jbouwh deleted the deprecate-imap_email_content branch April 21, 2023 07:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants