Skip to content

Conversation

smelis
Copy link
Contributor

@smelis smelis commented Jul 29, 2024

Adds two components:

ptz - adds a PTZ controller component for cameras that support ONVIF (and pan/tilt/zoom).
telegram - adds a Telegram (bot) component that can do a couple of things:

  1. send video recordings of object detection events and
  2. allows for control of the ptz component
  3. on demand recording
  4. start & stop the camera

Config for the ptz component:

ptz:
  cameras:
     camera_1:
       onvif_port: 80 #
       onvif_username: <username>
       onvif_password: <password>
       camera_min_x: -0.73 # used in "patrol" mode to limit swings to useful fov
       camera_max_x: 0.04 # used in "patrol" mode to limit swings to useful fov
       presets: # allows switching between pre-defined positions
         - name: front # name them
           pan: 0.0
           tilt: 0.0
           on_startup: true # have the camera move to this preset when Viseron starts
         - name: left
           pan: -0.5
           tilt: 0.0
         - name: right
           pan: 0.5
           tilt: 0.0
         - name: path_1 # when preset names are repeated, "moving to a preset" will iterate over the preset and follow a path
           pan: -0.5
           tilt: -0.5 
         - name: path_1
           pan: -0.5
           tilt: 0.5 
         - name: path_1
           pan: 0.5
           tilt: 0.5 
         - name: path_1
           pan: 0.5
           tilt: -0.5
         - name: path_1
           pan: -0.5
           tilt: -0.5
         - name: path_1
           pan: 0.0
           tilt: 0.0

Config for the telegram component:

telegram:
  telegram_bot_token: <ask_the_bot_father>
  telegram_chat_ids: [<ids will be logged and sent back in access denied messages>]
  telegram_user_ids: [<ids will be logged and sent back in access denied messages>]
  detection_label: person
  send_detection_thumbnail: true
  send_detection_video: true
  send_detection_message: false
  telegram_log_ids: true
  cameras:
    camera_1:
    camera_2:

Copy link

netlify bot commented Jul 29, 2024

Deploy Preview for viseron failed.

Name Link
🔨 Latest commit 0d7567d
🔍 Latest deploy log https://app.netlify.com/sites/viseron/deploys/67cea65b5cf46c0008b12385

@roflcoopter
Copy link
Owner

Looks great, thank you! Nice job on decoupling the PTZ component to the Telegram one.
I looked through the code and cant see any obvious issues. Let me know when you think it is ready to be merged and i can take a more thorough look!

smelis added 6 commits July 31, 2024 11:26
…nfig names, removes redundent config, uniform formatting, remove create stop
… commands, fixes only configured cams iso all registered cams, log user_ids for easier setup & audit
… to have the camera follow that path repeatedly. Adds abs_move_wait_complete to wait for a move to complete before sending another move instruction.
@roflcoopter
Copy link
Owner

Hey, just checking in on this PR. Do you think its ready for merge soon or do you need any help to finalize it?

@yangminglong
Copy link

Great job! It seems that I can look forward to "PTZ human tracking" PTZ_PID

@smelis
Copy link
Contributor Author

smelis commented Sep 18, 2024

Hey, just checking in on this PR. Do you think its ready for merge soon or do you need any help to finalize it?

Hi! The CI pipeline is failing, but i don't know why :)

@roflcoopter
Copy link
Owner

Hey, just checking in on this PR. Do you think its ready for merge soon or do you need any help to finalize it?

Hi! The CI pipeline is failing, but i don't know why :)

A rebase should fix it! The docker-compose command is no longer available in the CI runner machine and is replaced with docker compose in dev already.

@roflcoopter
Copy link
Owner

Thought the Netlify errors were just intermittent ones but it seems you need to remove the tags from the _meta.tsx files in the docs. and just make it an empty list: tags: [],

These are the only supported tags which none really fits your components.

export type DomainType =
  | "camera"
  | "face_recognition"
  | "image_classification"
  | "license_plate_recognition"
  | "motion_detector"
  | "nvr"
  | "object_detector"
  | "system";

I can add a notifications tag in a follow up PR

@memes-forever
Copy link

Awesome!! I'm really looking forward to this functionality

@SherifMEldeeb
Copy link

@smelis When would you be able to merge this PR it's so useful

@smelis
Copy link
Contributor Author

smelis commented Mar 9, 2025

@smelis When would you be able to merge this PR it's so useful

Hi, to be honest I thought it was already merged :)
It's not up to me to merge it, but I think there are still some errors? I'm not sure what the problem is, 'cause I can't see the logs.

@smelis
Copy link
Contributor Author

smelis commented Mar 9, 2025

@smelis When would you be able to merge this PR it's so useful

I checked the comments, fixed something and pushed the changes. Hope it can be merged now.

@bitspill
Copy link

@smelis When would you be able to merge this PR it's so useful

Hi, to be honest I thought it was already merged :) It's not up to me to merge it, but I think there are still some errors? I'm not sure what the problem is, 'cause I can't see the logs.

The issue is the tags in the telegram component docs/src/pages/components-explorer/components/telegram/_meta.tsx the listed options tags: ["ptz", "notifications", "telegram", "onvif"] are not defined in the supported DomainTypes at docs/src/types.tsx

Need to either remove them, or define the new tag types for example

export type DomainType =
  | "camera"
  | "face_recognition"
  | "image_classification"
  | "license_plate_recognition"
  | "motion_detector"
  | "nvr"
  | "object_detector"
  | "system"
  | "ptz"
  | "notifications"
  | "telegram"
  | "onvif";

export type Domain = {
  label: string;
  color: string;
};

export type Component = {
  title: string;
  name: string;
  description: string;
  image: string;
  tags: DomainType[];
};

export const Domains: { [type in DomainType]: Domain } = {
  camera: {
    label: "Camera",
    color: "#dfd545",
  },

  face_recognition: {
    label: "Face Recognition",
    color: "#127f82",
  },

  image_classification: {
    label: "Image Classification",
    color: "#fe6829",
  },

  license_plate_recognition: {
    label: "License Plate Recognition",
    color: "#821212",
  },

  motion_detector: {
    label: "Motion Detector",
    color: "#a44fb7",
  },

  nvr: {
    label: "NVR",
    color: "#3063ca",
  },

  object_detector: {
    label: "Object Detector",
    color: "#e9669e",
  },

  system: {
    label: "System",
    color: "#30cac8",
  },

  ptz: {
    label: "PTZ",
    color: "#33df27",
  },

  onvif: {
    label: "ONVIF",
    color: "#cc9c3f",
  },

  notifications: {
    label: "Notifications",
    color: "#d10dce",
  },

  telegram: {
    label: "Telegram",
    color: "#24A1DE",
  },
};

export const DomainsList = Object.keys(Domains) as DomainType[];

@roflcoopter
Copy link
Owner

Thanks, some small changes still required but i will merge the PR and fix them myself.

Thanks for the work on this one!

@roflcoopter roflcoopter merged commit 28dce36 into roflcoopter:dev Mar 10, 2025
13 of 18 checks passed
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.

6 participants