Send Home Assistant notification via M365

Ever since I started with Home Assistant I wanted to be able to send some notifications via email. As I have an M365 Business Basic account I can use Roger Selwyn’s M365-Mail Integration. You can use a Personal account as the prerequisites states.

Note - Personal accounts

Since the middle of 2024, Microsoft has mandated that any new app registrations must be created within an Entra ID directory. You will need to sign up for Azure on a pay as you go basis, where Microsoft Entra ID is indicated as always being free.

The documentation is really good and easy to follow, but I did have a few issues getting the YAML to work.

The documentation gives this as an example

service: notify.ms365_mail_xxxxxxxx

I was confused as to what the XXXXX meant. It is the name you gave the Integration. Below is my Integration

Microsoft 365 - Mail Integration Configuration Screen

As you see my notify line is

notify.ms365_mail_baz_m365

This is my full YAML. This notification sends the SoC level of my solar batteries at 12pm. It sends a Home Assistant notification and then an email to the target address

alias: Notification - Solar - LuxPowerTek 12pm Battery Level
description: Notification - Solar - LuxPowerTek 12pm Battery Level
triggers:
  - at: "12:00:00"
    trigger: time
conditions: []
actions:
  - data:
      message: LuxPowerTek Battery % is {{ states("sensor.lux_battery") }}
      title: LuxPowerTek 12pm Battery Level
    action: notify.notify
  - data:
      message: LuxPowerTek Battery % is {{ states("sensor.lux_battery") }}
      title: "[HA] LuxPowerTek 12pm Battery Level"
      target: email@domain.com
    action: notify.ms365_mail_baz_m365
mode: single

This Integration can also do the following

  1. Getting emails from your inbox

  2. Setting Auto Reply/Out of Office response

Thanks to Roger for this great Integration

 
Michael Curtis

My introduction to computers started at my middle school in 1981 when our maths teacher brought in a ZX80. That led the computer club being founded and using a Research Machine 380Z

My first computer was a 48K ZX Spectrum which I loved to programme. Once I left school I worked as a photocopier engineer, then a fax engineer and finally moving on the Apple computers.

For the next 30 years I worked as a system administrator. I now work in the cyber security industry as a Sophos Professional Services consultant

https://www.bazmac.me
Previous
Previous

Post to Mastodon from Home Assistant in 2025

Next
Next

March Solar Generation and Export Numbers