seydx / camera.ui

NVR like user Interface for RTSP capable cameras
https://github.com/seydx/camera.ui
MIT License
676 stars 108 forks source link

HTTP & MQTT Alarmserver #296

Open mpolinowski opened 1 year ago

mpolinowski commented 1 year ago

Is your feature request related to a problem? Please describe.

MQTT Alarmserver

I am using a camera that updates an MQTT topic when an alarm was triggered. The value represents different alarm triggers in from of numbers - 1, 2, etc. The value falls back to 0 after a few seconds when entering the idle state:

"mqtt": {
        "motionTopic": "cameras/120/status/alarm/triggered",
        "motionMessage": "{\"val\":\"1\"}",
        "motionResetTopic": "cameras/120/status/alarm/triggered",
        "motionResetMessage": "{\"val\":\"0\"}"
      },

When a trigger event represented by the value 1 happens it is registered. But the update to value 0 when falling back to idle seems to be skipped - seems that the reset topic cannot be identical to the motion topic?

[camera.ui] MQTT: New message: Topic: cameras/120/status/alarm/triggered - Data: {"val":"1"} - Type: string
[camera.ui] MQTT: New message: Topic: cameras/120/status/alarm/triggered - Data: {"val":"1"} - Type: string
[camera.ui] MQTT: New message: Topic: cameras/120/status/alarm/triggered - Data: {"val":"0"} - Type: string
[camera.ui]  WARNING  The incoming MQTT message ({"val":"0"}) for the topic (cameras/120/status/alarm/triggered) was not the same as set in config.json ({"val":"1"}). Skip...

And I am unable to use any other triggers with values > 1.

HTTP Alarmserver

To trigger camera.ui through it's webhook we have to attach a query to the GET request with the camera name. The camera I am using follows the convention of having queries consisting of key + value. So when I am using the alarmserver camera.ui will receive a request with the query ?my%20camera= or ?my%20camera=1:

camera-ui-docker_11

And the alarm is not triggered:

[camera.ui] HTTP: New message: URL: /motion?IN-9408%202k+%20WQHD=1
[camera.ui]  WARNING  IN-9408 2k+ WQHD=1: Camera 'IN-9408 2k+ WQHD=1' not found

Describe the solution you'd like

  1. MQTT :: Is it possible to check if the topic updates payload is not/equal to the reset_value to trigger an alert. And if equal reset the alarm state?
  2. HTTP :: Is it possible to ignore the value of the incoming query string?
mkz212 commented 2 months ago

🎉 A new version of camera.ui

A new version of camera.ui is currently under active development. An initial alpha/beta release and previews are coming soon. Stay tuned for exciting updates: https://github.com/seydx/camera.ui/issues/448 .

This version will no longer be developed / fixed. The new version contains many novelties and fixes (most important is for HKSV recording).