Benjamin
Benjamin
1 min read

Categories

Tags

Notifications

If you read my last post you would have learned how to integrate home assistant with discord, If you have not read this post you can read it Here, In this post, I will be showing you how to set up an automation so home assistant can send a message to discord.

Firstly you will need to open up your automations.yaml file.

The first automation I will be showing you is how to create an automation with Home assistant -> Discord that involves uptimerobot, Uptimerobot helps me by notifying me if one of my services are down such as my website, resume, store or either of my bots. If you have not setup uptimerobot with home assistant you can read about it Here.

Here is the automation file which sends a message to my channel if my beta bot is offline

- alias: Uptime
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: binary_sensor.beta_bot
    from: 'on'
    # Optional
    to: 'off'
  action:
    service: notify.discord
    data:
      target: 509213936084582453
      message: "Beta bot is offline!"
    
- alias: Uptime2
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: binary_sensor.beta_bot
    from: 'off'
    # Optional
    to: 'on'
  action:
    service: notify.discord
    data:
      target: 509213936084582453
      message: "Beta bot is online!"

Here is an automation which tells me if it is 12 pm (I created this automation just so I could test to see how they work)

- alias: Discord
  initial_state: 'on'
  trigger:
    platform: time
    at: '12:00:00'
  action:
    service: notify.discord
    data:
      target: 509213936084582453
      message: "Its 12:00"

If you would like any help with creating automations or are confused about how they work feel free to message me on discord and I will help you out :)

Thanks for reading

Bencey