MQTT Sensor Help - Multiple Topics

I am hoping someone might be able to provide some advice. I am trying to create two MQTT sensors/binary sensors (really not sure which) to use in some alarm automations.

I currently have 5 IP cameras running on a NVR program. 3 are set at the front of the property and 2 are set at the rear. When triggered my NVR sends a MQTT message to home assistant under the topic “BI/CAM#/DETECTED” for example.

So have for example…

Front of house MQTT Topics

Rear of House MQTT Topic

I want to create a sensor for each of these two groups that I can use in an alarm trigger. So far i’ve been able to create a MQTT binary sensor based on ALL of the topics using a + wildcard in the place of “CAM#”. This is with a 1 second off delay. It’s a bit clunky, but it works as a sensor for all cameras. What I really want is a front sensor and a rear sensor.

- unique_id: person_detected_any
state_topic: “BI/+/detected-b64”
value_template: “{%if is_state(entity_id,“on”)-%}OFF{%-else-%}ON{%-endif%}”
off_delay: 1
name: Person Detected Any

Is there anyway to use multiple state topics in a single sensor? Should I be looking at a MQTT sensor instead of a MQTT binary sensor?

I realise I could adjust all of my MQTT topics to include a front/rear such as “BI/FRONT/CAM1/DETECTED” and “BI/REAR/CAM4/DETECTED”. However, I would need to adjust a number of different entities and automations to make this work, as well as make changes on my NVR.

Any help would be appreciated.

You could just create separate binary sensors for each and then use a group helper to have a “front” and “rear” group each containing the relevant cameras.

1 Like

Far simpler than I expected! Thank you!