Automation Trigger Using Platform State with Multiple Entites

I’m trying to monitor status changes on a few web sites. The scraper simply pulls the <title> tag and monitors for change. It’s really just meant to ensure the web site is up. The error I’m getting here is…

Logger: homeassistant.config
Source: config.py:464
First occurred: 10:36:07 PM (4 occurrences)
Last logged: 10:51:15 PM

Invalid config for [automation]: Entity ID sensor.scraper-com-mywebsite is an invalid entity ID for dictionary value @ data['entity_id']. Got None. (See /config/configuration.yaml, line 375).
Invalid config for [automation]: Entity ID sensor.scraper-com-anotherwebsite is an invalid entity ID for dictionary value @ data['entity_id']. Got None. (See /config/configuration.yaml, line 375).

And here is my code:

  - platform: scrape
    resource: https://mywebsite.com
    name: scraper-com-mywebsite
    select: "head > title"
  - platform: scrape
    resource: https://anotherwebsite.com
    name: scraper-com-anotherwebsite
    select: "head > title"
- id: 'Web Site State Change'
  alias: Web Site State Change
  description: ''
  trigger:
  - platform: state
    entity_id:
      - sensor.scraper-com-mywebsite
      - sensor.scraper-com-anotherwebsite
    for: "00:00:30"
  condition: []
  action:
  - data:
      title: "Web Site State Change"
      message: "From: {{ trigger.from_state.state }} To: {{ trigger.to_state.state }}"
    service: notify.mobile_app_pixel_3a
  - data:
      title: "Web Site State Change"
      message: "From: {{ trigger.from_state.state }} To: {{ trigger.to_state.state }}"
    service: notify.sendgrid

Any thoughts on what’s up? Thanks in advance!

I suspect the actual sensor entity IDs are with “_” rather than “-”, e.g, sensor.scraper_com_mywebsite, are they not?

That being said, keep in mind the the state of those sensors will only change if the actual <title> of those sites change, e.g. if they have a date or a version in their title.

1 Like

You were 100% right - I was not seeing the difference between the friendly names (scraper-com-mywebsite) and the entity names (sensor.scraper_com_mywebsite).

Thanks!