I’m running Hass.io 0.67.1 on an RPi 3B. I have an automation which, when a motion sensor detects motion, creates a persistent notification, sends a notification to my iPhone, and then the automation turns itself off for 10 minutes. It looks like this:
- alias: Notify xxx iPhone with delay
initial_state: "on"
trigger:
platform: state
entity_id: sensor.motion
to: 'motion detected'
condition:
condition: time
before: '23:00:00'
after: '10:00:00'
action:
- service: persistent_notification.create
data:
message: "Motion has been detected"
title: "Motion Sensor Activity"
- service: notify.ios_xxxs_iphone
data:
message: 'Motion detected'
data:
push:
sound: "US-EN-Alexa-Motion-Detected-Generic.wav"
- service: automation.turn_off
entity_id: automation.notify_xxx_iphone_with_delay
- delay:
minutes: 10
- service: automation.turn_on
entity_id: automation.notify_xxx_iphone_with_delay
The automation itself always works - it triggers properly, the persistent notification always happens, and the automation turning on and off works properly. The iOS notification part is the problem. It often works, but sometimes it does not. I get the following errors in my log when it doesn’t work. Can anyone help me understand what might be causing this? I need the iOS notifications to be reliable. Thank you for any help you can provide.
2018-05-02 16:04:52 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall notify.ios_xxxs_iphone: message=<homeassistant.helpers.template.Template object at 0x70b76410>, data=push=sound=US-EN-Alexa-Motion-Detected-Generic.wav>
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/usr/lib/python3.6/site-packages/urllib3/util/connection.py", line 60, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 346, in _make_request
self._validate_conn(conn)
File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 850, in _validate_conn
conn.connect()
File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 284, in connect
conn = self._new_conn()
File "/usr/lib/python3.6/site-packages/urllib3/connection.py", line 150, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7087a990>: Failed to establish a new connection: [Errno -3] Try again
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
timeout=timeout
File "/usr/lib/python3.6/site-packages/urllib3/connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3.6/site-packages/urllib3/util/retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ios-push.home-assistant.io', port=443): Max retries exceeded with url: /push (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7087a990>: Failed to establish a new connection: [Errno -3] Try again',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/homeassistant/core.py", line 1002, in _event_to_service_call
await service_handler.func(service_call)
File "/usr/lib/python3.6/site-packages/homeassistant/components/notify/__init__.py", line 137, in async_notify_message
yield from notify_service.async_send_message(**kwargs)
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.6/site-packages/homeassistant/components/notify/ios.py", line 94, in send_message
req = requests.post(PUSH_URL, json=data, timeout=10)
File "/usr/lib/python3.6/site-packages/requests/api.py", line 112, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/lib/python3.6/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3.6/site-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3.6/site-packages/requests/adapters.py", line 508, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ios-push.home-assistant.io', port=443): Max retries exceeded with url: /push (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7087a990>: Failed to establish a new connection: [Errno -3] Try again',))