Thank you to @felixsteghofer for the basic informations and the detailed informations.
I have a PC based and cheap home server. This servers runs Motioneye too in a docker container.
My docker-compose.yml
file for motioneye:
version: '3'
services:
motioneye:
image: ccrisan/motioneye:master-amd64
volumes:
- '/etc/localtime:/etc/localtime:ro'
- './lib:/var/lib/motioneye'
- './etc:/etc/motioneye'
restart: always
network_mode: host
I've started the motioneye container with docker-compose up -d
command.
The motioneye's web UI available on the 8765 port. Example: http://192.168.1.10:8123
But the question is: How can I integrate the new and cheap Digoo M1X IP camera?
I can't setup the camera with the Digoo Cloud App (https://play.google.com/store/apps/details?id=com.ancloudDigooCloud.aws), so I've configured fully manually.
-
step: Connect the Digoo Camera to the network with a LAN cable. Wait 1-3 minutes to the first boot. I've found Digoo's IP address with Fing APP on my phone (https://play.google.com/store/apps/details?id=com.overlook.android.fing) and/or checked my router DHCP leases table.
-
step: I have to connect Digoo cam to the network with wireless. Connected to the camera with telnet console. (example: telnet 192.168.1.30) The user is
root
and without password. (little bit unsecure by default :( ) -
step: I've changed the
/rom/wpa_supplicant0.conf
file withvi
editor like this:
ctrl_interface=/etc/Wireless
network={
ssid="MyWifiNetworkName"
psk="MyWifiPassword"
}
(change the MyWifiNetworkName and MyWifiPassword with your valid wifi name and password)
-
step: I've rebooted the camera with
reboot
command and waited 1-2 minutes to start. -
step: I've found the camera's new IP address like this:
- checked my router DHCP leases list, little bit faster than a network scan again
- but I can connect to the camera with telnet again and check the
ip addr
command output. The IP address onwlan0
interface is the new, wireless address
RTSP URLs:
- rtsp://admin:[email protected]/onvif1 - 1280x960
- rtsp://admin:[email protected]/onvif2 - 320x240
The admin
is the default user and the 20160404
is the default access password to RTSP stream.
How can I added the camera to the Motioneye? I've opened the Motioneye Web UI and logged in with admin user (without password by default). I've added the camera with these parametes:
- Camera type: "network camera"
- URL: "rtsp://192.168.1.30/onvif1"
- username: "admin"
- password: "20160404"
- camera: "rtsp/udp camera"
That's all, almost. I see the camera's video stream with Motioneye.
Pan/Tilt is little bit tricky, because I have to post a short XML to the camera service URL. The usual method is "call an URL". So, I've made some script for this.
I've connected to your Motioneye server with SSH.
I've stepped into motioneye's directory (example: /srv/motioneye). To the directory that contains motioneye's docker-compose.yml file.
Created the digoo-rotate-template.xml
file under the etc
folder (etc/digoo-rotate-template.xml) and inserted these lines:
<v:Envelope
xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns:d="http://www.w3.org/2001/XMLSchema"
xmlns:c="http://www.w3.org/2003/05/soap-encoding"
xmlns:v="http://www.w3.org/2003/05/soap-envelope">
<v:Body>
<ContinuousMove
xmlns="http://www.onvif.org/ver20/ptz/wsdl">
<ProfileToken>IPCProfilesToken0</ProfileToken>
<Velocity>
<PanTilt
xmlns="http://www.onvif.org/ver10/schema" x="--X--" y="--Y--"/>
</Velocity>
</ContinuousMove>
</v:Body>
</v:Envelope>
Created the digoo-rotate.sh
file under the etc
folder (etc/digoo-rotate.sh) and inserted these lines:
#!/bin/bash
IP=$1
DIRECTION=$2
ONVIF_PORT=5000
XML_TEMPLATE="$( dirname $0 )/digoo-rotate-template.xml"
TEMP_OUT="/tmp/digoo-rotate-temp.out"
# x y Action
# 0.0 -1.0 move down
# 0.0 1.0 move up
# 1.0 0.0 move to the right
# -1.0 0.0 move to the left
# ----------------
[ -e $XML_TEMPLATE ] || { echo "Template xml not found"; exit 1; }
case $DIRECTION in
right|RIGHT )
# echo "moving right..."
DATA="$( cat $XML_TEMPLATE | sed s@[email protected]@g | sed s@[email protected]@g )"
;;
left|LEFT )
# echo "moving left..."
DATA="$( cat $XML_TEMPLATE | sed s@[email protected]@g | sed s@[email protected]@g )"
;;
up|UP )
# echo "moving up..."
DATA="$( cat $XML_TEMPLATE | sed s@[email protected]@g | sed s@[email protected]@g )"
;;
down|DOWN )
# echo "moving down..."
DATA="$( cat $XML_TEMPLATE | sed s@[email protected]@g | sed s@[email protected]@g )"
;;
esac
curl -s -o $TEMP_OUT -H "Content-Type: application/soap+xml" -X POST -d "$DATA" http://$IP:$ONVIF_PORT/onvif/device_service || { cat $TEMP_OUT; exit 1; }
I've checked the "Camera ID" on the motioneye UI. Clicked on the Wrench icon and found the number in the "Camera ID" line. Example: 2
I've created some small scripts for directions under the etc
folder.
up_2
script (etc/up_2):
#!/bin/bash
$( dirname $0 )/digoo-rotate.sh "192.168.1.30" "up"
down_2
script (etc/down_2):
#!/bin/bash
$( dirname $0 )/digoo-rotate.sh "192.168.1.30" "down"
right_2
script (etc/right_2):
#!/bin/bash
$( dirname $0 )/digoo-rotate.sh "192.168.1.30" "right"
left_2
script (etc/left_2):
#!/bin/bash
$( dirname $0 )/digoo-rotate.sh "192.168.1.30" "left"
Modified the script permissions (executable permission):
chmod 755 etc/digoo*
chmod 755 etc/*_2
Restarted the motioneye with docker-compose restart
command.
I was lucky, because works :) I hope you can use this little howto if You have a same camera and situation. Good luck!