Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add suppport for MQTT message matching via RegExp #1371

Open
wants to merge 1 commit into
base: latest
Choose a base branch
from

Conversation

tjmehta
Copy link

@tjmehta tjmehta commented Dec 31, 2022

There are many cases when working with third-party modules where developers may not know the full MQTT message published to a particular topic. In my case, I am using nanit which broadcasts a RTMP video stream and publishes a timestamps when motion is detected. Publishing timestamps make it impossible for me to match the entire message via motionMessage.

To make message matching more flexible for various scenarios, I added RegExp matching support for MQTT messages.

@Sunoo
Copy link
Collaborator

Sunoo commented Dec 31, 2022

Interesting, something like this has been on my to do list for a while. I’ll take a look at your submission as soon as I can get a chance.

@tjmehta
Copy link
Author

tjmehta commented Dec 31, 2022

@tjmehta
Copy link
Author

tjmehta commented Dec 31, 2022

(updated readme and force pushed)

@Sunoo
Copy link
Collaborator

Sunoo commented Dec 31, 2022

That’s in a different branch of this same project: https://github.com/Sunoo/homebridge-camera-ffmpeg/blob/gh-pages/_automation/mqtt.md

if (cameraConfig.mqtt.motionMessageRegExp) {
this.addMqttAction(cameraConfig.mqtt.motionTopic, new RegExp(cameraConfig.mqtt.motionMessageRegExp),
{accessory: accessory, active: true, doorbell: false});
} else {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be backwards compatible to default to camera name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants