Release - Surveillance Room - Your IP Camera Companion with extra Foscam HD Support

  Thread Rating:
  • 2 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
maikito26 Offline
Senior Member
Posts: 101
Joined: Jun 2014
Reputation: 3
Post: #31
My mistake. There does appear to be a newer firmware version. I'm not sure if it will make a difference. The version you have seems to be from Dec 2014 and I didn't realize which 19821 version you had. It has it's own branch of the firmware. In any case the additional logging will be helpful to understand.

The new firmware is suitable for FI9821P V2 as well as FI9821W V2 - June 11 2015
System firmware version: 1.5.2.13
App firmware version: 2.21.2.5
Plug-in version: 3.3.0.5

Reference: http://foscam.us/firmware
find quote
jer78 Offline
Junior Member
Posts: 46
Joined: Dec 2013
Reputation: 1
Post: #32
Here it is with the updated py file...let me know if there's anything I missed

17:01:12 T:140735248130816 DEBUG: Keyboard: scancode: 0x24, sym: 0x000d, unicode: 0x000d, modifier: 0x0
17:01:12 T:140735248130816 DEBUG: OnKey: return (0xf00d) pressed, action is Select
17:01:12 T:4663939072 NOTICE: Thread LanguageInvoker start, auto delete: false
17:01:12 T:4663939072 INFO: initializing python engine.
17:01:12 T:4663939072 DEBUG: CPythonInvoker(21, /Users/mediacenter/Library/Application Support/Kodi/addons/plugin.video.surveillanceroom/service.py): start processing
17:01:12 T:140735248130816 DEBUG: CGUIMediaWindow::GetDirectory (addons://user/xbmc.addon.video)
17:01:12 T:140735248130816 DEBUG: ParentPath = [addons://user/xbmc.addon.video]
17:01:12 T:4663939072 NOTICE: -->Python Interpreter Initialized<--
17:01:12 T:4663939072 DEBUG: CPythonInvoker(21, /Users/mediacenter/Library/Application Support/Kodi/addons/plugin.video.surveillanceroom/service.py): the source file to load is "/Users/mediacenter/Library/Application Support/Kodi/addons/plugin.video.surveillanceroom/service.py"
17:01:12 T:4663939072 DEBUG: CPythonInvoker(21, /Users/mediacenter/Library/Application Support/Kodi/addons/plugin.video.surveillanceroom/service.py): setting the Python path to /Users/mediacenter/Library/Application Support/Kodi/addons/plugin.video.surveillanceroom:/Users/mediacenter/Library/Application Support/Kodi/addons/script.module.requests/lib:/Applications/Kodi.app/Contents/Libraries:/Applications/Kodi.app/Contents/Libraries/lib/python26.zip:/Applications/Kodi.app/Contents/Libraries/lib/python2.6:/Applications/Kodi.app/Contents/Libraries/lib/python2.6/plat-darwin:/Applications/Kodi.app/Contents/Libraries/lib/python2.6/plat-mac:/Applications/Kodi.app/Contents/Libraries/lib/python2.6/plat-mac/lib-scriptpackages:/Applications/Kodi.app/Contents/Libraries/lib/python2.6/lib-tk:/Applications/Kodi.app/Contents/Libraries/lib/python2.6/lib-old:/Applications/Kodi.app/Contents/Libraries/lib/python2.6/lib-dynload:/Applications/Kodi.app/Contents/Libraries/lib/python2.6/site-packages:/Applications/Kodi.app/Contents/Libraries/lib/python2.6/site-packages/PIL
17:01:12 T:4663939072 DEBUG: CPythonInvoker(21, /Users/mediacenter/Library/Application Support/Kodi/addons/plugin.video.surveillanceroom/service.py): entering source directory /Users/mediacenter/Library/Application Support/Kodi/addons/plugin.video.surveillanceroom
17:01:12 T:4663939072 DEBUG: CPythonInvoker(21, /Users/mediacenter/Library/Application Support/Kodi/addons/plugin.video.surveillanceroom/service.py): instantiating addon using automatically obtained id of "plugin.video.surveillanceroom" dependent on version 2.19.0 of the xbmc.python api
17:01:12 T:4674764800 NOTICE: Thread BackgroundLoader start, auto delete: false
17:01:12 T:4674764800 DEBUG: Thread BackgroundLoader 4674764800 terminating
17:01:13 T:4663939072 NOTICE: plugin.video.surveillanceroom v1.0.7: NORMAL : SERVICE :: **START** Instance 0 - Starting a new service instance.
17:01:13 T:4663939072 NOTICE: plugin.video.surveillanceroom v1.0.7: NORMAL : SERVICE :: Log Level: 3
17:01:13 T:4663939072 NOTICE: plugin.video.surveillanceroom v1.0.7: VERBOSE : SERVICE :: Camera 1; Enabled: True
17:01:13 T:4663939072 NOTICE: plugin.video.surveillanceroom v1.0.7: DEBUG : SETTINGS :: Use Cache: False; Camera 1; Camera Type: 0; Monitor: <resources.lib.monitor.AddonMonitor object at 0x6000040a3fe0>
17:01:13 T:4663939072 NOTICE: plugin.video.surveillanceroom v1.0.7: VERBOSE : SETTINGS :: Camera 1 - Testing connection...
17:01:13 T:4663939072 NOTICE: plugin.video.surveillanceroom v1.0.7: DEBUG : Send Foscam command: http://192.168.1.104:88/cgi-bin/CGIProxy...etDevState
17:01:13 T:4663939072 NOTICE: http://192.168.1.104:88/cgi-bin/CGIProxy...etDevState
17:01:13 T:4663939072 NOTICE: NEW DEBUG: raw_string: <CGI_Result>
<result>0</result>
<IOAlarm>0</IOAlarm>
<motionDetectAlarm>1</motionDetectAlarm>
<soundAlarm>0</soundAlarm>
<record>0</record>
<sdState>0</sdState>
<sdFreeSpace>0k</sdFreeSpace>
<sdTotalSpace>0k</sdTotalSpace>
<ntpState>1</ntpState>
<ddnsState>0</ddnsState>
<url>http%3A%2F%2Fhd2493.myfoscam.org%3A88</url>
<upnpState>1</upnpState>
<isWifiConnected>1</isWifiConnected>
<wifiConnectedAP>FrogsJumpHigh</wifiConnectedAP>
<infraLedState>0</infraLedState>
</CGI_Result>
17:01:13 T:4663939072 NOTICE: NEW DEBUG: root: <Element CGI_Result at 608005083f40>
17:01:13 T:4663939072 NOTICE: NEW DEBUG: code: -7
17:01:13 T:4663939072 NOTICE: NEW DEBUG: params: {}
17:01:13 T:4663939072 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.AttributeError'>
Error Contents: _ElementInterface instance has no attribute 'iter'
Traceback (most recent call last):
File "/Users/mediacenter/Library/Application Support/Kodi/addons/plugin.video.surveillanceroom/service.py", line 370, in <module>
start()
File "/Users/mediacenter/Library/Application Support/Kodi/addons/plugin.video.surveillanceroom/service.py", line 363, in start
instance.run(new_instance)
File "/Users/mediacenter/Library/Application Support/Kodi/addons/plugin.video.surveillanceroom/service.py", line 297, in run
camera_settings = settings.getBasicSettings(camera_number, monitor, useCache=False)
File "/Users/mediacenter/Library/Application Support/Kodi/addons/plugin.video.surveillanceroom/resources/lib/settings.py", line 316, in getBasicSettings
success_code, response = camera.get_dev_state()
File "/Users/mediacenter/Library/Application Support/Kodi/addons/plugin.video.surveillanceroom/resources/lib/foscam2.py", line 399, in get_dev_state
return self.execute_command('getDevState', callback=callback)
File "/Users/mediacenter/Library/Application Support/Kodi/addons/plugin.video.surveillanceroom/resources/lib/foscam2.py", line 140, in execute_command
return execute_with_callbacks(cmd, params, callback)
File "/Users/mediacenter/Library/Application Support/Kodi/addons/plugin.video.surveillanceroom/resources/lib/foscam2.py", line 129, in execute_with_callbacks
code, params = self.send_command(cmd, params)
File "/Users/mediacenter/Library/Application Support/Kodi/addons/plugin.video.surveillanceroom/resources/lib/foscam2.py", line 113, in send_command
for child in root.iter():
AttributeError: _ElementInterface instance has no attribute 'iter'
-->End of Python script error report<--
find quote
maikito26 Offline
Senior Member
Posts: 101
Joined: Jun 2014
Reputation: 3
Post: #33
Researching more this seems to be an issue with python version. Could you confirm what platform and kodi version you're running. I'm going to try and reproduce it so I can code it for wider device support
find quote
jer78 Offline
Junior Member
Posts: 46
Joined: Dec 2013
Reputation: 1
Post: #34
I'm using a Mac Mini running OS X 10.10.5 and Kodi 15.2, Python 2.7.10
find quote
maikito26 Offline
Senior Member
Posts: 101
Joined: Jun 2014
Reputation: 3
Post: #35
@jer78 - I think I have a confirmed fix. I think the python version used in the Kodi compiled version is 2.6. We can verify by running sys.version and checking the output. This would mean that I would need to implement logic to use getiterator() instead of iter() for python 2.6, with the latter being more efficient. In python 2.7 iter() was introduced and getiterator() was deprecated.

TL;DR - I need to get off my phone and get in front of a computer.
find quote
maikito26 Offline
Senior Member
Posts: 101
Joined: Jun 2014
Reputation: 3
Post: #36
@jer78 - Can you replace the following two files for the add-on from the same location, restart Kodi, and let me know if this works for you? I was able to verify that the getiterator() command works in python2.7 for my build which is reporting 2.7.8. If you could confirm I'll merge these changes to the main branch and all future versions will be compatible. Thanks!

foscam2.py
utils.py
find quote
davyike Offline
Junior Member
Posts: 4
Joined: Oct 2015
Reputation: 0
Post: #37
Hey maikito, just got your PM but it doesn't let me reply for some reason. Sorry for the slow reply, got hit by some work stuff. Gave the preview show/hide a go now and works great, thank you very much! Stellar work.
find quote
jer78 Offline
Junior Member
Posts: 46
Joined: Dec 2013
Reputation: 1
Post: #38
You did it! It works great now!!! Thanks so much makito26, and especially for the quick turnaround time.

One thing I notice is that if the preview is set to MJPEG it displays a black preview screen, but the snapshot setting seems to work. Don't know if that's an expected behaviour or not. Thanks again!
find quote
maikito26 Offline
Senior Member
Posts: 101
Joined: Jun 2014
Reputation: 3
Post: #39
Good to know jer78! I'll make sure to commit this change.

The black preview screen from MJPEG is a result of the MJPEG stream not converting to JPEGs. If you have time, we can check the logs for errors and fix this as well. It might be similar that I have something that was introduced in python2.7. The benefit of fixing this is higher Frame Rate previews Smile

QQ - does the All camera player work with MJPEG selected? The code between the two are separated completely though should be identical.
find quote
jer78 Offline
Junior Member
Posts: 46
Joined: Dec 2013
Reputation: 1
Post: #40
I'll be happy to do some testing tonight. I'm guessing I need another camera in order to test the All Camera player? I do have an older SD Foscam type camera I can try to get working as well
find quote
maikito26 Offline
Senior Member
Posts: 101
Joined: Jun 2014
Reputation: 3
Post: #41
The All Camera Player will work with just a single camera. If you wanted to add the SD Foscam then you'll need to throw in the URLs as a Generic Camera until I finish coding for it. Likely by the end of the weekend. This weekend I'll have a couple good solid hours to sit and power through it.
find quote
jer78 Offline
Junior Member
Posts: 46
Joined: Dec 2013
Reputation: 1
Post: #42
Sent you the logs via PM
find quote
maikito26 Offline
Senior Member
Posts: 101
Joined: Jun 2014
Reputation: 3
Post: #43
Thanks. The logs seem to indicate one of the following likely possibilities.

1. MJPEG stream syntax is different than all cameras I've tested with (apparently there is no strict standard) and this might be possible due to the different firmware branch. This might be worth upgrading firmware for too but we'll see.
2. There is an issue saving the data to a JPEG file
--> Can we observe any images being saved to the kodi/userdata/addon_data/plugin.video.surveillanceroom/ folder while the preview or all camera player is running?
3. Something else entirely and we'll surely find out.

I re-enabled debug logging in the following file to inspect the MJPEG stream. Originally had it commented out to improve overall performance for highest FPS. Could you replace this file, restart Kodi and PM me another set of logs. Only need one set from either the preview or all camera player.

utils.py

Thanks!
find quote
jer78 Offline
Junior Member
Posts: 46
Joined: Dec 2013
Reputation: 1
Post: #44
PM'd you the new log
find quote
maikito26 Offline
Senior Member
Posts: 101
Joined: Jun 2014
Reputation: 3
Post: #45
This is interesting. The stream URL is giving a plain text response type and even says 'No Mjpeg Stream'. Does the MJPEG type for the Single Camera player function? I ask because the add-on is supposed to send a command to the Camera to enable Mjpeg on the substream if it's required. Could you also verify if the camera has Mjpeg enabled from the Web gui?

Earlier in the log file there should be a command when it tests the camera connection it enables the Mjpeg stream. If you can find that section and send that in PM it'll tell me if the response from th Camera was 0 which is expected or not too.
find quote
Post Reply