You may want to enable debugging and see what the logs are coming up with.
Glad to do that but never did that before. Thought there was some way to enable debugging per module but never really did it before.
Thanks. Page may need to be updated for the GUI part but got it. Note when I enabled logger: which is required I was getting massive debug messages for everything so difficult to tell things apart. Going to switch to setting it all in configuration.yaml.
Looks like it may be a timeout. Assuming when it checks again itās going to send another alert.
2021-08-31 18:42:33 ERROR (MainThread) [custom_components.mail_and_packages] Timeout fetching Mail and Packages (imap.comcast.net) data
2021-08-31 18:42:33 DEBUG (MainThread) [custom_components.mail_and_packages] Finished fetching Mail and Packages (imap.comcast.net) data in 120.003 seconds
2021-08-31 18:42:33 WARNING (MainThread) [homeassistant.components.automation] Error evaluating condition in 'Mail Notif - Mail Delieveries':
In 'condition':
In 'or' (item 1 of 5):
In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
In 'or' (item 2 of 5):
In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
In 'or' (item 3 of 5):
In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
In 'or' (item 4 of 5):
In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
In 'or' (item 5 of 5):
In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
2021-08-31 18:42:33 WARNING (MainThread) [homeassistant.components.automation] Error evaluating condition in 'Mail Notif - Mail Delieveries':
In 'condition':
In 'or' (item 1 of 5):
In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
In 'or' (item 2 of 5):
In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
In 'or' (item 3 of 5):
In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
In 'or' (item 4 of 5):
In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
In 'or' (item 5 of 5):
In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
2021-08-31 18:42:33 WARNING (MainThread) [homeassistant.components.automation] Error evaluating condition in 'Mail Notif - Mail Delieveries':
In 'condition':
In 'or' (item 1 of 5):
In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
In 'or' (item 2 of 5):
In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
In 'or' (item 3 of 5):
In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
In 'or' (item 4 of 5):
In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
In 'or' (item 5 of 5):
In 'template' condition: TypeError: '>' not supported between instances of 'str' and 'int'
Wouldnāt, if the timeout condition is captured, to not effect the mail count value in this situation? So if it was originally 1 piece of mail leave it there because it timed out?
The count doesnāt get changed in a time out the sensors go unavailable
.
If you handle the status going unavailable
in a condition you can filter this out.
Ultimately the best course of action would be to find out why the IMAP connection is having issues.
Have suddenly started getting āTimeout fetching Mail and Packages (imap.gmail.com) dataā from GMail so my sensors are unavailable. Iāve uninstalled the plugin, rebooted the host and reinstalled the plugin. I also generated a new app password for the email access. All not working.
Also started getting these at the same time:
Update for camera.mail_amazon_delivery_camera fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 446, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 641, in async_device_update
raise exc
File "/config/custom_components/mail_and_packages/camera.py", line 174, in async_update
self.update_file_path()
File "/config/custom_components/mail_and_packages/camera.py", line 133, in update_file_path
image = self._coordinator.data[ATTR_AMAZON_IMAGE]
TypeError: 'NoneType' object is not subscriptable
and
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 446, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 641, in async_device_update
raise exc
File "/config/custom_components/mail_and_packages/camera.py", line 174, in async_update
self.update_file_path()
File "/config/custom_components/mail_and_packages/camera.py", line 123, in update_file_path
image = self._coordinator.data[ATTR_IMAGE_NAME]
TypeError: 'NoneType' object is not subscriptable
Any idea on how to fix or debug?
Thanks!
Increase your timeout limit in the configuration.
I tried this, and it didnāt change anything.
If the app password is correct and the other login info is correct, then thereās an issue on GMailās side.
I have two that went unavailable last week. sensor.mail_amazon_exception & sensor.mail_usps_exception. All the others work.
Is this common? Iāve had this running for about 9 months and from memory, it became unavailable a couple of times but always worked when I re-added. Not sure why this time its not working. I can also ping imap.gmail.com from the host. Iāve generated a new mail password multiple times and can see in the google dashboard that the app password is being used correctly.
You can try enabling debug on the imap library to see if thereās a specific error message itās generating.
Hereās the service call from Dev Tools ā Services:
service: logger.set_level
data:
imaplib: debug
With debug enabled:
2021-09-07 20:04:37 DEBUG (SyncWorker_2) [custom_components.mail_and_packages.helpers] Amazon delivered email(s) found: 0
2021-09-07 20:04:37 DEBUG (SyncWorker_2) [custom_components.mail_and_packages.helpers] Searching for Amazon image in emails...
2021-09-07 20:04:37 DEBUG (SyncWorker_2) [custom_components.mail_and_packages.helpers] HTML Amazon emails found: 0
2021-09-07 20:04:37 DEBUG (SyncWorker_2) [custom_components.mail_and_packages.helpers] Amazon email search address: [email protected]
2021-09-07 20:04:37 DEBUG (SyncWorker_2) [custom_components.mail_and_packages.helpers] DEBUG imap_search: (FROM "[email protected]" SUBJECT "Consegna effettuata:" SINCE "07-Sep-2021")
2021-09-07 20:04:39 DEBUG (SyncWorker_3) [custom_components.mail_and_packages.helpers] Searching for (scheduled for delivery TODAY) in (0) emails
2021-09-07 20:04:39 DEBUG (SyncWorker_3) [custom_components.mail_and_packages.helpers] Search for (scheduled for delivery TODAY) count results: 0
2021-09-07 20:04:39 DEBUG (SyncWorker_3) [custom_components.mail_and_packages.helpers] Search for (['[email protected]', '[email protected]', '[email protected]']) with subject (paket kommt heute) results: b'' count: 0
2021-09-07 20:04:39 DEBUG (SyncWorker_3) [custom_components.mail_and_packages.helpers] Sensor: dhl_delivering Count: 0
2021-09-07 20:04:39 DEBUG (SyncWorker_3) [custom_components.mail_and_packages.helpers] Sensor: dhl_packages Count: 0
2021-09-07 20:04:39 DEBUG (SyncWorker_3) [custom_components.mail_and_packages.helpers] Attempting to find mail from (['[email protected]', '[email protected]']) with subject (Your package has been delivered)
2021-09-07 20:04:39 DEBUG (SyncWorker_3) [custom_components.mail_and_packages.helpers] DEBUG imap_search: (OR FROM "[email protected]" FROM "[email protected]" SUBJECT "Your package has been delivered" SINCE "07-Sep-2021")
2021-09-07 20:04:45 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: usps_camera
2021-09-07 20:04:45 DEBUG (MainThread) [custom_components.mail_and_packages.camera] Camera Update: amazon_camera
2021-09-07 20:04:45 ERROR (MainThread) [homeassistant.helpers.entity] Update for camera.mail_usps_camera_2 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 446, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 641, in async_device_update
raise exc
File "/config/custom_components/mail_and_packages/camera.py", line 174, in async_update
self.update_file_path()
File "/config/custom_components/mail_and_packages/camera.py", line 123, in update_file_path
image = self._coordinator.data[ATTR_IMAGE_NAME]
TypeError: 'NoneType' object is not subscriptable
2021-09-07 20:04:45 ERROR (MainThread) [homeassistant.helpers.entity] Update for camera.mail_amazon_delivery_camera_2 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 446, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 641, in async_device_update
raise exc
File "/config/custom_components/mail_and_packages/camera.py", line 174, in async_update
self.update_file_path()
File "/config/custom_components/mail_and_packages/camera.py", line 133, in update_file_path
image = self._coordinator.data[ATTR_AMAZON_IMAGE]
TypeError: 'NoneType' object is not subscriptable
There is no imap error that I can see but sensors remain unavailable. Also, why is there camera errors?
What sensors do you have enabled?
Amazon, DHL, Hermes, Royal Mail, FedEx. Basically all except Canada Post and USPS.
Try the latest beta and see if that clears up any issues.
Same two unavailable on latest beta.
If you have only 2 specific sensors unavailable, they may have been duplicated for some reason like the unique_id changing.
Same issue for me with GMail timeouts.