How to create a notify service for custom component?

Hi there, new developer.

I want to create a notify service which is like notify.alexa_media or notify.mobile_app_<phone_name>.
I haven’t found any docs anywhere on how to create one of these.

My integration is based off of config entries by the way.

Can anyone help?

Thanks!

I suggest to look at the core code of existing integrations implementing the notify platform to get a grasp on how it’s done.

Can you give me an example?
p.s. Happy Birthday!

Any of those implement notify

Then check, e.g.

Alright, I’ll try that. Sorry for not responding, I messed up my HA install haha

Edit: I’m just not going to do it in a dev container

Hi again.
I’m trying to discover a TV through the config flow in a dev environment on my Windows PC.
I move it over to a custom component on the main HA instance and it works fine.
I try testing the Hue integration and it discovers my bridge just fine.

What am I doing wrong?
Here is my config_flow.py: config_flow.py · GitHub

Thanks!

Just found this thread looking for a custom notifier, too. I basically wanted to have a notifier which will activate a zigbee siren periodically from alert integration, which in turn requires a notifier, not an arbitrary service.name.

The solution is simple using pyscript integration:

@service("notify.neo")
def neo(message=None):
    log.warning(f"neo notifier: got message {message}")
    switch.turn_on(entity_id="switch.0xa4c138ba130d24cb_alarm")

Add more options like title, target, or any other data using rich pyscript abilities. The key here is that the service is created in a given domain with a given name, “notify.neo” for this example. So you may then use it like this:

  alert:
    litterbox_needs_cleaning:
      name: "Cat's litterbox needs attention"
      done_message: "Litterbox is clean"
      entity_id: input_boolean.alert_litterbox_needs_cleaning
      state: "on"
      repeat: 30
      can_acknowledge: true
      skip_first: true
      notifiers:
        - telegram
        - neo

PS. I understand that it is not an answer to original question. But for those who like me search for template notifier integration, it may be the simplest solution.