forked from xyyangkun/python-dvr
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.md
More file actions
703 lines (584 loc) · 19.9 KB
/
Copy pathREADME.md
File metadata and controls
703 lines (584 loc) · 19.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
# python-dvr
Python library for configuring a wide range of IP cameras that use the NETsurveillance ActiveX plugin
XMeye SDK

## DeviceManager.py
DeviceManager.py is a standalone Tkinter and console interface program such as the original DeviceManager.exe
it possible to work on both systems, if there is no Tkinter it starts with a console interface
## DVR-IP, NetSurveillance or "Sofia" Protocol
The NETSurveillance ActiveX plugin uses a TCP based protocol referred to simply as the "Digital Video Recorder Interface Protocol" by the "Hangzhou male Mai Information Co".
There is very little software support or documentation other than through tools provided by the manufacturers of these cameras, which leaves many configuration options inaccessible.
- [Command and response codes](https://gist.github.com/ekwoodrich/a6d7b8db8f82adf107c3c366e61fd36f)
- [Xiongmai DVR API v1.0, Russian](https://github.com/NeiroNx/python-dvr/blob/master/doc/%D0%A1%D0%BE%D0%B3%D0%BB%D0%B0%D1%88%D0%B5%D0%BD%D0%B8%D0%B5%20%D0%BE%20%D0%B8%D0%BD%D1%82%D0%B5%D1%80%D1%84%D0%B5%D0%B9%D1%81%D0%B5%20%D1%86%D0%B8%D1%84%D1%80%D0%BE%D0%B2%D0%BE%D0%B3%D0%BE%20%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE%D1%80%D0%B5%D0%B3%D0%B8%D1%81%D1%82%D1%80%D0%B0%D1%82%D0%BE%D1%80%D0%B0%20XiongmaiV1.0.doc?raw=true)
- [Xiongmai DVR API, 2013-01-11, Chinese](doc/雄迈数字视频录像机接口协议_V1.0.0.pdf)
- [DVR API, brief description, Chinese](doc/配置交换格式V2.0.pdf)
- [NETIP video/audio payload protocol, Chinese](doc/码流帧格式文档.pdf)
### Similar projects
- [sofiactl](https://github.com/667bdrm/sofiactl)
- [DVRIP library and tools](https://github.com/alexshpilkin/dvrip)
- [numenworld-ipcam](https://github.com/johndoe31415/numenworld-ipcam)
### Server implementations
* [OpenIPC](https://openipc.org/firmware/)
## Basic usage
```python
from dvrip import DVRIPCam
from time import sleep
host_ip = '192.168.1.10'
cam = DVRIPCam(host_ip, user='admin', password='')
if cam.login():
print("Success! Connected to " + host_ip)
else:
print("Failure. Could not connect.")
print("Camera time:", cam.get_time())
# Reboot camera
cam.reboot()
sleep(60) # wait while camera starts
# Login again
cam.login()
# Sync camera time with PC time
cam.set_time()
# Disconnect
cam.close()
```
## AsyncIO usage
```python
from asyncio_dvrip import DVRIPCam
import asyncio
import traceback
def stop(loop):
tasks = asyncio.gather(*asyncio.Task.all_tasks(loop=loop), loop=loop, return_exceptions=True)
tasks.add_done_callback(lambda t: loop.stop())
tasks.cancel()
loop = asyncio.get_event_loop()
def onAlert(event, sequence_number):
print(event, sequence_number)
async def some_test_worker():
while True:
print("do some important work...")
await asyncio.sleep(3)
async def main(loop):
host_ip = '192.168.1.10'
cam = DVRIPCam(host_ip, user='admin', password='')
try:
if not await cam.login():
raise Exception("Failure. Could not connect.")
# -------------------------------
# take snapshot
image = await cam.snapshot()
# save it
with open("snap.jpeg", "wb") as fp:
fp.write(image)
# -------------------------------
# write video
with open("datastream.h265", "wb") as f:
await cam.start_monitor(lambda frame, meta, user: f.write(frame))
# -------------------------------
# or get alarms
cam.setAlarm(onAlert)
# will create new task
await cam.alarmStart(loop)
# so just wait or something else
while True:
await asyncio.sleep(1)
# -------------------------------
except:
pass
finally:
cam.close()
try:
loop.create_task(main(loop))
loop.create_task(some_test_worker())
loop.run_forever()
except Exception as err:
msg = ''.join(traceback.format_tb(err.__traceback__) + [str(err)])
print(msg)
finally:
cam.close()
stop(loop)
```
## Camera settings
```python
params = cam.get_general_info()
```
Returns general camera information (timezones, formats, auto reboot policy,
security options):
```json
{
"AppBindFlag": {
"BeBinded": false
},
"AutoMaintain": {
"AutoDeleteFilesDays": 0,
"AutoRebootDay": "Tuesday",
"AutoRebootHour": 3
},
"DSTState": {
"InNormalState": true
},
"General": {
"AutoLogout": 0,
"FontSize": 24,
"IranCalendarEnable": 0,
"LocalNo": 0,
"MachineName": "LocalHost",
"OverWrite": "OverWrite",
"ScreenAutoShutdown": 10,
"ScreenSaveTime": 0,
"VideoOutPut": "Auto"
},
"Location": {
"DSTEnd": {
"Day": 1,
"Hour": 1,
"Minute": 1,
"Month": 10,
"Week": 0,
"Year": 2021
},
"DSTRule": "Off",
"DSTStart": {
"Day": 1,
"Hour": 1,
"Minute": 1,
"Month": 5,
"Week": 0,
"Year": 2021
},
"DateFormat": "YYMMDD",
"DateSeparator": "-",
"IranCalendar": 0,
"Language": "Russian",
"TimeFormat": "24",
"VideoFormat": "PAL",
"Week": null,
"WorkDay": 62
},
"OneKeyMaskVideo": null,
"PwdSafety": {
"PwdReset": [
{
"QuestionAnswer": "",
"QuestionIndex": 0
},
{
"QuestionAnswer": "",
"QuestionIndex": 0
},
{
"QuestionAnswer": "",
"QuestionIndex": 0
},
{
"QuestionAnswer": "",
"QuestionIndex": 0
}
],
"SecurityEmail": "",
"TipPageHide": false
},
"ResumePtzState": null,
"TimingSleep": null
}
```
```python
params = cam.get_system_info()
```
Returns hardware specific settings, camera serial number, current software
version and firmware type:
```json
{
"AlarmInChannel": 2,
"AlarmOutChannel": 1,
"AudioInChannel": 1,
"BuildTime": "2020-01-08 11:05:18",
"CombineSwitch": 0,
"DeviceModel": "HI3516EV300_85H50AI",
"DeviceRunTime": "0x0001f532",
"DigChannel": 0,
"EncryptVersion": "Unknown",
"ExtraChannel": 0,
"HardWare": "HI3516EV300_85H50AI",
"HardWareVersion": "Unknown",
"SerialNo": "a166379674a3b447",
"SoftWareVersion": "V5.00.R02.000529B2.10010.040600.0020000",
"TalkInChannel": 1,
"TalkOutChannel": 1,
"UpdataTime": "",
"UpdataType": "0x00000000",
"VideoInChannel": 1,
"VideoOutChannel": 1
}
```
```python
params = cam.get_system_capabilities()
```
Returns capabilities for the camera software (alarms and detection,
communication protocols and hardware specific features):
```json
{
"AlarmFunction": {
"AlarmConfig": true,
"BlindDetect": true,
"HumanDection": true,
"HumanPedDetection": true,
"LossDetect": true,
"MotionDetect": true,
"NetAbort": true,
"NetAlarm": true,
"NetIpConflict": true,
"NewVideoAnalyze": false,
"PEAInHumanPed": true,
"StorageFailure": true,
"StorageLowSpace": true,
"StorageNotExist": true,
"VideoAnalyze": false
},
"CommFunction": {
"CommRS232": true,
"CommRS485": true
},
"EncodeFunction": {
"DoubleStream": true,
"SmartH264": true,
"SmartH264V2": false,
"SnapStream": true
},
"NetServerFunction": {
"IPAdaptive": true,
"Net3G": false,
"Net4GSignalLevel": false,
"NetAlarmCenter": true,
"NetDAS": false,
"NetDDNS": false,
"NetDHCP": true,
"NetDNS": true,
"NetEmail": true,
"NetFTP": true,
"NetIPFilter": true,
"NetMutlicast": false,
"NetNTP": true,
"NetNat": true,
"NetPMS": true,
"NetPMSV2": true,
"NetPPPoE": false,
"NetRTSP": true,
"NetSPVMN": false,
"NetUPNP": true,
"NetWifi": false,
"OnvifPwdCheckout": true,
"RTMP": false,
"WifiModeSwitch": false,
"WifiRouteSignalLevel": true
},
"OtherFunction": {
"NOHDDRECORD": false,
"NoSupportSafetyQuestion": false,
"NotSupportAutoAndIntelligent": false,
"SupportAdminContactInfo": true,
"SupportAlarmRemoteCall": false,
"SupportAlarmVoiceTipInterval": true,
"SupportAlarmVoiceTips": true,
"SupportAlarmVoiceTipsType": true,
"SupportAppBindFlag": true,
"SupportBT": true,
"SupportBallTelescopic": false,
"SupportBoxCameraBulb": false,
"SupportCamareStyle": true,
"SupportCameraWhiteLight": false,
"SupportCfgCloudupgrade": true,
"SupportChangeLanguageNoReboot": true,
"SupportCloseVoiceTip": false,
"SupportCloudUpgrade": true,
"SupportCommDataUpload": true,
"SupportCorridorMode": false,
"SupportCustomizeLpRect": false,
"SupportDNChangeByImage": false,
"SupportDimenCode": true,
"SupportDoubleLightBoxCamera": false,
"SupportDoubleLightBulb": false,
"SupportElectronicPTZ": false,
"SupportFTPTest": true,
"SupportFaceDetectV2": false,
"SupportFaceRecognition": false,
"SupportMailTest": true,
"SupportMusicBulb433Pair": false,
"SupportMusicLightBulb": false,
"SupportNetWorkMode": false,
"SupportOSDInfo": false,
"SupportOneKeyMaskVideo": false,
"SupportPCSetDoubleLight": true,
"SupportPTZDirectionControl": false,
"SupportPTZTour": false,
"SupportPWDSafety": true,
"SupportParkingGuide": false,
"SupportPtz360Spin": false,
"SupportRPSVideo": false,
"SupportSetBrightness": false,
"SupportSetDetectTrackWatchPoint": false,
"SupportSetHardwareAbility": false,
"SupportSetPTZPresetAttribute": false,
"SupportSetVolume": true,
"SupportShowH265X": true,
"SupportSnapCfg": false,
"SupportSnapV2Stream": true,
"SupportSnapshotConfigV2": false,
"SupportSoftPhotosensitive": true,
"SupportStatusLed": false,
"SupportTextPassword": true,
"SupportTimeZone": true,
"SupportTimingSleep": false,
"SupportWebRTCModule": false,
"SupportWriteLog": true,
"SuppportChangeOnvifPort": true
},
"PreviewFunction": {
"Talk": true,
"Tour": false
},
"TipShow": {
"NoBeepTipShow": true
}
}
```
## Camera video settings/modes
```python
params = cam.get_info("Camera")
# Returns data like this:
# {'ClearFog': [{'enable': 0, 'level': 50}], 'DistortionCorrect': {'Lenstype': 0, 'Version': 0},
# 'FishLensParam': [{'CenterOffsetX': 300, 'CenterOffsetY': 300, 'ImageHeight': 720,
# 'ImageWidth': 1280, 'LensType': 0, 'PCMac': '000000000000', 'Radius': 300, 'Version': 1,
# 'ViewAngle': 0, 'ViewMode': 0, 'Zoom': 100}], 'FishViCut': [{'ImgHeight': 0, 'ImgWidth': 0,
# 'Xoffset': 0, 'Yoffset': 0}], 'Param': [{'AeSensitivity': 5, 'ApertureMode': '0x00000000',
# 'BLCMode': '0x00000000', 'DayNightColor': '0x00000000', 'Day_nfLevel': 3, 'DncThr': 30,
# 'ElecLevel': 50, 'EsShutter': '0x00000002', 'ExposureParam': {'LeastTime': '0x00000100',
# 'Level': 0, 'MostTime': '0x00010000'}, 'GainParam': {'AutoGain': 1, 'Gain': 50},
# 'IRCUTMode': 0, 'IrcutSwap': 0, 'Night_nfLevel': 3, 'PictureFlip': '0x00000000',
# 'PictureMirror': '0x00000000', 'RejectFlicker': '0x00000000', 'WhiteBalance': '0x00000000'}],
# 'ParamEx': [{'AutomaticAdjustment': 3, 'BroadTrends': {'AutoGain': 0, 'Gain': 50},
# 'CorridorMode': 0, 'ExposureTime': '0x100', 'LightRestrainLevel': 16, 'LowLuxMode': 0,
# 'PreventOverExpo': 0, 'SoftPhotosensitivecontrol': 0, 'Style': 'type1'}], 'WhiteLight':
# {'MoveTrigLight': {'Duration': 60, 'Level': 3}, 'WorkMode': 'Auto', 'WorkPeriod':
# {'EHour': 6, 'EMinute': 0, 'Enable': 1, 'SHour': 18, 'SMinute': 0}}}
# Get current encoding settings
enc_info = cam.get_info("Simplify.Encode")
# Returns data like this:
# [{'ExtraFormat': {'AudioEnable': False, 'Video': {'BitRate': 552, 'BitRateControl': 'VBR',
# 'Compression': 'H.265', 'FPS': 20, 'GOP': 2, 'Quality': 3, 'Resolution': 'D1'},
# 'VideoEnable': True}, 'MainFormat': {'AudioEnable': False, 'Video': {'BitRate': 2662,
# 'BitRateControl': 'VBR', 'Compression': 'H.265', 'FPS': 25, 'GOP': 2, 'Quality': 4,
# 'Resolution': '1080P'}, 'VideoEnable': True}}]
# Change bitrate
NewBitrate = 7000
enc_info[0]['MainFormat']['Video']['BitRate'] = NewBitrate
cam.set_info("Simplify.Encode", enc_info)
# Get videochannel color parameters
colors = cam.get_info("AVEnc.VideoColor.[0]")
# Returns data like this:
# [{'Enable': True, 'TimeSection': '0 00:00:00-24:00:00', 'VideoColorParam': {'Acutance': 3848,
# 'Brightness': 50, 'Contrast': 50, 'Gain': 0, 'Hue': 50, 'Saturation': 50, 'Whitebalance': 128}},
# {'Enable': False, 'TimeSection': '0 00:00:00-24:00:00', 'VideoColorParam': {'Acutance': 3848,
# 'Brightness': 50, 'Contrast': 50, 'Gain': 0, 'Hue': 50, 'Saturation': 50, 'Whitebalance': 128}}]
# Change IR Cut
cam.set_info("Camera.Param.[0]", { "IrcutSwap" : 0 })
# Change WDR settings
WDR_mode = True
cam.set_info("Camera.ParamEx.[0]", { "BroadTrends" : { "AutoGain" : int(WDR_mode) } })
# Get network settings
net = cam.get_info("NetWork.NetCommon")
# Turn on adaptive IP mode
cam.set_info("NetWork.IPAdaptive", { "IPAdaptive": True })
# Set camera hostname
cam.set_info("NetWork.NetCommon.HostName", "IVG-85HG50PYA-S")
# Set DHCP mode (turn on in this case)
dhcpst = cam.get_info("NetWork.NetDHCP")
dhcpst[0]['Enable'] = True
cam.set_info("NetWork.NetDHCP", dhcpst)
# Enable/disable cloud support
cloudEnabled = False
cam.set_info("NetWork.Nat", { "NatEnable" : cloudEnabled })
```
## Add user and change password
```python
#User "test2" with pssword "123123"
cam.addUser("test2","123123")
#Bad password, change it
cam.changePasswd("321321",cam.sofia_hash("123123"),"test2")
#And delete user "test2"
if cam.delUser("test2"):
print("User deleted")
else:
print("Can not delete it")
#System users can not be deleted
if cam.delUser("admin"):
print("You do it! How?")
else:
print("It system reserved user")
```
## Investigate more settings
Suggested approach will help understand connections between camera UI and API
settings. Fell free to send PR to the document to update information.
```python
from deepdiff import DeepDiff
from pprint import pprint
latest = None
while True:
current = cam.get_info("Camera") # or "General", "Simplify.Encode", "NetWork"
if latest:
diff = DeepDiff(current, latest)
if diff == {}:
print("Nothing changed")
else:
pprint(diff['values_changed'], indent = 2)
latest = current
input("Change camera setting via UI and then press Enter,"
" or double Ctrl-C to exit\n")
```
## Get JPEG snapshot
```python
with open("snap.jpg", "wb") as f:
f.write(cam.snapshot())
```
## Get video/audio bitstream
Video-only writing to file (using simple lambda):
```python
with open("datastream.h265", "wb") as f:
cam.start_monitor(lambda frame, meta, user: f.write(frame))
```
Writing datastream with additional filtering (capture first 100 frames):
```python
class State:
def __init__(self):
self.counter = 0
def count(self):
return self.counter
def inc(self):
self.counter += 1
with open("datastream.h265", "wb") as f:
state = State()
def receiver(frame, meta, state):
if 'frame' in meta:
f.write(frame)
state.inc()
print(state.count())
if state.count() == 100:
cam.stop_monitor()
cam.start_monitor(receiver, state)
```
## Set camera title
```python
# Simple way to change picture title
cam.channel_title(["Backyard"])
# Use unicode font from host computer to compose bitmap for title
from PIL import Image, ImageDraw, ImageFont
w_disp = 128
h_disp = 64
fontsize = 32
text = "Туалет"
imageRGB = Image.new('RGB', (w_disp, h_disp))
draw = ImageDraw.Draw(imageRGB)
font = ImageFont.truetype("/Library/Fonts/Arial Unicode.ttf", fontsize)
w, h = draw.textsize(text, font=font)
draw.text(((w_disp - w)/2, (h_disp - h)/2), text, font=font)
image1bit = imageRGB.convert("1")
data = image1bit.tobytes()
cam.channel_bitmap(w_disp, h_disp, data)
# Use your own logo on picture
img = Image.open('vixand.png')
width, height = img.size
data = img.convert("1").tobytes()
cam.channel_bitmap(width, height, data)
```

```sh
# Show current temperature, velocity, GPS coordinates, etc
# Use the same method to draw text to bitmap and transmit it to camera
# but consider place internal bitmap storage to RAM:
mount -t tmpfs -o size=100k tmpfs /mnt/mtd/tmpfs
ln -sf /mnt/mtd/tmpfs/0.dot /mnt/mtd/Config/Dot/0.dot
```
## OSD special text displaying
```python
cam.set_info("fVideo.OSDInfo", {"Align": 2, "OSDInfo": [
{
"Info": [
"АБВГДЕЁЖЗИКЛМНОПРСТУФХЦЧШЩЭЮЯ",
"абвгдеёжзиклмеопрстуфхцчшщэюя",
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"abcdefghijklmnopqrstuvwxyz",
"«»©°\"'()[]{}$%^&*_+=0123456789"
],
"OSDInfoWidget": {
"BackColor": "0x00000000",
"EncodeBlend": True,
"FrontColor": "0xD000FF00",
"PreviewBlend": True,
"RelativePos": [20, 50, 0, 0]
}
}
], "strEnc": "UTF-8"})
```

## Upgrade camera firmware
```python
# Optional: get information about upgrade parameters
print(cam.get_upgrade_info())
# Do upgrade
cam.upgrade("General_HZXM_IPC_HI3516CV300_50H20L_AE_S38_V4.03.R12.Nat.OnvifS.HIK.20181126_ALL.bin")
```
## Monitor Script
This script will persistently attempt to connect to camera at `CAMERA_IP`, will create a directory named `CAMERA_NAME` in `FILE_PATH` and start writing separate video and audio streams in files chunked in 10-minute clips, arranged in folders structured as `%Y/%m/%d`. It will also log what it does.
```sh
./monitor.py <CAMERA_IP> <CAMERA_NAME> <FILE_PATH>
```
## OPFeederFunctions
These functions are to handle the pet food dispenser when available.
You can see it with :
```python
>>> cam.get_system_capabilities()['OtherFunction']['SupportFeederFunction']
True
```
<details>
<summary>OPFeedManual</summary>
```python
>>> cam.set_command("OPFeedManual", {"Servings": 1})
{'Name': 'OPFeedManual', 'OPFeedManual': {'Feeded': 1, 'NotFeeding': 0}, 'Ret': 100, 'SessionID': '0x38'}
```
Servings is the number of portions
</details>
<details>
<summary>OPFeedBook</summary>
```python
>>> cam.get_command("OPFeedBook")
{'FeedBook': [{'Enable': 1, 'RecDate': '2018-04-01', 'RecTime': '12:19:18', 'Servings': 1, 'Time': '03:00:00'}, {'Enable': 1, 'RecDate': '2018-04-01', 'RecTime': '12:19:18', 'Servings': 1, 'Time': '09:00:00'}, {'Enable': 1, 'RecDate': '2018-04-01', 'RecTime': '12:19:18', 'Servings': 1, 'Time': '06:00:00'}, {'Enable': 1, 'RecDate': '2018-04-01', 'RecTime': '12:19:18', 'Servings': 1, 'Time': '15:00:00'}, {'Enable': 1, 'RecDate': '2018-04-01', 'RecTime': '12:19:18', 'Servings': 1, 'Time': '12:00:00'}, {'Enable': 1, 'RecDate': '2018-04-01', 'RecTime': '12:19:18', 'Servings': 1, 'Time': '21:00:00'}, {'Enable': 1, 'RecDate': '2018-04-01', 'RecTime': '12:19:18', 'Servings': 1, 'Time': '18:00:00'}, {'Enable': 1, 'RecDate': '2018-04-01', 'RecTime': '12:19:18', 'Servings': 1, 'Time': '00:00:00'}, {'Enable': 1, 'RecDate': '2018-04-01', 'RecTime': '12:19:18', 'Servings': 5, 'Time': '01:00:00'}]}
```
```python
>>> cam.set_command("OPFeedBook", {"Action": "Delete", "FeedBook": [{'Enable': 1, 'RecDate': '2018-04-01', 'RecTime': '12:19:18', 'Servings': 5, 'Time': '01:00:00'}]})
{'Name': 'OPFeedBook', 'Ret': 100, 'SessionID': '0x00000018'}
```
```python
>>> cam.set_command("OPFeedBook", {"Action": "Add", "FeedBook": [{'Enable': 1, 'RecDate': '2018-04-01', 'RecTime': '12:19:18', 'Servings': 5, 'Time': '01:00:00'}]})
{'Name': 'OPFeedBook', 'Ret': 100, 'SessionID': '0x00000018'}
```
</details>
<details>
<summary>OPFeedHistory</summary>
```python
>>> cam.get_command("OPFeedHistory")
{'FeedHistory': [{'Date': '2022-08-29', 'Servings': 1, 'Time': '18:49:45', 'Type': 2}, {'Date': '2022-08-26', 'Servings': 3, 'Time': '07:30:12', 'Type': 1}]}
```
Type 1 : automatic
Type 2 : manual
```python
>>> cam.set_command("OPFeedHistory", {"Action": "Delete", "FeedHistory": [{'Date': '2022-08-29', 'Servings': 1, 'Time': '19:40:01', 'Type': 2}]})
{'Name': 'OPFeedHistory', 'Ret': 100, 'SessionID': '0x00000027'}
```
</details>
## Troubleshooting
```python
cam.debug()
# or to enable non-standard format
cam.debug('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
```
## Acknowledgements
_Telnet access creds from gabonator_
https://gist.github.com/gabonator/74cdd6ab4f733ff047356198c781f27d