Sending sms on falling edge of time serie

Hi!
I have Mosquitto->Telegraf->influxDB->Grafana installation collecting data from remote sensors. Works like a charm.
I need to send SMS in case of one of monitored binary parameters goes from 1 to 0 (falling edge detection). My SMS services provider offers SOAP integration so I’ve written python script sending alerts.

How to fire this python script when falling edge of the monitored parameter occures?