Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 99113

Use multiple sensors in one automation to avoid duplication

$
0
0

@alasdair wrote:

I’m using the whois platform to get the expiration dates of my domains

- platform: whois
  domain: domain1.com
  name: domain1_sensor
- platform: whois
  domain: domain2.com
  name: domain1_sensor

For each domain, I have an automation to send a notification when there are fewer than 31 days to expiry.

- alias: domain1_sensor_notify
  trigger:
    platform: time
    at: "10:00"
  condition:
    condition: numeric_state
    entity_id: sensor.domain1
    below: 31
  action:
    service: notify.email
    data_template:
      title: "domain1.com expiring"
      message: "Remaining days {{states.sensor.domain1_sensor.state}}"

- alias: domain2_sensor_notify
  trigger:
    platform: time
    at: "10:00"
  condition:
    condition: numeric_state
    entity_id: sensor.domain2
    below: 31
  action:
    service: notify.email
    data_template:
      title: "domain2.com expiring"
      message: "Remaining days {{states.sensor.domain1_sensor.state}}"

I’d like to have a single automation that works for all whois sensors. I’m new to writing automations, so could anyone suggest how to do this?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 99113

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>