Hi,
i created some mqtt-entities manually in my mqtt.yaml.
#mqtt:
sensor:
# Anwesenheit Michael S20MNI
- name: "AnwesenheitMichaelOPE"
state_topic: "owrtwifiOPE/status/mac-xx-5d-8f-a0-14-xx/event"
value_template: >
{% set map = {
'new': 'on',
'del': 'off',
} %}
{{ map[value] if value in map else 'error' }}
icon: mdi:account-outline
- name: "AnwesenheitMichaelAP1"
state_topic: "owrtwifiAP1/status/mac-xx-5d-8f-a0-14-xx/event"
icon: mdi:account-outline
- name: "AnwesenheitMichaelAP2"
state_topic: "owrtwifiAP2/status/mac-xx-5d-8f-a0-14-xx/event"
icon: mdi:account-outline
- name: "AnwesenheitMichaelAP3"
state_topic: "owrtwifiAP3/status/mac-xx-5d-8f-a0-14-xx/event"
icon: mdi:account-outline
As you can see, I need to translate the state_topic new=on and del=off.
My question is: Is it required to add the “set map” statement to each entity (*AP1, *AP2…) or is there a global approach to create a map like above?