Camara Foscam FI9821W not working

I cannot get my foscam FI9821W working.

I used the following configs:

camera 3:
  platform: foscam 
  ip: <ip>
  username: <usr>
  password: <pw>
  name: homecamera
  
camera 4:
  platform: mjpeg
  mjpeg_url: http://<ip>:88/cgi-bin/CGIStream.cgi?&usr=<usr>&pwd=<pw>
  name: homecamera

Can you please format the config in your post - see the blue box at the very top.
Currently it’s hard to judge if the spacing is correct.

My config looks like this:

- platform: foscam
  ip: 192.168.x.xx
  username: !secret cam_user1
  password: !secret cam_pass1
  name: OutdoorCam
- platform: foscam
  ip: 192.168.y.yy
  username: !secret cam_user2
  password: !secret cam_pass2
  name: YardCam

It worked fine until V0.50; there was an issue with 0.51 but it’s been fixed with 0.52.1 I understand.
I’m still on 0.52 but I’ve used this change to get it work:

Hi,

I changed my config as below but still no succes :frowning:

camera:
  - platform: foscam 
    ip: 192.168.178.21
    username: usr
    password: pw
    name: homecamera

I am using the camera in a view:

cam:
  view: yes
  name: Cam
  icon: mdi:camcorder 
  entities:
    - sun.sun
    - sensor.weather_temperature
    - sensor.weather_humidity
    - camera.homecamera

The view is showing nothing of the camera not even a error or something else.

HA Current version 0.52.1

I found an error in the logging:

2017-09-03 22:35:54 INFO (MainThread) [homeassistant.components.camera] Setting up camera.foscam
2017-09-03 22:35:54 ERROR (MainThread) [homeassistant.components.camera] Error while setting up platform foscam
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 164, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT, loop=self.hass.loop)
  File "/usr/lib/python3.6/asyncio/tasks.py", line 352, in wait_for
    return fut.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 244, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/camera/foscam.py", line 39, in setup_platform
    add_devices([FoscamCam(config)])
  File "/usr/lib/python3.6/site-packages/homeassistant/components/camera/foscam.py", line 56, in __init__
    from foscam.foscam import FoscamCamera
  File "/usr/lib/python3.6/site-packages/foscam/__init__.py", line 1, in <module>
    from foscam import FoscamCamera
ImportError: cannot import name 'FoscamCamera'

No idea how to fix this.

Config looks fine to me.
Did you try to change

from foscam import FoscamCamera
to
from foscam.foscam import FoscamCamera

in the init.py file?

Hi

Iam running hass.io and have no Idea how to change the init.py.
I can’t access the /usr/lib/ folder etc… through ssh or samba.

Thanx for your help I hope you can help me futher.

Understood - that’s one of the reasons I’ve not tried hass.io so far.
I have a few components that need(ed) tinkering with the py-files directly and not having access to them would have made them stop working.

Is there a way for you to downgrade your hass.io installation to e.g. V0.49 run it once or twice and then upgrade it to 0.52.1 again?

I’ve had some stubborn components in the past that needed the extra nudge to install the latest version when I upgraded the homeassistant itself, e.g. the USPS one.

Ok i tink iam going to run home assistant on Ubuntu mate in a virtual env.

Than I can access all the python files i think and than I can make the change to the unit.py

This wil take me some time because i have to reinstall everything :frowning:

I’ve got it working with a complete new installation of home assistant

Raspbarry Pi 3b
Ubuntu 16.04
HA 0.53.0 in a phyton virtual environment

I changed the init.py by hand

from foscam import FoscamCamera
to
from foscam.foscam import FoscamCamera

Thanx for all the support

Glad to hear you got it working :+1:

Can anyone help how to access init.py file? I have searched through the entire PI after logging as root user but folder /srv, it is showing empty and full search did not find any file with name init.py. I am using two Foscam R2 cameras. I upgraded it to Hassio 0.53 but issue still persists, any help appreciated.

There is a fix for Foscam in 0.53.1 - not sure, though, if it addresses exactly this issue.

If you read the post by @jpostema just before yours - and a little bit of the history just before it - you can see that he could only get it working by installing HA manually, so that he could gain access to the init.py file.

Thanks for prompt reply. Yes I noticed the manual install as an option but not comfortable in building it manually. They are releasing version after version and somehow not fixing it. It is a known issue after version 0.49. I was trying for find an option to access these hidden files. Thanks again.

I though about switching my install to hass.io but decided not to do it - I’m a complete noob as well, but if you feel comfortable enough searching for access to hidden files, you should be fine installing HA in a virtual environment.
That’s what I did by following the step-by-step guide.
And if gives me the possibility to tinker with files when I run into issues like this one.

I’m not much beyond accessing my installation via WinSCP to edit them from there.

That’s what I do for my configuration and the odd adjusting of py-files.

I cannot get this cam working too. Another Foscam works perfect with the mpeg platform.
I installed the Hassbian image version 0.53.1
The camera has the message “no image available”

I can cannot find any of the folders from jpostema’s , searched for “Foscam” and “site-packages”. so no init.py

Do I have to install an additional module or something like that ?

I have installed HomeAssistant in virtual environment, so on my Pi3 the Foscam files are in this folder:

/srv/homeassistant/lib/python3.4/site-packages/foscam

not sure where the would sit in a Hassbian install, though.

Just to share with all of you, mine started working with upgrade to 0.53.1 and I am not using any virtualization on PI3. I noticed fix for Foscam in Sep 12 release notes and applied upgrade. No PTZ controls available. Does anyone has a solution to record on a NAS, I am using WD 3TB NAS?

Finally I found init.py, it has only this line of code :
from libpyfoscam.foscam import FoscamCamera

Should I change something here ?

You only have to change the line:

from foscam import FoscamCamera
to
from foscam.foscam import FoscamCamera

double check : so I should remove the word libpy ?