Android Notify service fails if first entity if offline (times out)

Hi all,

Recently I added another NVIDIA Shield TV to Home Assistan and got the ADB set up and everything works fine. What doesn’t work is my Notifications on the second NVIDIA Shield and in fact it doesn’t matter whether this is the second or the third and so on, but it is a matter of the sequence of my notification automation.

What happens is, if my Notification gets triggered, then it only fires the notification to the second Shield if my first Shield is Turned on. If both Shields are turned on it works fine. So it looks like the automation doesn’t proceed if there is a timeout on the first one.

Here is my Automation:

### Indkørsel Motion Sensor Notifikation m. billede ###
- alias: '[Indkørsel] Android Notifikation - Motion m. billede'
  trigger:
    - platform: state
      entity_id: input_boolean.deepstack_motion_keepalive_indkorsel
      to: 'on'
    - platform: event
      event_type: timer.finished
      event_data:
        entity_id: timer.indkorsel
  condition:
    - condition: state
      entity_id: input_boolean.deepstack_motion_keepalive_indkorsel
      state: 'on'
  action:
    - service: timer.start
      entity_id: timer.indkorsel
    - service: image_processing.scan
      entity_id: image_processing.indkorsel_objektgenkendelse
    - delay: 3
    - condition: numeric_state
      entity_id: image_processing.indkorsel_objektgenkendelse
      above: 0
    - service: notify.mobile_app_oneplus_a6003
      data:
        message: "Hvad/Hvem der!? {{ states.image_processing.indkorsel_objektgenkendelse.attributes.summary }} - {{ states.image_processing.indkorsel_objektgenkendelse.attributes.last_target_detection }}"
        title: "Indkørsel"
        data:
          image: !secret notifikation_indkorsel_image
          ttl: 0
          priority: high
    - service: notify.stue
      data:
        message: "Hvad/Hvem der!? {{ states.image_processing.indkorsel_objektgenkendelse.attributes.summary }} - {{ states.image_processing.indkorsel_objektgenkendelse.attributes.last_target_detection }}"
        title: "Indkørsel"
        data:
          color: red
          duration: 10
          file:
            path: !secret notifikation_shield_indkorsel_image
    - service: notify.sovevaerelse
      data:
        message: "Hvad/Hvem der!? {{ states.image_processing.indkorsel_objektgenkendelse.attributes.summary }} - {{ states.image_processing.indkorsel_objektgenkendelse.attributes.last_target_detection }}"
        title: "Indkørsel"
        data:
          color: red
          duration: 10
          file:
            path: !secret notifikation_shield_indkorsel_image

Here is the log:

Logger: homeassistant.components.automation.forhave_android_notifikation_motion_m_billede
Source: components/nfandroidtv/notify.py:240
Integration: Automatisering (documentation, issues)
First occurred: 11. april 2021 19.26.56 (40 occurrences)
Last logged: 8.23.28

  • [Forhave] Android Notifikation - Motion m. billede: Error executing script. Unexpected error for call_service at pos 7: HTTPConnectionPool(host=‘192.168.1.73’, port=7676): Read timed out. (read timeout=5)
  • While executing automation automation.forhave_android_notifikation_motion_m_billede
  • [Forhave] Android Notifikation - Motion m. billede: Error executing script. Unexpected error for call_service at pos 6: HTTPConnectionPool(host=‘192.168.1.74’, port=7676): Read timed out. (read timeout=5)

Traceback (most recent call last): File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 445, in _make_request six.raise_from(e, None) File “”, line 3, in raise_from File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 440, in _make_request httplib_response = conn.getresponse() File “/usr/local/lib/python3.8/http/client.py”, line 1347, in getresponse response.begin() File “/usr/local/lib/python3.8/http/client.py”, line 307, in begin version, status, reason = self._read_status() File “/usr/local/lib/python3.8/http/client.py”, line 268, in _read_status line = str(self.fp.readline(_MAXLINE + 1), “iso-8859-1”) File “/usr/local/lib/python3.8/socket.py”, line 669, in readinto return self._sock.recv_into(b) socket.timeout: timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/usr/local/lib/python3.8/site-packages/requests/adapters.py”, line 439, in send resp = conn.urlopen( File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 755, in urlopen retries = retries.increment( File “/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py”, line 532, in increment raise six.reraise(type(error), error, _stacktrace) File “/usr/local/lib/python3.8/site-packages/urllib3/packages/six.py”, line 735, in reraise raise value File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 699, in urlopen httplib_response = self._make_request( File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 447, in _make_request self._raise_timeout(err=e, url=url, timeout_value=read_timeout) File “/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py”, line 336, in _raise_timeout raise ReadTimeoutError( urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host=‘192.168.1.73’, port=7676): Read timed out. (read timeout=5) During handling of the above exception, another exception occurred: Traceback (most recent call last): File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 359, in _async_step await getattr(self, handler)() File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 559, in _async_call_service_step await service_task File “/usr/src/homeassistant/homeassistant/core.py”, line 1480, in async_call task.result() File “/usr/src/homeassistant/homeassistant/core.py”, line 1515, in _execute_service await handler.job.target(service_call) File “/usr/src/homeassistant/homeassistant/components/notify/init.py”, line 160, in _async_notify_message_service await self.async_send_message(**kwargs) File “/usr/src/homeassistant/homeassistant/components/notify/init.py”, line 137, in async_send_message await self.hass.async_add_executor_job( File “/usr/local/lib/python3.8/concurrent/futures/thread.py”, line 57, in run result = self.fn(*self.args, **self.kwargs) File “/usr/src/homeassistant/homeassistant/components/nfandroidtv/notify.py”, line 240, in send_message response = requests.post(self._target, files=payload, timeout=self._timeout) File “/usr/local/lib/python3.8/site-packages/requests/api.py”, line 119, in post return request(‘post’, url, data=data, json=json, **kwargs) File “/usr/local/lib/python3.8/site-packages/requests/api.py”, line 61, in request return session.request(method=method, url=url, **kwargs) File “/usr/local/lib/python3.8/site-packages/requests/sessions.py”, line 542, in request resp = self.send(prep, **send_kwargs) File “/usr/local/lib/python3.8/site-packages/requests/sessions.py”, line 655, in send r = adapter.send(request, **kwargs) File “/usr/local/lib/python3.8/site-packages/requests/adapters.py”, line 529, in send raise ReadTimeout(e, request=request) requests.exceptions.ReadTimeout: HTTPConnectionPool(host=‘192.168.1.73’, port=7676): Read timed out. (read timeout=5)

What am I missing here - how can I in an easy way let it continue or could I just add more entities in the first service somehow?

Fixed it by creating a group:

notify:
  - name: android_shields
    platform: group
    services:
      - service: shield1
      - service: shield2

I was not aware of the documentation and my searches didn’t bring me to this page.

Although it took me some time, I’m happy it got fixed :slight_smile:

Hi, I was having the same issue as you. However now I have made my group I can get it display the notification on the shields but not at the same time, only sequentially. So after the 30 seconds has passed it will display on the second shield for 30 seconds. Do you have the same result or do they show at the same time?

service: notify.shields_group
data:
  message: Doorbell has been pressed!
  title: Front Door
  data:
    duration: 30
    interupt: 1
    file:
      url: http://172.20.100.230/ISAPI/Streaming/channels/1/picture
      username: XXXX
      password: XXXX
      auth: digest

I did this:

notify:

  - name: android_shields
    platform: group
    services:
      - service: livingroom
      - service: bedroom

and then my automation (the action part):

- service: notify.android_shields
      data:
        message: "Who's there?"
        title: "Driveway"
        data:
          color: red
          duration: 10
          file:
            path: !secret notifikation_shield_driveway_image

Now I get it both if turned on at the same time.

Thanks for the response. It looks pretty similar to mine with the exception you are using the secret. Is your secret to a still image stored by HA or direct to the camera like I have? I wonder if HA wont open the second connection to the camera at the same time.

Could be! I take a snapshot of the camera and save it locally on my NUC which hosts the Home Assistant.