Thanks tom_i for that information. I tired it out, but it does not work. It works however if I leave the Payload field empty and just trigger off of the MQTT topic, but that will not do in this scenario.
P.S.
I just now did a test by making a sensor out of the following yaml:
and I shows either the values of either True or False (in uppercase). I then made this automation:
alias: APIR
description: ''
trigger:
- platform: state
entity_id: sensor.tpir
from: 'false'
to: 'true'
...... DO SOMETHING .....
but that did not work. But when I changed the condition to uppercase, it then worked. I then went back to your code example and made that uppercase, but that still doesn’t work. Strange.
My side question here is now why is it changing the MQTT data to uppercase?