Skip to content

briped/homeassistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 

Repository files navigation

Home Assistant

My forray into Home Assistant blueprints (and more?).

Blueprints

Certificate Expiry Checker

Import Certificate Expiry Checker blueprint to your Home Assistant. certificate_expiry_checker

This blueprint depends on the Certificate Expiry integration.

The blueprint will return an array of dictionaries, which can be referenced using {{items}}. This way you can gain greater control over how the output should be handled.

An example of the returned data:

[
  {
    "host": "portainer.example.com",
    "port": "9443",
    "relative_time": "9 days",
    "entity_id": "sensor.cert_expiry_timestamp_portainer_example_com_9443",
    "state": "2023-02-24T20:24:44+00:00"
  },
  {
    "host": "proxmox.example.com",
    "port": "8006",
    "relative_time": "1 day",
    "entity_id": "sensor.cert_expiry_timestamp_proxmox_example_com_8006",
    "state": "2023-02-16T23:06:53+00:00"
  },
  {
    "host": "www.example.com",
    "port": 443,
    "relative_time": "9 days",
    "entity_id": "sensor.cert_expiry_timestamp_www_example_com",
    "state": "2023-02-24T20:19:17+00:00"
  }
]

An example on how to configure HTML e-mail notifications that will contain a list of certificates about to expire:

service: notify.smtp_gmail
data:
  title: Certificates expiring soon
  message: |
    The following monitored certificates 
      will expire soon:
  data:
    html: |
      <!DOCTYPE html>
      <html>
        <head>
          <meta charset="UTF-8">
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <title>Certificates expiring soon</title>
        </head>
        <body>
          <p>The following monitored certificates will expire soon:</p>
          <ul>
          {% for item in items %}
            <li><a href="https://{{item.host}}:{{item.port}}">{{item.host}}:{{item.port}}</a> expires in {{item.relative_time}}</li>
          {% endfor %}
          </ul>
        </body>
      </html>

Device Availability Checker

Import Device Availability Checker blueprint to your Home Assistant. certificate_expiry_checker

The blueprint will return an array of dictionaries, which can be referenced using {{items}}. This way you can gain greater control over how the output should be handled.

An example of the returned data:

[
  {
    "device_id": "bb0074342dc93760d18ae40bb454f9ec",
    "device_name": "LUMI lumi.sensor_magnet",
    "area_id": "entrance",
    "state": "unavailable"
  },
  {
    "device_id": "0a300fdf5cdcc8e7d2e2473d003f9585",
    "device_name": "LUMI lumi.weather",
    "area_id": "bedroom",
    "state": "unavailable"
  },
  {
    "device_id": "6586d15e7134da404836203e165b7b9c",
    "device_name": "LUMI lumi.weather",
    "area_id": "living_room",
    "state": "unavailable"
  },
  {
    "device_id": "5e20568a620d5b500811c86568c5cee8",
    "device_name": "RGB Bulb",
    "area_id": "closet",
    "state": "unavailable"
  },
  {
    "device_id": "2563429dfb3eb402007748d833f2dfd4",
    "device_name": "LUMI lumi.weather",
    "area_id": "kitchen",
    "state": "56"
  }
]

An example on how to configure HTML e-mail notifications that will contain a list of unavailable or low battery devices:

service: notify.smtp_gmail
data:
  title: Unavailable or low battery devices
  message: |
    The following devices are low on battery or unavailable:
  data:
    html: |
      <!DOCTYPE html> <html>
        <head>
          <meta charset="UTF-8">
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
          <title>Unavailable or low battery devices</title>
        </head>
        <body>
          <p>The following devices are low on battery or unavailable:</p>
          <ul>
          {% for item in items %}
            <li><a href="https://homeassistant.example.com/config/devices/device/{{item.device_id}}">{{item.device_name}}</a><br />
              <ul>
                <li>Area: <a href="https://homeassistant.example.com/config/areas/area/{{item.area_id}}">{{area_name(item.area_id)}}</a></li>
                <li>State: {{item.state}}</li>
              </ul>
            </li>
          {% endfor %}
          </ul>
        </body>
      </html>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published