Commit graph

41 commits

Author SHA1 Message Date
Rami Mosleh
cab58fa9b2
Check if imap message text has a value instead of checking if its not None (#118901)
* Check if message_text has a value instead of checking if its not None

* Strip message_text to ensure that its actually empty or not

* Add test with multipart payload having empty plain text
2024-06-06 14:10:03 +02:00
Marc Mueller
a0314cddd4
Fix invalid tuple annotations (#116035) 2024-04-23 16:02:16 +02:00
J. Nick Koston
f3a3e6821b
Switch imap push coordinator to use eager_start (#115454)
When I turned on eager_start here the data would always end up being
None because _async_update_data always returned None. To fix this
it now returns the value from the push loop. It appears this race
would happen in production so this may be a bugfix but since
I do not use this integration it could use a second set of eyes
2024-04-12 09:14:35 +02:00
Luca Angemi
fc1ebdaaa3
Add config message items selector to imap option flow (#115108)
* Update const.py

* Update config_flow.py

* Update coordinator.py

* Update coordinator.py

* Update strings.json

* Update config_flow.py

* Update const.py

* Update coordinator.py

* Update config_flow.py

* Update config_flow.py

* Update test_diagnostics.py

* Update const.py

* Update test_init.py

* Update test_diagnostics.py

* Update test_diagnostics.py

* Update test_diagnostics.py

* Update test_init.py

* Update test_diagnostics.py

* Update test_init.py

* Update test_diagnostics.py

* Update test_diagnostics.py

* Update test_diagnostics.py

* Update test_config_flow.py

* Update config_flow.py

* Update test_config_flow.py

* Update test_init.py

* Update const.py

* Only make text and headers optional

* Add message data tests

* Add message data test

* Update test_config_flow.py

* Update test message data

* Fix ruff

* Fix ruff

* Update test_init.py

* Update strings.json

---------

Co-authored-by: jbouwh <jan@jbsoft.nl>
Co-authored-by: Jan Bouwhuis <jbouwh@users.noreply.github.com>
2024-04-08 19:34:50 +02:00
J. Nick Koston
166910f587
Make eager_start default to True for async_create_background_task (#114996) 2024-04-06 09:53:50 -10:00
Jan Bouwhuis
83b56ab005
Add IMAP seen, move and delete service (#114501)
* Add seen, move and delete IMAP services

* Add entry_id to the imap_content event data

* Use config validation library

* Add tests

* Add logging

* Typo in docstr

* Add guard
2024-04-02 23:05:05 +02:00
Sid
6587ee20db
Enable Ruff TRY300 (#114437)
* Enable Ruff TRY300

* Update validation.py

* Address review comments
2024-03-30 10:37:59 +01:00
Luca Angemi
54c5f18aac
Add uid attribute to imap_content event data (#114432)
* Add uid to imap event

* Add ´uid´ to tests

* Update test_init.py
2024-03-29 15:04:24 +01:00
Sid
82a60fe8ad
Enable Ruff RSE (#113695) 2024-03-18 00:40:38 +01:00
Marc Mueller
8809d3aa88
Add empty line after module docstring [g-i] (#112699) 2024-03-08 08:52:48 -05:00
Jan Bouwhuis
8aa4157290
Add entry diagnostics to imap integration (#109460) 2024-02-09 11:30:27 +01:00
Marc Mueller
7a89e58873
Use builtin TimeoutError [e-i] (#109679) 2024-02-05 12:00:37 +01:00
Jan Bouwhuis
7ab1cdc2b3
Move nested code to class level as static method in imap coordinator (#109665)
* Move _decode_payload to module level in imap coordinator

* Make static method
2024-02-05 08:59:03 +01:00
Jan Bouwhuis
7cc0b8a2fe
Fix imap message part decoding (#109523) 2024-02-04 21:25:14 +01:00
vexofp
617b045727
Fix SSLCipherList typing error in IMAP coordinator (#105362) 2023-12-08 21:34:01 -10:00
Jan Bouwhuis
4da77d2253
Use more specific exception type for imap decoding (#104227)
* Use more specific exception type for imap decoding

* Only catch ValueError
2023-11-20 19:55:10 +01:00
Jan Bouwhuis
9a38e23f28
Fix imap does not decode text body correctly (#104217) 2023-11-19 20:15:02 +01:00
Jan Bouwhuis
e84a4661b0
Add intial property to imap_content event data (#100171)
* Add initial property to imap event data

* Simplify loop

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>

* MyPy

---------

Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2023-09-12 18:54:32 +02:00
Jan Bouwhuis
a1307e117d
Add additional debug logging for imap (#98877) 2023-08-24 01:02:52 +02:00
Marc Mueller
71d985e4d6
Use asyncio.timeout [i-n] (#98450) 2023-08-15 14:32:15 +02:00
Jan Bouwhuis
fab3c5b849
Fix imap cleanup error on abort (#97097) 2023-07-23 20:30:15 +02:00
Jan Bouwhuis
65ebb6a74f
Improve imap error handling for config entry (#96724)
* Improve error handling config entry

* Removed CancelledError

* Add cleanup

* Do not call protected async_set_state()
2023-07-17 09:44:47 +02:00
J. Nick Koston
085eebc903
Make async_set_state in ConfigEntry a protected method (#96727)
I added this in #77803 but I never designed it to be called
externally. External usage may break at any time because the
class is not designed for this. I should have made it protected
in the original PR but I did not think it would get called
externally (my mistake)
2023-07-17 08:58:12 +02:00
Jan Bouwhuis
7a195b5291
Fix imap crash on email without subject (#94230) 2023-06-08 11:11:12 +02:00
Jan Bouwhuis
1e0770ff8a
Add ssl_verify option to imap integration (#93811)
* Add ssl_verify option to imap integration

* Add test
2023-05-30 19:48:47 +02:00
Jan Bouwhuis
4c0d169cfc
Fix imap parsing non rfc compliant date crash (#93630)
* Fix imap parsing non rfc compliant date crash

* Use parsedate_to_datetime from mail.utils
2023-05-28 13:28:11 +02:00
Jan Bouwhuis
1b5d207984
Add imap custom event data template (#93423)
* Add imap custom event template

* Add template validation
2023-05-25 11:05:25 +02:00
Jan Bouwhuis
5bc825a8ab
Add advanced imap option to set custom event max message size (#93163) 2023-05-22 12:14:06 +02:00
Jan Bouwhuis
c97e0f11a5
Fix last imap message is not reset on empty search (#93119) 2023-05-15 21:15:10 +02:00
Jan Bouwhuis
53e533af6b
Improve and enforce type hints for imap (#92325) 2023-05-05 19:21:57 +02:00
Jan Bouwhuis
5a78684998
Fix large imap_content event warning by truncating the email text body to 2 KiB (#92066) 2023-04-26 18:44:22 +02:00
Jan Bouwhuis
3f6541a6db
Add cipher list option to IMAP config flow (#91896)
* Add cipher list option to IMAP config flow

* Use client_context to get the ssl_context

* Formatting

* Add ssl error no make error handling more specific

* Make ssl_ciper_list an advanced option
2023-04-24 15:37:21 +02:00
Jan Bouwhuis
6becf523ec
Fix error after losing an imap connection (#90966)
Cleanup first after losing an imap connection
2023-04-06 16:46:32 -04:00
Jan Bouwhuis
94817f61e5
Suppress imap logging on reconnect and presume state (#90826) 2023-04-05 12:18:16 +02:00
Jan Bouwhuis
9b03d331ca
Fix recovering imap connection triggers re-auth (#90762) 2023-04-04 12:59:57 +02:00
Jan Bouwhuis
93e1cd8dd8
Add header with parsed date to imap event data (#90422) 2023-03-28 22:50:25 +02:00
Jan Bouwhuis
24d0d15f38
Implement imap_content event for imap integration (#90242) 2023-03-28 21:02:43 +02:00
Jan Bouwhuis
fd3280260d
Remove unreachable continue statement in imap push coordinator (#90361) 2023-03-27 16:39:51 +02:00
Jan Bouwhuis
5f22796b38
Refactor imap coordinator (#89759)
* Warn if the previous push wait task it taking longer than the update interval

* refactor

* Call _async_fetch_number_of_messages first

* Add cleanup in case fetching fails

* mypy

* Set sensor to unknown if an error occured.

* Handling invalid auth an reraise when needed

* Handle invalid folder as setup error

* Close IMAP stream before logout at cleanup

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
2023-03-17 22:45:15 +01:00
Jan Bouwhuis
6ba5f8e43a
Fix imap server push holding HA startup (#89750) 2023-03-15 21:22:13 +01:00
Rami Mosleh
a0e18051c7
Add config flow to imap (#74623)
* Add config flow to imap

fix coverage

fix config_flows.py

* move coordinator to seperate file, remove name key

* update intrgations.json

* update requirements_all.txt

* fix importing issue_registry

* Address comments

* Improve handling exceptions on intial connection

* exit loop tasks properly

* fix timeout

* revert async_timeout

* Improve entity update handling

* ensure we wait for idle to finish

* fix typing

* Update deprecation period

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
2023-01-09 11:41:47 +01:00