ljmerza / ha-email-sensor

Email Sensor for collecting tracking numbers from over 40 providers.
MIT License
88 stars 23 forks source link

Is a sensor only created when an applicable email is found? #9

Closed rpitera closed 5 years ago

rpitera commented 5 years ago

Just installed this and trying to see if it is working. I don't get any errors but I also don't see a sensor created.

Does the sensor get created only when a qualifying email is found and parsed or should I see a sensor once the component initializes whether or not a qualifying email is found?

ljmerza commented 5 years ago

You should see a sensor. Maybe you're getting an error try enable logging for it

rpitera commented 5 years ago

Can I enable debug for this sensor only by adding this to my logger options

logger:
  default: error
  logs:    
    homeassistant.components.email: debug

or do I have the name wrong?

ljmerza commented 5 years ago

custom_components.email: debug I believe is it or something close to that

rpitera commented 5 years ago

I just checked and according to the logger docs, the example you provided seems right. But I'm not getting a single line from it which is confounding me! Here's the config in my sensors.yaml file:

- platform: email
  email: !secret email_username
  password: !secret email_pwd
  smtp_server: !secret email_smtp_server
  smtp_port: 993
  show_all: true

I am using that amazon deliveries email python script we both saw in the subreddit so I know that my smtp server can be connected to from my HA host because that script is working and I'm using the same credentials/server settings in the config above.

Now here's the entire homeassistant.log file, a good hour and a half after a restart:

2019-06-10 16:21:50 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for alexa_media which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-06-10 16:21:50 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for custom_updater which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-06-10 16:21:50 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for aarlo which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-06-10 16:22:30 ERROR (SyncWorker_3) [homeassistant.components.cert_expiry.sensor] Cannot connect to westofeast.no-ip.org
2019-06-10 16:23:32 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform androidtv
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/androidtv/media_player.py", line 109, in setup_platform
    if not aftv.available:
  File "/config/deps/lib/python3.7/site-packages/androidtv/basetv.py", line 305, in available
    adb_devices = self._adb_client.devices()
  File "/config/deps/lib/python3.7/site-packages/adb_messenger/command/host/__init__.py", line 19, in devices
    result = self._execute_cmd(cmd)
  File "/config/deps/lib/python3.7/site-packages/adb_messenger/command/host/__init__.py", line 10, in _execute_cmd
    conn.send(cmd)
  File "/config/deps/lib/python3.7/site-packages/adb_messenger/connection.py", line 77, in send
    return self._check_status()
  File "/config/deps/lib/python3.7/site-packages/adb_messenger/connection.py", line 80, in _check_status
    recv = self._recv(4).decode('utf-8')
  File "/config/deps/lib/python3.7/site-packages/adb_messenger/connection.py", line 56, in _recv
    return self.socket.recv(length)
ConnectionResetError: [Errno 104] Connection reset by peer
2019-06-10 16:24:40 ERROR (MainThread) [aioharmony.hubconnector] 192.168.1.214: Connection timed out for hub 10451281
2019-06-10 16:25:03 ERROR (MainThread) [homeassistant.components.media_player] Error while setting up platform androidtv
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=hass.loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/androidtv/media_player.py", line 109, in setup_platform
    if not aftv.available:
  File "/config/deps/lib/python3.7/site-packages/androidtv/basetv.py", line 305, in available
    adb_devices = self._adb_client.devices()
  File "/config/deps/lib/python3.7/site-packages/adb_messenger/command/host/__init__.py", line 19, in devices
    result = self._execute_cmd(cmd)
  File "/config/deps/lib/python3.7/site-packages/adb_messenger/command/host/__init__.py", line 10, in _execute_cmd
    conn.send(cmd)
  File "/config/deps/lib/python3.7/site-packages/adb_messenger/connection.py", line 77, in send
    return self._check_status()
  File "/config/deps/lib/python3.7/site-packages/adb_messenger/connection.py", line 80, in _check_status
    recv = self._recv(4).decode('utf-8')
  File "/config/deps/lib/python3.7/site-packages/adb_messenger/connection.py", line 56, in _recv
    return self.socket.recv(length)
ConnectionResetError: [Errno 104] Connection reset by peer
2019-06-10 16:34:46 ERROR (MainThread) [aioharmony.hubconnector] 192.168.1.214: Connection timed out for hub 10451281
2019-06-10 16:49:59 ERROR (MainThread) [aioharmony.hubconnector] 192.168.1.214: Connection timed out for hub 10451281
2019-06-10 17:00:00 ERROR (SubscribeMessageWorker) [custom_components.wink] Error in pubnub JSON for Outlet #1 polling API for current state
2019-06-10 17:00:00 ERROR (SubscribeMessageWorker) [custom_components.wink] Error in pubnub JSON for Outlet #2 polling API for current state
2019-06-10 17:00:01 ERROR (SubscribeMessageWorker) [custom_components.wink] Error in pubnub JSON for Outlet #1 polling API for current state
2019-06-10 17:00:01 ERROR (SubscribeMessageWorker) [custom_components.wink] Error in pubnub JSON for Outlet #2 polling API for current state
2019-06-10 17:20:30 ERROR (MainThread) [aioharmony.hubconnector] 192.168.1.214: Connection timed out for hub 10451281

Again, that's not just a section; that's the entire contents of the file - which I have defaulting to 'error' save the exception for your sensor as well as a couple of others I have set to 'critical' that are a little chatty.

Not seeing anything here, I was wondering if the component was even loading, but when I go to the logs in the UI, I see the standard custom integration warning for 'email' from the loader:

loader_msg

But no other message in those logs either to indicate an issue or a failure to load. It's really odd - I can't believe I'm not getting at least SOME kind of error somewhere.

Any thoughts? It seems like it should be simple and I keep looking for something obvious but I'm running out of ideas.

ljmerza commented 5 years ago

Hey sorry haven't forgotten about this, been swamped. Try show_all: false maybe you have too many emails in that folder and it's timing out?

rpitera commented 5 years ago

Thanks, but I understand how busy you are so no worries. Tried show_all: false. Still no sensor (and I actually have a UPS email in my inbox for a delivery tomorrow). Still showing the message:

Mon Jun 17 2019 19:16:08 GMT-0400 (Eastern Daylight Time)
You are using a custom integration for email which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

in the info page logs. Furthermore I deleted pycache before restarting and I can see it's been rebuilt so I know that SOMETHING is happening. I just can't understand why I don't see any error messages - especially since debug is still enabled for your component.

ljmerza commented 5 years ago

Have you tried installing the required python libraries manually?

On Mon, Jun 17, 2019 at 7:29 PM rpitera notifications@github.com wrote:

Thanks, but I understand how busy you are so no worries. Tried show_all: false. Still no sensor (and I actually have a UPS email in my inbox for a delivery tomorrow). Still showing the message:

Mon Jun 17 2019 19:16:08 GMT-0400 (Eastern Daylight Time) You are using a custom integration for email which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

in the info page logs. Furthermore I deleted pycache before restarting and I can see it's been rebuilt so I know that SOMETHING is happening. I just can't understand why I don't see any error messages - especially since debug is still enabled for your component.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ljmerza/ha-email-sensor/issues/9?email_source=notifications&email_token=AA7FQBMKA3M2MJF3O2JYEA3P3AM63A5CNFSM4HVCLS5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX4XJ2I#issuecomment-502887657, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7FQBOYLL4R67P5YI5P5GDP3AM63ANCNFSM4HVCLS5A .

rpitera commented 5 years ago

I'm on hass.io so I'm not sure that's possible. I'm trying to work out how to get SSH access to hassOS but having trouble with getting the keys imported. If I can work that out, I should be able to have more access, unless you know another way.

But wouldn't it throw an error that a required lib was missing?

ljmerza commented 5 years ago

yeah maybe i know they changed the way libraries are loaded so not sure exactly what it would do

On Tue, Jun 18, 2019 at 8:53 AM rpitera notifications@github.com wrote:

I'm on hass.io so I'm not sure that's possible. I'm trying to work out how to get SSH access to hassOS but having trouble with getting the keys imported. If I can work that out, I should be able to have more access, unless you know another way.

But wouldn't it throw an error that a required lib was missing?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ljmerza/ha-email-sensor/issues/9?email_source=notifications&email_token=AA7FQBPWIDTWKIRUT36G5NLP3DLE5A5CNFSM4HVCLS5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX6OLEA#issuecomment-503113104, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7FQBKZ6O7GJVXEWK4ZKBDP3DLE5ANCNFSM4HVCLS5A .

rpitera commented 5 years ago

I kept plugging away at this and I finally got the dev SSH access working and connected (which was a separate trial I had to figure out) as I am also working with the ZHA dev on a fix for a solution that required this access. So I should be able to use pip with that shell.

I'm going to do a bunch of snapshots and backups of everything, then I will try installing those libs and I will get back to you with my progress. Thanks for your patience!

rpitera commented 5 years ago

Sorry to be away for a bit but have been working with another dev ZHA issues. I figured out SSH access and installed the libs in your manifest.json and I now have an email sensor. At least I did until I did the latest update to 0.94 - but it was easy enough to reinstall the libs and it was back again.

I left an old UPS delivery notice in my in box, but I'm guessing it doesn't count it because the date has passed. I've got a product review piece coming in from Best Buy and they send a lot of the review stuff UPS so hopefully I will be able to test it out soon.

I have noticed however that I am getting a persistent notification on startup about unused keys:

email_sensor

Not sure if this indicates some change on the dev side that needs to be accounted for, but wanted you to be aware of it.

rpitera commented 5 years ago

I'm going to close this since it never seemed to work for me. I had it running and had a viable sensor. I also had a real UPS notice in my In Box but the sensor never changed state and the card showed nothing.