Rain Alert

There is an idea for a rain alert in a telegram, but the problem is that the data will be taken from the text and I don’t know how to implement it, I hope for your help.

There is a site from which to parse text about the state of rain:

command_line.yaml

- sensor:
     name: "Prognoz Dozdya"
     command: |
        wget -q --user-agent='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36' "https://yandex.ru/pogoda/maps/nowcast?lat=41.311151&lon=69.279737&via=hnav&le_Lightning=1" -O /dev/stdout | sed 's/>/>\n/g' | grep "weather-maps-fact__nowcast-alert" -A1 | tail -1 | sed 's/<\/div>//g' | sed 's|.*\. ||'
     scan_interval: 900

At the output I get a sensor: sensor.prognoz_dozdya

The data received from the site is as follows:

  1. No precipitation is expected in the next 2 hours
  2. Rain expected within an hour

When the text is 1), then do nothing, and when it changes and becomes text 2), then send a message in telegram

How can you track changes in this text and send a telegram message about it when it changes?

Use an automation.

trigger:
  - platform: template
    value_template: "{{ 'Rain expected' in states('sensor.prognoz_dozdya') }}"
action:
  service: notify.telegram
  data:
    message: "{{ states('sensor.prognoz_dozdya') }}"
1 Like

Thank you very much, I think this is what I need