QuantumEntangledAndy / neolink

An RTSP bridge to Reolink IP cameras
GNU Affero General Public License v3.0
297 stars 44 forks source link

Feature/push notification #85

Closed QuantumEntangledAndy closed 10 months ago

QuantumEntangledAndy commented 1 year ago

This tracks the RE of the push notifications that the mobile clients use for motion detection.

In addition it also exemplifies some of the rest api commands that mobile uses

If interested please read crates/pushnoti/README.md which has current progress and updates

https://github.com/QuantumEntangledAndy/neolink/blob/feature/push_notification/crates/pushnoti/README.md

QuantumEntangledAndy commented 1 year ago

Success:

Finally got it to work.

[2023-05-19T08:05:44Z INFO  pushnoti] Listening
[2023-05-19T08:06:59Z INFO  pushnoti] Message JSON: {"data":{"SRVTIME":"2023-05-19T08:07:03.566Z","ALMNAME":"Motion Alert from Cam01","sound":"push.wav","CHNAME":"Cam0","messageType":"alarm","DEVNAME":"Cam01","pushVersion":"v1.1","UID":"REDACTED","ALMTYPE":"MD","ALMCHN":"1","alert":"Motion Alert from Cam01","title":"Camera Alert"},"from":"743639030586","priority":"normal","notification":{"title":"Camera Alert","body":"Motion Alert from Cam01"},"fcmMessageId":"REDACTED"}
[2023-05-19T08:06:59Z INFO  pushnoti] Persistent ID: Some("REDACTED")
QuantumEntangledAndy commented 1 year ago

Here's there json message format:

{
    "data": {
        "SRVTIME": "2023-05-19T08:07:03.566Z",
        "ALMNAME": "Motion Alert from Cam01",
        "sound": "push.wav",
        "CHNAME": "Cam0",
        "messageType": "alarm",
        "DEVNAME": "Cam01",
        "pushVersion": "v1.1",
        "UID": "REDACTED",
        "ALMTYPE": "MD",
        "ALMCHN": "1",
        "alert": "Motion Alert from Cam01",
        "title": "Camera Alert"
    },
    "from": "743639030586",
    "priority": "normal",
    "notification": { "title": "Camera Alert", "body": "Motion Alert from Cam01" },
    "fcmMessageId": "REDACTED"
}
franciscofsales commented 1 year ago

@QuantumEntangledAndy this is a must for battery based cameras, I could try to help, what's missing from this PR?

Thanks

QuantumEntangledAndy commented 1 year ago
QuantumEntangledAndy commented 1 year ago

The PR here atm is more of a proof of concept. It has a demo crate that is used to setup and listen for push notifications. So it's not hooked up to the rest of the code yet.