Motioneye [motion based with WEB GUI]
Moderator: leecollings
-
- Posts: 157
- Joined: Thursday 27 August 2015 18:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V3.6028
- Location: Greece
- Contact:
Motioneye [motion based with WEB GUI]
Hi,
this weekend I tested motioneye ( https://github.com/ccrisan/motioneye ).
It is very exciting to have an web frontend for motion and to configure multiple cameras in just some clicks. I really see a lot of pontential of this project.
It supports Webhooks and commands. I tried to get some info from the developer how can be used hebhook but it did not get any point for domoticz. Did anyone have performed any test with motioneye and domoticz?
this weekend I tested motioneye ( https://github.com/ccrisan/motioneye ).
It is very exciting to have an web frontend for motion and to configure multiple cameras in just some clicks. I really see a lot of pontential of this project.
It supports Webhooks and commands. I tried to get some info from the developer how can be used hebhook but it did not get any point for domoticz. Did anyone have performed any test with motioneye and domoticz?
>>>> Google Home <<<<<
SBC: Odroid XU4 * Raspberry Pi2 * banana Pi v1
Peripherals: rfxtrx433E, aeon z-stick gen5, bluetooth dongles
Extended Software packages: Xeoma (video NVR), FHEM (extra home automation software)
SBC: Odroid XU4 * Raspberry Pi2 * banana Pi v1
Peripherals: rfxtrx433E, aeon z-stick gen5, bluetooth dongles
Extended Software packages: Xeoma (video NVR), FHEM (extra home automation software)
- proohu01
- Posts: 95
- Joined: Friday 17 October 2014 12:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: Motioneye [motion based with WEB GUI]
Did you get this working with Domoticz? What image URL did you use?
Pi 2 B | Pi Camera | PiFace 2 | RFXtrx433E (KaKu + Oregon Scientific) | Plugwise (9 Circles) | Aeon Z-Wave stick (Fibaro - dimmers, sockets, RGB, screens/blinds) | RFXMeter (Kwh/water/gaz) | WOL | Onkyo Receiver | RTC | Hikvision | Netatmo | Satel Integra
-
- Posts: 17
- Joined: Friday 29 May 2015 12:25
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: The Netherlands
- Contact:
Re: Motioneye [motion based with WEB GUI]
I've used motioneye with domoticz. I installed it on an old raspberry pi to see if I could make my own digital wifi doorviewer from a doorviewer and an endoscope usb camera. It gives an URL (picture/1/current/) which you can use in domoticz. I was not satisfied with the speed. I wanted a picture when the doorbell was ringing, but it was too slow. When the doorbell rang it sends an old picture instead of the one that was made when the doorbell rang. It was an old raspberry pi (256mb version), so maybe with a new one (faster) it will work perfectly.
- proohu01
- Posts: 95
- Joined: Friday 17 October 2014 12:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands
- Contact:
Re: Motioneye [motion based with WEB GUI]
Thanks for that. I tested it on a Pi2B. I did not get it to work at first because I was using port 8081 in the Domoticz settings for this camera. When using port 8081, the preview image ("Test Connection" button) works perfect but streaming video and taking a snapshot did not work.
Changing the port to 80 makes streaming video and taking snapshots work but "Test Connection" button doesn't work.
I don't know if the speed is fast enough for a doorbel picture with the MotionEye on a Pi 2B. I already have a Hikvision for that an that one is fast. Perhaps I will test this some other time with MotionEye too.
Changing the port to 80 makes streaming video and taking snapshots work but "Test Connection" button doesn't work.

I don't know if the speed is fast enough for a doorbel picture with the MotionEye on a Pi 2B. I already have a Hikvision for that an that one is fast. Perhaps I will test this some other time with MotionEye too.
Pi 2 B | Pi Camera | PiFace 2 | RFXtrx433E (KaKu + Oregon Scientific) | Plugwise (9 Circles) | Aeon Z-Wave stick (Fibaro - dimmers, sockets, RGB, screens/blinds) | RFXMeter (Kwh/water/gaz) | WOL | Onkyo Receiver | RTC | Hikvision | Netatmo | Satel Integra
Re: Motioneye [motion based with WEB GUI]
I am running motioneye os on a pi zero. Ik works fine except with domoticz. I can not get motioneye to work with domoticz, except in the test window (seems always be the case with computers, it works fine, except whatever I want it to do with it
) It seems other also had this problem... So how did you fix it? How did you set it up with port 80 to get it working? Did you use the motioneye os image?
I tried as image url:
and both port 80/8081
motioneye works fine with securityspy (accessing motioneye cam with ?action=stream) which also accept network camera and have a streaming server, such that i still can see it in domoticz but this is a big work-a-round I rather would not use securityspy as translator between my pizero motioneye and domoticz... (only for one camera, with motion off on the zero, and securityspy motion on with an overlay to block out moving cars, trees, one thing motioneye misses, motion overlay such that you can block out moving parts...)
Does anybody has motioneye working?

I tried as image url:
Code: Select all
picture/1/current/
?action=stream
/
motioneye works fine with securityspy (accessing motioneye cam with ?action=stream) which also accept network camera and have a streaming server, such that i still can see it in domoticz but this is a big work-a-round I rather would not use securityspy as translator between my pizero motioneye and domoticz... (only for one camera, with motion off on the zero, and securityspy motion on with an overlay to block out moving cars, trees, one thing motioneye misses, motion overlay such that you can block out moving parts...)
Does anybody has motioneye working?
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Motioneye [motion based with WEB GUI]
Have a look at pikrellcam. Much lighter and better motion detection.
Re: Motioneye [motion based with WEB GUI]
It looks very very awesome! And you also can still see your snapshot/live feed in domoticz?
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Motioneye [motion based with WEB GUI]
It is possible, but I don't really see a reason to do that.
I use php pages that act as a proxy (so the camera isn't exposed to the net).
From pikrellcam I call a bash script that silently sends a picture to Telegram and sets a switch in Domoticz.
Depending on conditions that switch triggers other stuff like notification with sound if we're not a sleep, switch the light on if dark,...
I use php pages that act as a proxy (so the camera isn't exposed to the net).
From pikrellcam I call a bash script that silently sends a picture to Telegram and sets a switch in Domoticz.
Depending on conditions that switch triggers other stuff like notification with sound if we're not a sleep, switch the light on if dark,...
Re: Motioneye [motion based with WEB GUI]
I figure it out...
Looks very very promising, the motion part! The motion in motioneye is not that great (understatement). And this is also way better then the motion detection in securityspy. Defining regions instead of only 4 fixed regions
This probably means way way less camera's to do zone detection in a room
http://domoticz.com/forum/viewtopic.php ... nes#p85624 Going to experiment with it! I got 6 pi-0's with camera's and 4 usb camera's wonder how many zones I could squeeze out of it...
Thanks! Happy happy joy joy...
Also still looking for facial recognition software



Thanks! Happy happy joy joy...
Also still looking for facial recognition software

- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Motioneye [motion based with WEB GUI]
I don't think it's possible to have different actions for the different zones in the motion detection, correct me if I'm wrong.
But I'm planning to contact the developer to make that possible.
I'd like different actions like:
Motion in whole picture: record video
Motion in lower 2/3: send picture
Motion in lower 1/3: ring the bell etc...
Besides that, the biggest advantage of pikrellcam over several others I tested is it's vector based motion detection (instead of just change in light) and it's light footprint. Where motion uses 40-60% cpu this one does it better with only 4-5%.
But I'm planning to contact the developer to make that possible.
I'd like different actions like:
Motion in whole picture: record video
Motion in lower 2/3: send picture
Motion in lower 1/3: ring the bell etc...
Besides that, the biggest advantage of pikrellcam over several others I tested is it's vector based motion detection (instead of just change in light) and it's light footprint. Where motion uses 40-60% cpu this one does it better with only 4-5%.
Re: Motioneye [motion based with WEB GUI]
5% instead of 40%-60% means I can run a lot more software then I was expected on 6 pi0's or a lot more usb camera's per pi 
The information on http://billw2.github.io/pikrellcam/pikrellcam.html is a little sparse (not even a link to https://github.com/billw2/pikrellcam). I assumed when defining regions and numbering them, that motion per region would work. Assumptions
If one assumes, one should verify.
If it's not in it, that should definitily be added, also the direction of the vector would be nice, i was hoping for sending to domoz for example: motion detected in region 2 from NE to E, or something simular (or left to right, up down, but i rather have 8 directions like wind directions). I mean the information is there, I can see it on the video with the bird
OpenCV looks also promising
https://thinkrpi.wordpress.com/2013/05/ ... board-csi/
https://github.com/pageauc/motion-track ... d_track.md

The information on http://billw2.github.io/pikrellcam/pikrellcam.html is a little sparse (not even a link to https://github.com/billw2/pikrellcam). I assumed when defining regions and numbering them, that motion per region would work. Assumptions

If it's not in it, that should definitily be added, also the direction of the vector would be nice, i was hoping for sending to domoz for example: motion detected in region 2 from NE to E, or something simular (or left to right, up down, but i rather have 8 directions like wind directions). I mean the information is there, I can see it on the video with the bird

OpenCV looks also promising
https://thinkrpi.wordpress.com/2013/05/ ... board-csi/
https://github.com/pageauc/motion-track ... d_track.md
Re: Motioneye [motion based with WEB GUI]
I think he added the motion sensor triggers per region.
At least looking at this commit...
https://github.com/billw2/pikrellcam/co ... 23ade59bae
https://github.com/billw2/pikrellcam/bl ... end-alarm2
https://github.com/billw2/pikrellcam
Going to play with it this weekend. Motion sensor camera on a pi zero with multiple regions and motion direction... low cpu! yeah baby!

At least looking at this commit...
https://github.com/billw2/pikrellcam/co ... 23ade59bae
https://github.com/billw2/pikrellcam/bl ... end-alarm2
https://github.com/billw2/pikrellcam
Going to play with it this weekend. Motion sensor camera on a pi zero with multiple regions and motion direction... low cpu! yeah baby!
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Motioneye [motion based with WEB GUI]
Sounds very interesting!
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Motioneye [motion based with WEB GUI]
Oh, I already had that version several days.
Will be interesting to use this in a script, this are all motion events of 1 movie...
Will be interesting to use this in a script, this are all motion events of 1 movie...
Code: Select all
pi@picam3:/run/pikrellcam $ cat motion-events
<header>
video /temp/videos/PiCam3_2016-08-17_19.25.29_126.mp4
frame 81 61
preset 1 1
magnitude_limit 5
magnitude_count 50
burst_count 500
burst_frames 3
</header>
<motion 5.458>
b 0
f 3 39 17 4 17 73
0 3 39 17 4 17 73
</motion>
<motion 5.750>
b 0
f 6 45 3 16 16 208
0 3 43 2 15 15 134
1 10 47 4 17 17 74
</motion>
<motion 5.917>
b 0
f 7 48 -1 20 20 243
0 4 46 -2 19 19 147
1 10 50 0 21 21 96
</motion>
<motion 6.083>
b 0
f 6 50 -2 20 20 178
0 3 48 -4 19 19 121
1 10 53 0 22 22 57
</motion>
<motion 6.250>
b 0
f 3 52 -4 30 30 73
0 3 52 -4 30 30 73
</motion>
<motion 8.917>
b 0
f 3 53 12 -12 17 53
0 3 53 12 -12 17 53
</motion>
<motion 9.083>
b 0
f 10 52 18 -10 21 60
1 10 52 18 -10 21 60
</motion>
<motion 9.250>
b 0
f 11 52 31 -6 32 269
0 4 51 30 -9 31 85
1 11 52 31 -6 32 98
2 19 53 32 -3 32 86
</motion>
<motion 9.417>
b 0
f 19 51 40 2 40 331
1 11 50 38 2 38 122
2 19 51 42 3 42 112
3 27 53 42 2 42 97
</motion>
<motion 9.583>
b 0
f 31 50 36 -5 36 170
3 27 49 41 -5 41 80
4 35 52 31 -6 32 90
</motion>
<motion 9.750>
b 0
f 35 48 33 -12 35 298
3 27 44 38 -23 44 74
4 35 48 37 -10 38 113
5 43 52 26 -4 26 111
</motion>
<motion 9.917>
b 0
f 43 46 32 -8 33 389
4 36 42 40 -14 42 97
5 43 45 32 -9 33 181
6 51 51 25 -2 25 111
</motion>
<motion 10.083>
b 0
f 51 45 32 -7 33 452
5 44 42 37 -11 39 133
6 51 44 33 -7 34 207
7 58 49 26 -3 26 112
</motion>
<motion 10.250>
b 0
f 58 42 34 -4 34 442
6 52 42 38 -8 39 173
7 59 41 38 -3 38 200
8 65 45 28 -2 28 69
</motion>
<motion 10.417>
b 588
f 59 42 18 -15 23 352
</motion>
<motion 10.583>
b 0
f 70 36 12 0 12 266
8 67 37 12 -1 12 174
9 73 35 13 0 13 92
</motion>
<motion 13.083>
b 0
f 67 40 11 2 11 327
7 60 51 11 1 11 91
8 67 40 11 2 11 152
9 74 29 12 5 13 84
</motion>
<motion 13.250>
b 0
f 71 38 13 8 15 266
8 68 43 12 8 14 127
9 74 34 14 9 17 139
</motion>
<motion 13.583>
b 628
f 67 46 13 12 18 228
</motion>
<motion 17.250>
b 0
f 59 27 -22 44 49 204
6 52 23 -29 55 62 60
7 59 28 -21 43 48 76
8 67 32 -17 36 40 68
</motion>
<motion 17.417>
b 0
f 68 46 -7 32 33 65
8 68 46 -7 32 33 65
</motion>
<motion 17.750>
b 0
f 71 48 -26 -12 29 144
8 68 52 -26 -7 27 80
9 74 45 -27 -18 32 64
</motion>
<motion 17.917>
b 0
f 64 48 -31 -10 33 196
7 61 50 -32 -8 33 69
8 67 47 -31 -13 34 127
</motion>
<motion 18.083>
b 0
f 56 45 -33 -16 37 232
6 53 46 -33 -13 35 89
7 59 44 -34 -20 39 143
</motion>
<motion 18.583>
b 0
f 39 41 -14 -3 14 547
3 30 37 -15 0 15 50
4 35 40 -14 -2 14 202
5 43 41 -14 -5 15 185
6 50 47 -14 -7 16 110
</motion>
<motion 18.750>
b 634
f 35 42 -16 0 16 535
3 28 38 -16 1 16 137
4 35 42 -16 1 16 220
5 43 46 -16 0 16 178
</motion>
<motion 18.917>
b 0
f 31 44 -23 7 24 603
2 21 39 -24 8 25 84
3 27 41 -22 6 23 226
4 35 46 -23 7 24 196
5 42 50 -26 10 28 97
</motion>
<motion 19.083>
b 0
f 23 41 -29 2 29 473
1 13 36 -32 4 32 53
2 19 40 -30 2 30 193
3 27 44 -29 0 29 150
4 34 47 -27 4 27 77
</motion>
<motion 19.250>
b 555
f 19 43 -17 -1 17 527
1 12 38 -19 -1 19 152
2 19 45 -18 -1 18 206
3 27 48 -16 -2 16 169
</motion>
<motion 19.417>
b 0
f 11 41 -18 0 18 436
0 4 35 -20 0 20 98
1 11 42 -18 0 18 184
2 19 46 -16 0 16 154
</motion>
<motion 19.583>
b 0
f 11 45 -16 0 16 403
0 4 39 -18 0 18 136
1 11 46 -16 0 16 180
2 18 50 -14 -2 14 87
</motion>
<motion 19.917>
b 0
f 6 47 -8 0 8 220
0 3 45 -8 1 8 109
1 10 49 -9 0 9 111
</motion>
<motion 20.083>
b 0
f 7 49 -1 14 14 232
0 4 48 -1 13 13 112
1 11 50 -2 15 15 120
</motion>
<motion 20.250>
b 0
f 7 51 4 28 28 178
0 4 50 4 28 28 95
1 11 52 5 28 28 83
</motion>
<motion 20.417>
b 0
f 3 53 0 25 25 70
0 3 53 0 25 25 70
</motion>
<motion 20.583>
b 0
f 3 55 0 15 15 50
0 3 55 0 15 15 50
</motion>
<motion 24.583>
b 0
f 2 51 -13 -10 16 50
0 2 51 -13 -10 16 50
</motion>
<motion 36.250>
b 0
f 4 32 18 0 18 64
0 4 32 18 0 18 64
</motion>
<motion 36.917>
b 0
f 15 35 14 0 14 231
1 11 38 14 0 14 153
2 19 32 14 0 14 78
</motion>
<motion 37.083>
b 0
f 10 36 8 3 9 348
0 3 35 0 11 11 89
1 11 40 13 0 13 159
2 18 34 13 0 13 100
</motion>
<motion 37.417>
b 0
f 18 46 0 35 35 61
2 18 46 0 35 35 61
</motion>
<motion 37.583>
b 681
f 16 38 7 3 8 324
</motion>
<motion 37.917>
b 0
f 26 39 10 1 10 107
3 26 39 10 1 10 107
</motion>
<motion 38.583>
b 0
f 3 36 0 8 8 124
0 3 36 0 8 8 124
</motion>
<motion 38.750>
b 0
f 3 36 0 8 8 124
0 3 36 0 8 8 124
</motion>
<motion 38.917>
b 0
f 3 37 0 7 7 117
0 3 37 0 7 7 117
</motion>
<motion 39.083>
b 0
f 3 37 1 7 7 123
0 3 37 1 7 7 123
</motion>
<motion 39.583>
b 0
f 3 38 0 8 8 123
0 3 38 0 8 8 123
</motion>
<motion 39.750>
b 0
f 3 38 1 6 6 117
0 3 38 1 6 6 117
</motion>
<motion 39.917>
b 0
f 3 39 1 6 6 113
0 3 39 1 6 6 113
</motion>
<motion 40.083>
b 0
f 11 40 2 6 6 266
0 3 40 0 6 6 114
1 11 39 4 6 7 85
2 19 41 3 6 7 67
</motion>
<motion 40.250>
b 0
f 11 41 1 5 5 268
0 3 41 0 6 6 127
1 11 41 2 6 6 80
2 19 43 2 5 5 61
</motion>
<motion 40.417>
b 0
f 19 45 0 6 6 285
0 3 41 0 6 6 119
1 11 42 1 6 6 113
5 43 52 0 6 6 53
</motion>
<motion 40.583>
b 0
f 11 43 1 6 6 282
0 3 42 0 6 6 113
1 11 44 1 6 6 107
2 19 44 2 6 6 62
</motion>
<motion 40.750>
b 0
f 15 45 0 6 6 353
0 3 41 0 6 6 113
1 11 44 1 6 6 104
2 19 46 1 6 6 80
3 27 49 1 6 6 56
</motion>
<motion 40.917>
b 0
f 11 44 1 6 6 284
0 3 42 0 6 6 113
1 11 44 1 6 6 114
2 19 46 2 6 6 57
</motion>
<motion 41.083>
b 0
f 15 46 0 6 6 335
0 3 43 0 6 6 105
1 11 45 0 6 6 102
2 19 48 1 6 6 77
3 27 50 0 6 6 51
</motion>
<motion 41.250>
b 0
f 7 44 0 6 6 197
0 3 42 0 6 6 105
1 11 47 1 6 6 92
</motion>
<motion 41.417>
b 0
f 11 46 0 6 6 248
0 4 42 0 6 6 89
1 11 47 0 6 6 93
2 19 50 1 6 6 66
</motion>
<motion 41.583>
b 0
f 15 49 0 6 6 118
1 11 47 0 6 6 60
2 19 51 1 6 6 58
</motion>
<motion 41.750>
b 0
f 11 47 0 6 6 61
1 11 47 0 6 6 61
</motion>
<end>
Re: Motioneye [motion based with WEB GUI]
Cool, I havent played with it for long, I was waiting for this, to undertake operation motioneye replacement 

- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Motioneye [motion based with WEB GUI]
OK, altered the example script a bit. This script doesn't use the pkc udp multicast anymore but simple puts a Domoticz switch to on.
So, set magnitude and count to the lowest desired value for any region.
Then, using this script as a on_motion_start, and deside for each region what level of magnitude and count is required to activate the switch.
The holdoff is still in place but lowered to 3 sec. So the script will not do more calls to domoticz, only if movement is still busy and 3 seconds are passed.
Writing this down, I'm thinking that more variables are nescessary for this. Like a tsent for each region.
So, set magnitude and count to the lowest desired value for any region.
Then, using this script as a on_motion_start, and deside for each region what level of magnitude and count is required to activate the switch.
The holdoff is still in place but lowered to 3 sec. So the script will not do more calls to domoticz, only if movement is still busy and 3 seconds are passed.
Writing this down, I'm thinking that more variables are nescessary for this. Like a tsent for each region.
Code: Select all
#!/usr/bin/env python
import sys
import socket
import time
import urllib2
holdoff = 3
filename = '/run/pikrellcam/motion-events'
file = open(filename,'r')
state = 'wait'
tsent = 0
while 1:
where = file.tell()
line = file.readline()
if not line:
time.sleep(0.1)
file.seek(where)
continue
line = line.strip('\n')
if (line.find('<motion') == 0):
state = 'motion'
elif (line.find('</motion>') == 0):
state = 'wait'
elif (line.find('<end>') == 0):
sys.exit(1)
elif (state == 'motion'):
if (line.startswith(str(0))):
tnow = time.time()
if (tnow >= tsent + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent = tnow
elif (line.startswith(str(1))):
tnow = time.time()
if (tnow >= tsent + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent = tnow
elif (line.startswith(str(2))):
tnow = time.time()
if (tnow >= tsent + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent = tnow
elif (line.startswith(str(3))):
tnow = time.time()
if (tnow >= tsent + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent = tnow
elif (line.startswith(str(4))):
tnow = time.time()
if (tnow >= tsent + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent = tnow
elif (line.startswith(str(5))):
tnow = time.time()
if (tnow >= tsent + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent = tnow
elif (line.startswith(str(6))):
tnow = time.time()
if (tnow >= tsent + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent = tnow
elif (line.startswith(str(7))):
tnow = time.time()
if (tnow >= tsent + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent = tnow
elif (line.startswith(str(8))):
tnow = time.time()
if (tnow >= tsent + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent = tnow
elif (line.startswith(str(9))):
tnow = time.time()
if (tnow >= tsent + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent = tnow
- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Motioneye [motion based with WEB GUI]
This should be better, each region has it's own holdoff time variable.
Code: Select all
#!/usr/bin/env python
import sys
import socket
import time
import urllib2
holdoff = 3
filename = '/run/pikrellcam/motion-events'
file = open(filename,'r')
state = 'wait'
tsent0 = 0
tsent1 = 0
tsent2 = 0
tsent3 = 0
tsent4 = 0
tsent5 = 0
tsent6 = 0
tsent7 = 0
tsent8 = 0
tsent9 = 0
while 1:
where = file.tell()
line = file.readline()
if not line:
time.sleep(0.1)
file.seek(where)
continue
line = line.strip('\n')
if (line.find('<motion') == 0):
state = 'motion'
elif (line.find('</motion>') == 0):
state = 'wait'
elif (line.find('<end>') == 0):
sys.exit(1)
elif (state == 'motion'):
if (line.startswith(str(0))):
tnow = time.time()
if (tnow >= tsent0 + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent0 = tnow
elif (line.startswith(str(1))):
print line
tnow = time.time()
if (tnow >= tsent1 + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent1 = tnow
elif (line.startswith(str(2))):
print line
tnow = time.time()
if (tnow >= tsent2 + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent2 = tnow
elif (line.startswith(str(3))):
print line
tnow = time.time()
if (tnow >= tsent3 + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent3 = tnow
elif (line.startswith(str(4))):
print line
tnow = time.time()
if (tnow >= tsent4 + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent4 = tnow
elif (line.startswith(str(5))):
print line
tnow = time.time()
if (tnow >= tsent5 + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent5 = tnow
elif (line.startswith(str(6))):
print line
tnow = time.time()
if (tnow >= tsent6 + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent6 = tnow
elif (line.startswith(str(7))):
print line
tnow = time.time()
if (tnow >= tsent7 + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent7 = tnow
elif (line.startswith(str(8))):
print line
tnow = time.time()
if (tnow >= tsent8 + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent8 = tnow
elif (line.startswith(str(9))):
print line
tnow = time.time()
if (tnow >= tsent9 + holdoff):
r, x, y, dx, dy, mag, count = line.split()
if (int(mag) >= 12 and int(count) >= 20):
urllib2.urlopen('http://192.168.0.10:8084/json.htm?type=command¶m=switchlight&idx=545&switchcmd=On&level=0&passcode=').read(1000)
tsent9 = tnow
Re: Motioneye [motion based with WEB GUI]
Thank! Wish it was weekend already
Finally can do my zones detections with movement directions. Finally can get my lamp lights to follow me around 


- Egregius
- Posts: 2592
- Joined: Thursday 09 April 2015 12:19
- Target OS: Linux
- Domoticz version: v2024.7
- Location: Beitem, BE
- Contact:
Re: Motioneye [motion based with WEB GUI]
You're welcome 
Will try to find out tomorrow what these numbers exactly mean:
r, x, y, dx, dy, mag, count = line.split()
r = region
x = x position(horizontal or vertical?) of the whole screen or just for the region?
y = idem
dx = direction?
dy =
mag = speed
count = size

Will try to find out tomorrow what these numbers exactly mean:
r, x, y, dx, dy, mag, count = line.split()
r = region
x = x position(horizontal or vertical?) of the whole screen or just for the region?
y = idem
dx = direction?
dy =
mag = speed
count = size
-
- Posts: 245
- Joined: Wednesday 17 February 2016 22:55
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Germany
- Contact:
Re: Motioneye [motion based with WEB GUI]
Hello, first thanks to all for sharing their knowledge. I'm playing around with Domoticz for a while know and I am really impressed. At the beginning I just want to use Domoticz to control my blinds, but I bought also some motion switches and installed a DIY alarm system. Now I would like to set up a camera into that system. I have Domoticz running on a RPi2 and I bought a RPi3 with a Raspberry cam. I tried motion and motioneyeos , booth produced a lot of fault messages. Now I'm trying to set up PiKrellCam. So far it seems to reduce the fault messages to zero. I only get messages by movement and not from light changing. The messages are send to my email account. I tried to integrate the camera into Domoticz without success. What I would like to get is a virtual switch in Domoticz turn on, if motion detected by PIKrellCam and my Domoticz alarm system is armed. With that virtual switch I could sent me an email with blockly. Receiving emails even when I'm next to the camera isn't funny.
I tried to find a solution here in this blog but wasn't able to get it running. My knowledge in programming is zero that's why I like blockly so much. I know how to find folders via ssh and use nano.
I would appreciate If someone could help me.
And thanks to all of you who create fantastic Software like Domoticz, PiKrellCam, Motion....
Meikel
I tried to find a solution here in this blog but wasn't able to get it running. My knowledge in programming is zero that's why I like blockly so much. I know how to find folders via ssh and use nano.
I would appreciate If someone could help me.
And thanks to all of you who create fantastic Software like Domoticz, PiKrellCam, Motion....
Meikel
Who is online
Users browsing this forum: No registered users and 1 guest