I want to add a condition so that the automation only triggers if the sensor belongs to a certain integration (mqtt), is it possible? How can I do it?
alias: Teste bateria
description: ""
trigger:
- platform: event
event_type: state_changed
condition:
- condition: template
value_template: >-
{{trigger.event.data.new_state.attributes.device_class | default('') ==
'battery' and
trigger.event.data.new_state.state < '9'}}
action:
- service: notify.mobile_app_sm_g985f
data:
title: Dispositivo Zigbee com bateria baixa
message: "{{ state_attr(trigger.event.data.entity_id, 'friendly_name')\_|\_capitalize\_}} em {{ trigger.event.data.new_state.state}}%"