I want to base the action (message sent) on my motion detector status. I have the following, but something is wrong. any suggestions?
##Telegram lock, unlock, and check for motion
- alias: 'telegram check for motion'
id: '100'
trigger:
platform: event
event_type: telegram_text
event_data:
text: 'Motion'
action:
- service_template: >
{% if is_state('binary_sensor.sensor', 'off') %}
- service: notify.notify_tgram
data:
message: "No motion detected."
{% else %}
- service: notify.notify_tgram
data:
message: "Motion detected."
{% endif %}