Notify on failed component when restarting HA with notify service?

Hi

i have this gateway for my Velux, when the gateway is offline and i restart HA… HA fails to complete the setup… i can see that on the notifications page in HA itself… there is an notification there

is it possible to make an automation for failed components, so i will also have a PUSH message on the HA android app with the notify service ? how to trigger this?

If you get a persistent notification in HA about the failed component, you can trigger on that event.

  - alias: persistent_notification_create
    mode: parallel
    trigger:
      - platform: event
        event_type: call_service
        event_data:
          domain: persistent_notification
          service: create
    condition:
      - condition: template
        value_template: >
          {{ trigger.event.data.service_data.notification_id and
          trigger.event.data.service_data.notification_id[:5] == "myha_" }}

You need to find/filter out the event data for the failed notification in the condition.

Perfect, that I can use

hey

happened again, how can i change your automation?
this is wat i saw in the developer states page:

entity : persistent_notification.invalid_config
state : notifying
attributes:
title: Invalid config
message: The following integrations and platforms could not be set up:

 - [velux](https://www.home-assistant.io/integrations/velux)

Please check your config.

and below error from log file


2020-08-04 16:40:57 WARNING (MainThread) [pyvlx] Connecting to KLF 200.
2020-08-04 16:40:58 ERROR (MainThread) [homeassistant.setup] Error during setup of component velux
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 193, in _async_setup_component
    result = await asyncio.wait_for(task, SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.8/asyncio/tasks.py", line 483, in wait_for
    return fut.result()
  File "/usr/src/homeassistant/homeassistant/components/velux/__init__.py", line 31, in async_setup
    await hass.data[DATA_VELUX].async_start()
  File "/usr/src/homeassistant/homeassistant/components/velux/__init__.py", line 69, in async_start
    await self.pyvlx.load_scenes()
  File "/usr/local/lib/python3.8/site-packages/pyvlx/pyvlx.py", line 89, in load_scenes
    await self.scenes.load()
  File "/usr/local/lib/python3.8/site-packages/pyvlx/scenes.py", line 51, in load
    await get_scene_list.do_api_call()
  File "/usr/local/lib/python3.8/site-packages/pyvlx/api_event.py", line 21, in do_api_call
    await self.send_frame()
  File "/usr/local/lib/python3.8/site-packages/pyvlx/api_event.py", line 33, in send_frame
    await self.pyvlx.send_frame(self.request_frame())
  File "/usr/local/lib/python3.8/site-packages/pyvlx/pyvlx.py", line 72, in send_frame
    await self.connect()
  File "/usr/local/lib/python3.8/site-packages/pyvlx/pyvlx.py", line 45, in connect
    await self.connection.connect()
  File "/usr/local/lib/python3.8/site-packages/pyvlx/connection.py", line 85, in connect
    self.transport, _ = await self.loop.create_connection(
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1050, in create_connection
    transport, protocol = await self._create_connection_transport(
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1080, in _create_connection_transport
    await waiter
ConnectionAbortedError: SSL handshake is taking longer than 60.0 seconds: aborting the connection
  - alias: persistent_notification_create
    mode: parallel
    trigger:
      - platform: event
        event_type: call_service
        event_data:
          domain: persistent_notification
          service: create
    condition:
      - condition: template
        value_template: >
          {{ trigger.event.data.service_data.title == "Invalid config" }}
    action:
      ...

should do it.

Ok, gonna try, thnx