I removed your sys.exit(0)
from the code that was causing it to stop.
Problem I am getting is something to do with sockets and getaddrinfo
I am thinking some variables are not getting transmitted correctly or something.
I removed your sys.exit(0)
from the code that was causing it to stop.
Problem I am getting is something to do with sockets and getaddrinfo
I am thinking some variables are not getting transmitted correctly or something.
Where was that at? I see sys.exit(1) under the login function.
Thatās the one, that one was killing HA.
Ya I just tossed in some debug code and it looks like the data is getting Noneāed second go around:
2019-07-07 12:45:39 INFO (MainThread) [custom_components.mail_and_packages.sensor] version 0.0.1 is starting, if you have any issues please report them here: http://github.com/moralmunky/Home-Assistant-Mail-And-Packages
2019-07-07 12:45:39 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Debug:
Host: None
Port: None
Folder: None
User: None
Path: None
First go around thereās data in there:
2019-07-07 12:45:25 INFO (MainThread) [custom_components.mail_and_packages.sensor] version 0.0.1 is starting, if you have any issues please report them here: http://github.com/moralmunky/Home-Assistant-Mail-And-Packages
2019-07-07 12:45:25 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Debug:
Host: imap.gmail.com
Port: 993
Folder: Inbox
User: **[REDACTED]**
Path: /home/homeassistant/.homeassistant/www/mail_card/
2019-07-07 12:45:25 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Attempting to connect to imap.gmail.com 993
2019-07-07 12:45:25 DEBUG (MainThread) [custom_components.mail_and_packages.sensor] Login successful!
Iāll keep plugging away at it.
Seems like my latest commit on my fork mostly works. Needs more testing.
@ralfaro or @codypet2002 maybe even @jaaem want to give it a shot?
Branch: add_config
Add to one of your sensors yaml:
- platform: mail_and_packages
host: !secret mail_host
# port: !secret mail_port (default 993)
username: !secret mail_user
password: !secret mail_pwd
folder: !secret mail_folder
image_path: !secret mail_image_path
I received a new set of errors this morning. Is this still related to the problem I was having before? These seem like different errors.
File "/usr/lib/python3.7/socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution
Iāll be happy to help. Maybe this will straighten out what I seem to be doing wrong when I tried it the other way. I should be able to tackle it middle of this week.
Iām getting the following
Tue Jul 09 2019 13:24:49 GMT-0400 (EDT)
Updating mail_and_packages sensor took longer than the scheduled update interval 0:00:30
I still have my information hard coded in the python script. The script in my HASS is a bit different from what I have published on GitHub. I removed the repeated email checking function from each sensor to itās own function that received the email address and subject line to make more efficient code.
I added your updates from the add_config branch and continued to try and get the variables passed in without defining it under the sensors section.
Iāve been running my changes on add_config branch and they seem to be working properly. I did another commit last night, but it seems to be working as intended, at least for me.
sorry, been out of town. Iāll try to test soon
I got everything updated in my repository based on your code and the consolidation of functions from the code on my HASS instal that. I never published. Everything is appears to be functioning as intended using the sensor platform to pull in the configuration.
Barring any code changes to make it HASS proper, the next thing would be to fold in the template sensors logic as entities to lesson the configuration.
From the package yaml? That should be easy.
Added the sensors for āin transitā and ādeliveredā, also working on camera component
https://github.com/firstof9/Home-Assistant-Mail-And-Packages/tree/add_config
Threw this on a test instance, seems to be working but no mail today. Will update when I get mail (hopefully Monday). Was having issues getting the old setup working so excited for this option!
Iāve fixed a few typos on the version in my repo, anyone testing may want to grab the latest version.
I just got a second āpingā saying there was new mail but it was exactly the same as the previous message/nothing was updated. Not sure if thatās an error in the way I have things set up or what.
Yup, more information will be needed. Whose repository did you get the code from and what is your configuration. Also, when you say nothing was updated, was the text and image incorrect in the message? Does it display correctly in the card?
@firstof9, Are you still working off the original expanded version or the last update I made condensing the functions and incorporating your configuration code? I havenāt worked much in GitHub so I may need more instructions to work with merging properly but I want to make sure our codes are in sync and it doesnāt create confusion.
Iām using firstof9ās code.
I think the only āoddā change (other than fixing host/port/setting username/pw) was to the path. I run in docker, so everything is in the /config directory. Hereās the config part:
DEFAULT_PORT = '993'
DEFAULT_FOLDER = 'Tracking'
DEFAULT_PATH = '/config/www/mail_and_packages/'
And I modified the notification bit to work with TG. hereās what I have:
- service: notify.tg_pm
data_template:
title: "*Today's Mail and Packages*"
message: "{{ states('sensor.mail_deliveries_message')}}"
- service: notify.tg_pm
data:
message: "Here is the mail"
data:
document:
file: "/config/www/mail_and_packages/mail_today.gif"
By this I mean that i got the same exact message/image 2 times about 3 hours apart. I think this may have happened once or twice on the old setup. Iāll see if it repeats again tomorrow (presuming I have mail).
I merged your changes into the version Iāve been working on