GithubHelp home page GithubHelp logo

fabtesta / synology-surveillance-api-motion-mqtt-gifs Goto Github PK

View Code? Open in Web Editor NEW
23.0 23.0 5.0 55 KB

A python script to create animated gifs from videos recorded by cameras attached to Synology Surveillance Station and publish their path location via MQTT

License: MIT License

Dockerfile 3.04% Python 96.96%
home-assistant mqtt synology

synology-surveillance-api-motion-mqtt-gifs's People

Contributors

fabtesta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

synology-surveillance-api-motion-mqtt-gifs's Issues

IndexError: list index out of range

I get a list index out of range error:

[2019-03-07 12:34:19] [DEBUG] (MainThread) https://synology-ip:5001 "GET /webapi/entry.cgi?api=SYNO.SurveillanceStation.Camera&method=List&version=1&_sid=token HTTP/1.1" 200 None
[2019-03-07 12:34:19] [INFO] (MainThread) info_response status_code 200
[2019-03-07 12:34:19] [INFO] (MainThread) Synology Info Camera Id 1 Name Xiaofang1 IP 192.168.x.x
[2019-03-07 12:34:19] [INFO] (MainThread) CameraMotionEventHandler  poll_event 1 Main Entrance
[2019-03-07 12:34:19] [INFO] (MainThread) Start getting last camera event for camera 1 Main Entrance
[2019-03-07 12:34:19] [DEBUG] (MainThread) Starting new HTTPS connection (1): tonyyy.duckdns.org:5001
/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
[2019-03-07 12:34:19] [DEBUG] (MainThread) https://synology-ip:5001 "GET /webapi/entry.cgi?api=SYNO.SurveillanceStation.Event&method=List&version=4&locked=0&reason=2&limit=1&cameraIds=1&_sid=token HTTP/1.1" 200 None
[2019-03-07 12:34:19] [INFO] (MainThread) event_response status_code 200
Traceback (most recent call last):
  File "/synology_surveillance_motion_mqtt_gifs.py", line 290, in <module>
    main()
  File "/synology_surveillance_motion_mqtt_gifs.py", line 281, in main
    camera_handler.poll_event()
  File "/synology_surveillance_motion_mqtt_gifs.py", line 210, in poll_event
    event_id = syno_last_event(self.base_url, self.camera["id"], self.sid)
  File "/synology_surveillance_motion_mqtt_gifs.py", line 125, in syno_last_event
    if event_data["data"]["events"][0]["cameraId"] == camera_id:
IndexError: list index out of range

My config.json:

{
  "mqtt_server": "192.168.x.x",
  "mqtt_port": 1883,
  "mqtt_user": "homeassistant",
  "mqtt_pwd": "pw",
  "mqtt_base_topic": "synology/cameras/gifs",
  "ffmpeg_working_folder": "./gifs",
  "synology_base_api_url": "https://synology-ip:5001",
  "synology_user": "user",
  "synology_password": "pw",
  "synology_cameras": [
    {
      "id": 1,
      "skip_first_n_secs": 5,
      "max_length_secs": 5,
      "scale": 320,
      "topic_name": "Main Entrance"
    }
  ]
}

Any hints what I am doing wrong?

New client connected

Great product in use a long time now ;-) already.

While diving into the mosquitto logs I see this message often.

2024-03-17T09:25:47: New client connected from 192.168.**.**:45778 as BAC5BF18-48B7-BA3C-6198-E5266107CE41 (p2, c1, k60).
2024-03-17T09:25:47: Client BAC5BF18-48B7-BA3C-6198-E5266107CE41 closed its connection.
2024-03-17T09:26:25: New connection from 192.168.**.**:42116 on port 1883.
2024-03-17T09:26:25: New client connected from 192.168.**.**:42116 as 72A8EDB0-ACDF-4AD5-8A95-AE6AA9CB9A27 (p2, c1, k60).

Should we be able to set some sort of ping or mqtt time out in the config so it will continue to have a connection with the MQTT server ?
And a client name to connect to mqtt will make it also more identifiable ;-)

image

No events got from camera, that in reality has.

I see events in Station and get mobile push, but in service I constantly get

[2021-01-13 11:44:22] [INFO] (MainThread) Start getting last camera event for camera 2 Гостиная
[2021-01-13 11:44:22] [INFO] (MainThread) event_response status_code 200
[2021-01-13 11:44:22] [INFO] (MainThread) No event found for camera 2 Гостиная

DSM | 6.2.3-25426 Update 2
Surveillance Station | 8.2.8-6335

Unable to connect to mqtt broker

Hi,

I’ve installed the docker container, created a config file and run it.

Gifs are created. But there’s no mqtt message. I’ve using mqtt explorer to look for the topic but there is no message.

Here is my config


{
  "data_folder": "",
  "mqtt_server": "xxx.xxx.x.xxx",
  "mqtt_port": 1883,
  "mqtt_user": "xxxxx",
  "mqtt_pwd": "xxx#xxxxxx",
  "mqtt_base_topic": "cameras/gifs",
  "ffmpeg_working_folder": "./gifs",
  "synology_base_api_url": "http://xxx.xxx.x.xxx:5000",
  "synology_user": "xxxxx",
  "synology_password": "xxxxx",
  "synology_cameras": [
    {
      "id": 2,
      "skip_first_n_secs": 5,
      "max_length_secs": 5,
      "scale": 320,
      "topic_name": "veranda"
    },
    {
      "id": 3,
      "skip_first_n_secs": 7,
      "max_length_secs": 10,
      "scale": 640,
      "topic_name": "balcone"
    }
  ]
}

can ypu please support me?

Add wait to polling.

Can you please help to add a wait time settings between polling events?
In my case I always get second event, when motion stops and lights turned off.
It would be great if we could control how often new events checks fires.

DSM7.0 Login issue

SYNO.API urls

synoApiLoginUrl = "{}/webapi/auth.cgi?api=SYNO.API.Auth&method=Login&version=2"
"&session=SurveillanceStation&format=sid&account={}&passwd={}"

Is not working on DSM7.

SYNO.API urls

synoApiLoginUrl = "{}/webapi/auth.cgi?api=SYNO.API.Auth&method=login&version=3"
"&session=SurveillanceStation&format=sid&account={}&passwd={}"

Will allow you to login and get a sinotoken.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.