Skip to content

Commit

Permalink
Config reolink cam (#26)
Browse files Browse the repository at this point in the history
* refactor: Deleted ansible files

* refactor: Added Code of conduct file

* refactor: Updated Contributing

* refactor: Added bash scripts to setup rpi

* Updated README related to bash setup

* refactor : Updated & renamed RPI installation file

* typo

* docs : updated README

* Updated README

* Added credentials.json to gitignore

* feat: Removed useless install

* docs : Added exemple config file for cameras

* feat: Added script to setup cameras

* docs: Added tutorial steps to setupcameras

* chore: Added requirement.txt

* typo

* Error : Deleted unsed file

* missing -r

* missing blank line

---------

Co-authored-by: MateoLostanlen <[email protected]>
  • Loading branch information
fe51 and MateoLostanlen authored Nov 11, 2024
1 parent f254830 commit 54312bf
Show file tree
Hide file tree
Showing 5 changed files with 460 additions and 2 deletions.
41 changes: 39 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,44 @@
# pyro-sys-setup
Set-up and manage Pyronear hardware fire detection systems.
pyro-sys-setup is used to configure Pyronear hardware fire detection systems. In particular, you can configure IP cameras (currently from Reolink) and a raspberry pi, by following the tutorial below.

## Setup
## Cameras Setup
### 1. Connecting and powering up cameras on local network
- You will need factory-set Reolink cameras (either cameras are new/refurbished, so you don't need to do anything, or follow [this tutorial](https://support.reolink.com/hc/en-us/articles/360003516613-How-to-Reset-Bullet-or-Dome-Cameras/) to reset them to factory settings).
- These cameras are powered by POE. Connect the cameras via Ethernet to a POE switch connected to your local network (or directly to your computer).

### 2. Configuration requirements
At this step, you will use the reolink application to define a user and password and retrieve the IP address for each camera, and you will report these details in the required configuration files described below :

*By default, files supposed to be available at the root of this repository, but will be able to prodvide a specific path to file at step 4 of this tutorial*

- `.env` file as requested in [pyro-engine](https://github.com/pyronear/pyro-engine/tree/main?tab=readme-ov-file#full-docker-orchestration).

- `cameras_config.json` file. You can find an example at the root of this repository. The purpose of this json is to list all the IP addresses of cameras to be configured, and for each of them certain characteristics to be defined.


**2.1** Choose a username & password, for sake of simplicity, it will be the same user and password used for each cameras, and
report these as CAM_USER and CAM_PWD in .env file

**2.2** Please follow the steps in [`REOLINK_APP_STEPS`](REOLINK_APP_STEPS.md) to set user, password ang get ip adresses with reolinkApp

### 3. Setting up cameras
If you have followed previous steps correctly, you have an .env file and a cameras_config.json file fullfilled.

**3.1** install required librairies in running the following :

```
pip install -r requirements.txt
```

**3.2** Now, from the root of this repository run:

*By default, the script is looking for .env and cameras_config in this repository but you can specify a path for each config file, use `python setup_reolink_cameras.py -h` for help*

``` bash
python setup_reolink_cameras.py
```

## Raspberry pi Setup

### 1. Install raspberry pi os
Please follow the steps in [`RPI_INSTALLATION`](RPI_INSTALLATION.md) to have a rapsberry pi properly running
Expand Down
25 changes: 25 additions & 0 deletions REOLINK_APP_STEPS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

- Download [Reolink app](https://reolink.com/software-and-manual/)
- Start you reolink client, you are supposed to see your cameras (that usually take a few minutes to connect after plugging them in)
- Then for each camera :
- Click on “Uninitialized device”
- You will be asked to define a user & pwd : report information you have chosen in .env previously
- To find the ip adresse of the camera
- Access settings clicking the wheel near cameras name
- Click then on "Network", then "network information"
- You will be able to read the ip address of the camera. Report it in `cameras_config.json`
- You are done with the Reolink app

- Complete `cameras_config.json`
For each cameras, complete values associed to its ip address.
```
{
"type": "static", --> either "ptz" if it is a ptz camera, or "static"
"LocalLink": {
"type": "Static", --> let this value as default
"static": {
"ip": "169.254.40.1", --> advice to start with 169.254.40. and complete with 1 to N (N the number of cameras)
"mask": "255.255.0.0", --> let this value as default
"gateway": "169.254.1.1" --> let this value as default
}
```
35 changes: 35 additions & 0 deletions cameras_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"192.168.1.39": {
"type": "static",
"LocalLink": {
"type": "Static",
"static": {
"ip": "169.254.40.1",
"mask": "255.255.0.0",
"gateway": "169.254.1.1"
}
}
},
"192.168.1.137": {
"type": "static",
"LocalLink": {
"type": "Static",
"static": {
"ip": "169.254.40.2",
"mask": "255.255.0.0",
"gateway": "169.254.1.1"
}
}
},
"192.168.1.167": {
"type": "ptz",
"LocalLink": {
"type": "Static",
"static": {
"ip": "169.254.40.2",
"mask": "255.255.0.0",
"gateway": "169.254.1.1"
}
}
}
}
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
requests
urllib3
python-dotenv
Loading

0 comments on commit 54312bf

Please sign in to comment.