-
-
Notifications
You must be signed in to change notification settings - Fork 228
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
v2.1.0 Testers Needed - MQTT support for Motion Detect! #575
Comments
You can test this by installing latest beta
|
I've been testing over the last 24 hours, and seem to be working fine. Some notes:
Thanks for the great work! |
Thanks for the feedback! |
@isramos we have added an option to remove the dummy toggle switches and also added stateless doorbell switch for automations. If you could try that out? |
Please test out latest beta.
|
Hi, some users mentioned in #554 that they can not restart homebridge due to an issue with multiple services with same UUID, e.g.link The stacks trace in the referenced link shows that the DoorbellSwitch service in line 123 is the issue. homebridge-camera-ffmpeg/src/index.ts Lines 121 to 128 in 94cfc89
Could it be required to remove this service as well as all the other doorbell, motion and switch services? homebridge-camera-ffmpeg/src/index.ts Lines 77 to 93 in 94cfc89
|
@california444 a pull request for this fix would be welcomed. |
I just tested the beta tag. Here are my notes: Whenever motion is detected I send MQTT message:
I see in the logs Once I transmit payload: IMPORTANT: However, I don't see it self clearing. It stays triggered forever. Please test it IMPORTANT: One thing to consider: I suggest decoupling the camera name and use a different property to matching. Let's say I have a portable camera that each day I move to a different room, and each time I give it a different name. It would be a hassle to keep things in sync. On the other hand, if we use, say the serialNumber of the camera (or other prop) that would make it a more robust approach.
In other words: topic would be: |
Also still getting "[FFMPEG] ffmpeg exited with code: 1 and signal: null (error)". This is my last camera in my configuration and the only one having this problem.
|
OK so call me dumb, but can someone point me in the direction or indeed, explain what the point of this MQTT addition is to this plugin. These cams all have built in motion detection and report to a App with video clips when motion is detected as you would expect. Now using the v2.0.1 edition of this plugin, i have a Philips motion detector device which detects motion and switches on the camera dummy switch (via a homekit automation) which in turn triggers the motion sensor part of this plugin and generates the notification to Homekit itself. If the idea that this MQTT will replace the need for the dummy switch and be able to trigger from the camera's own motion sensor (not sure if this is possible). I'd just like a quick brief explanation please...... what would be good would be a way to capture the notification sent from the the Hik-Connect app (or which ever app is generating the notification) and use that as a trigger |
Okay, I can't for the life of me figure out how to get this to work. My camera (a WyzeCam2 running Dafang Hacks) publishes to the topic configured followed by '/motion' with the word 'ON' or 'OFF' depending on whether motion is detected. The name of my camera in this plugin is "Cat Food Camera" so I've tried configuring the camera to publish to "homebridge/motion/Cat Food Camera" and "homebridge/motion/Cat_Food_Camera" and in both cases I'm able to see messages coming (as described above) through when I subscribe to the topics myself. However, nothing I've tried has been able to get this plugin to show that it's seeing anything, though it does log "[Camera-ffmpeg] MQTT CONNECTED!" when restarting Homebridge, I never see anything else MQTT-related, and the motion sensor never changes states. |
Just a thought, but as someone else mentioned, perhaps defining the MQTT topic for each camera would be a better approach, and it’d certainly be more clear when configuring. Some way to specify the messages for motion detected or not (perhaps regex?) might be a useful addition as well, since that likely varies from device to device. |
@fennec622, see past comments. |
So I grabbed the code and started poking around, and it works differently than the documentation at the head of the thread claims.
The way it actually seems to work, is that you need to publish 'Camera name' (without the spaces replaced with underscores) as a message to homebridge/motion. The code as currently written also only swaps the first underscore with a space. So in my case with the camera named 'Cat Food Camera', if I follow the directions and use 'Cat_Food_Camera', the plugin converts it to 'Cat Food_Camera', which means the string comparison never works. However, ignoring that instruction and publishing the message of 'Cat Food Camera' causes the motion sensor to trip. |
Just publish message name of camera To topic You choose More simply to specify one topic for all cameras And adjust message for specify camera I see for replace all Space not only the first |
@fennec622 In Javascript string.replace only works on the first instance of the pattern unless regular expressions are used. I just created pull request #604 to correct this issue. Though, I don't see the need to do this replacement at all, since spaces are a valid character in MQTT messages? I'm also still not convinced that relying on a single topic to handle everything is the best way forward, as that basically mandates some kind of shim program in most cases to subscribe to the MQTT topic that the camera actually publishes to, then republish it in the format this plugin now expects. |
Additionally, I recommend updating the first post to this, to reflect the way this plugin is currently actually working:
|
more simply i make change Cat Food Camera on topic homebridge/motion |
@fennec622 I agree that this is the less confusing approach. I've updated my pull request to strip out that replacement instead. That would mean the first post should be changed to:
Also, I still think it would be nice if, at minimum, there was a way to have two different messages to trigger or clear the motion sensor. It could be set up so that if there is no 'clear' message defined (maybe if motion sensor timeout value is set to '0' in the config or similar?) then the timeout fires and clears the the sensor automatically. |
For the moment reset motion is timeout to 1s But it's possible to add config timer to reset motion for all cameras "motionreset": 1; But why increase time of motion reset ? |
@fennec622 No reason to increase time, but I thought that making it configurable gives an easy spot to disable the reset. The reason for that is that my camera sends messages for both when it sees motion and when it stops seeing motion. It would be nice to have a way to support both of those instead of blinding resetting things, so that the motion sensor in HomeKit matches the motion detected state of the camera. This would make the motion sensor useful beyond just having tripping send a push, I could look at the sensor in Home and see whether motion is currently being detected or not. Perhaps sending a message with the camera name to homebridge/motion/off with the camera name while motionreset is configured to 0 would be the way to handle that? I still think it would be nice to be able to configure the MQTT topic (or maybe just the motionreset value?) per camera though, especially since some cameras might not support sending a 'motion cleared' message and would require the timeout. |
Ok |
Yes, that's exactly what I was getting at. |
Okay, so I figured out a fairly clean way of supporting the way my camera publishes to MQTT. I made another Homebridge plugin (https://github.com/Sunoo/homebridge-dafang-mqtt-republish) that just subscribes to what my camera sends and republishes it in the way this plugin expects. And it works quite well. It would still be very nice to be able to have an MQTT message that resets the motion sensor instead of using the timeout though. I could very easily update my plugin to support that, if some method to do so is added to this plugin. Thanks. |
closing, due to v2.1.0 being release. |
@donavanbecker v2.1.0 works like a charm here, thanks a lot!! |
@california444 thanks for your input!!! |
Can anyone provide a step by step guide to set this up? ive installed the plugin homebridge-mqttthing but im now at a loss If it is not too much to ask - my email is [email protected] thanks |
v2.X.X (2020-XX-XX)
Changes
homebridge/motion/Camera_name
, You must add_
to your camera if you have space in the name.The text was updated successfully, but these errors were encountered: