Page 1 of 2

LTS camera (american company rebranded Hikvision) problems

PostPosted: Sat Dec 17, 2016 11:56 am
by blysik
First, super excited about your plugin! I have a front door LTS camera, which generally acts like a Hikvision for everything, that I have Intrusion Alerts setup. When I set that camera up, I get this error:

Code: Select all
Dec 17, 2016, 9:55:22 AM
   Disabling plugin "Hikvision 0.1.0"
   Stopping plugin "Hikvision 0.1.0" (pid 51953)
   Hikvision Debug                 Stopping concurrent thread
   Hikvision Debug                 Stopping concurrent thread
   Stopped plugin "Hikvision 0.1.0"
   Enabling plugin "Hikvision 0.1.0"
   Starting plugin "Hikvision 0.1.0" (pid 52449)
   Started plugin "Hikvision 0.1.0"
   Hikvision                       Your plugin version, v0.1.0, is current.
   Hikvision                       [Sat Dec 17 09:55:29 2016] Processed plugin preferences.
   Hikvision                       SSDP Listener Started...
   Hikvision Debug                 Starting device: Frontdoor Intrusion Alerts
   Hikvision Error                 exception in deviceStartComm(Frontdoor Intrusion Alerts): unsupported operand type(s) for +: 'NoneType' and 'str'
   Hikvision Debug                 Starting concurrent thread
   Hikvision                       Hikvision Reactor Ignition...


Later on I see it like this:

Code: Select all
Dec 17, 2016, 9:49:58 AM
   Hikvision Debug                 Stopping device: Frontdoor Intrusion Alerts
   Hikvision Debug                 Starting device: Frontdoor Intrusion Alerts
   Hikvision Error                 Error in plugin execution ServerReplacedElem:

Traceback (most recent call last):
  File "/Library/Application Support/Perceptive Automation/Indigo 7/IndigoPluginHost.app/Contents/PlugIns/plugin_base.py", line 1175, in deviceUpdated
  File "plugin.py", line 41, in deviceStartComm
  File "/Library/Application Support/Perceptive Automation/Indigo 7/Plugins/Hikvision.indigoPlugin/Contents/Server Plugin/Hikvision.py", line 101, in deviceStartComm
  File "/Library/Application Support/Perceptive Automation/Indigo 7/Plugins/Hikvision.indigoPlugin/Contents/Server Plugin/Hikvision.py", line 188, in initCamera
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'


Any ideas? Thanks!

Re: LTS camera (american company rebranded Hikvision) proble

PostPosted: Sat Dec 17, 2016 12:04 pm
by nlagaros
Did you configure the camera settings (ip address, port, username, password) in the device configuration dialog?

Re: LTS camera (american company rebranded Hikvision) proble

PostPosted: Sat Dec 17, 2016 12:07 pm
by blysik
Yes. I've set IP, port, user, and pass. I'm trying to figure out how to add some debugging so I can see what "content" contains. It's an xml object, I guess? I'm wondering if my firmware has all the details you're looking for.

Re: LTS camera (american company rebranded Hikvision) proble

PostPosted: Sat Dec 17, 2016 12:15 pm
by nlagaros
I see it now. Your camera is not reporting firmware version. Let me make a couple of adjustments. Stand by...

blysik wrote:
Yes. I've set IP, port, user, and pass. I'm trying to figure out how to add some debugging so I can see what "content" contains. It's an xml object, I guess? I'm wondering if my firmware has all the details you're looking for.

Re: LTS camera (american company rebranded Hikvision) proble

PostPosted: Sat Dec 17, 2016 12:17 pm
by blysik
Here's the content.response:

Code: Select all
   Hikvision Error                 <?xml version="1.0" encoding="UTF-8"?>
<DeviceInfo version="2.0" xmlns="http://www.std-cgi.com/ver20/XMLSchema">
<deviceName>Front door camera</deviceName>
<deviceID>23f8add8-6000-11b3-819a-bcad28192876</deviceID>
<deviceDescription>IPCamera</deviceDescription>
<deviceLocation>STD-CGI</deviceLocation>
<systemContact>STD-CGI</systemContact>
<model>CMIP8242W</model>
<serialNumber>CMIP8242W20160410BBWR588901848</serialNumber>
<macAddress>bc:ad:28:19:28:76</macAddress>
<firmwareVersion>V5.4.0</firmwareVersion>
<firmwareReleasedDate>build 160826</firmwareReleasedDate>
<encoderVersion>V7.3</encoderVersion>
<encoderReleasedDate>build 160616</encoderReleasedDate>
<bootVersion>V1.3.4</bootVersion>
<bootReleasedDate>100316</bootReleasedDate>
<hardwareVersion>0x0</hardwareVersion>
<deviceType>IPCamera</deviceType>
<telecontrolID>88</telecontrolID>
<supportBeep>false</supportBeep>
<supportVideoLoss>false</supportVideoLoss>
</DeviceInfo>


So it seems like it doesn't have some of the keys you're expecting to see?

Re: LTS camera (american company rebranded Hikvision) proble

PostPosted: Sat Dec 17, 2016 12:19 pm
by blysik
I feel like this could be a camera config problem on my end. I'm a novice with this camera stuff.

Re: LTS camera (american company rebranded Hikvision) proble

PostPosted: Sat Dec 17, 2016 12:25 pm
by nlagaros
It is a namespace issue - I'm specifically looking for Hikvision. I think I can figure this out using your debug output.

Re: LTS camera (american company rebranded Hikvision) proble

PostPosted: Sat Dec 17, 2016 12:26 pm
by blysik
Awesome. Thanks!

Re: LTS camera (american company rebranded Hikvision) proble

PostPosted: Sat Dec 17, 2016 1:40 pm
by nlagaros

Re: LTS camera (american company rebranded Hikvision) proble

PostPosted: Sat Dec 17, 2016 1:50 pm
by blysik
That zip file contains version 0.1.0 I think.

Re: LTS camera (american company rebranded Hikvision) proble

PostPosted: Sat Dec 17, 2016 2:02 pm
by nlagaros
I forgot to advance the version number. You can download again now.

blysik wrote:
That zip file contains version 0.1.0 I think.

Re: LTS camera (american company rebranded Hikvision) proble

PostPosted: Sat Dec 17, 2016 2:08 pm
by blysik
Looks like it works! (Ignore the smtp error, my setup is probably wrong.)

Code: Select all
Dec 17, 2016, 12:06:34 PM
   Trigger                         Frontdoor Camera Intruder
   Hikvision                       [Sat Dec 17 12:06:39 2016] Frontdoor Intrusion Alerts: IntrusionDetection OPEN
   DSC Alarm                       Alarm Zone 'Front Door' Closed.
   Hikvision Error                 [Sat Dec 17 12:06:41 2016] Cannot email alert, <class 'smtplib.SMTPException'>: Frontdoor Intrusion Alerts
   DSC Alarm                       Alarm Zone 'Front Door' Opened.
   DSC Alarm                       Alarm Zone 'Front Door' Closed.
   Hikvision                       [Sat Dec 17 12:06:54 2016] Frontdoor Intrusion Alerts: IntrusionDetection CLOSED


This is WAY better than what I was doing, ie, using the Better Email plugin to watch for an email from my camera to trigger stuff.

Re: LTS camera (american company rebranded Hikvision) proble

PostPosted: Sat Dec 17, 2016 2:14 pm
by blysik
And just to give you an idea of what I'm doing. I setup a trigger which watches for the device to change the 'Intrusion Detection' state to 'OPEN', and then it grabs a picture from the camera via the snapshot URL, and sends it via iMessage to me.

Looks like it works well! Thanks for the plugin!

Re: LTS camera (american company rebranded Hikvision) proble

PostPosted: Sat Dec 17, 2016 2:25 pm
by nlagaros
Glad you are getting use from it. How are you doing the iMessage part of this?

blysik wrote:
And just to give you an idea of what I'm doing. I setup a trigger which watches for the device to change the 'Intrusion Detection' state to 'OPEN', and then it grabs a picture from the camera via the snapshot URL, and sends it via iMessage to me.

Looks like it works well! Thanks for the plugin!

Re: LTS camera (american company rebranded Hikvision) proble

PostPosted: Sat Dec 17, 2016 2:35 pm
by blysik
It's a shell script that runs AppleScript:

Code: Select all
#!/bin/bash
curl -s http://user:pass@192.168.55.218/Streaming/channels/1/picture > /tmp/8.jpg

osascript <<EOD
tell application "Messages"
set targetBuddy to "+PHONENUMBERHERE"
set targetService to id of 1st service whose service type = iMessage
set myFile to "/tmp/8.jpg"
set DestFile to (POSIX file myFile) as string
send file DestFile to buddy targetBuddy of service id targetService
end tell
EOD


The mac this runs on is logged into an Apple iMessages account already and has iMessages open.