Amcrest Camera Sensor - What would be nice to have in your opinion?

@tkvtec this problem is because the amcrest-1.0.0 was installed and under deps/amcrest.

If you upgrade to the version 0.37 it should address the issue.

Please let us know.
mmello

@tchellomello, well it looks like I’m having a hard time running the upgrade to 0.37. I get successfully installed, but HA version still shows 0.36.1 and still getting the amcrest.py errors.

17-01-30 19:36:56 homeassistant.components.sensor: Error while setting up platform amcrest
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/sensor/amcrest.py", line 78, in setup_platform
    add_devices(sensors, True)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 300, in add_entities
    entity.update()
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/sensor/amcrest.py", line 124, in update
    version, build_date = self._data.camera.software_information
  File "/home/hass/.homeassistant/deps/amcrest/system.py", line 67, in software_information
    version, build_date = ret.content.decode('utf-8').split()
ValueError: need more than 1 value to unpack

Hello @tkvtec, let try to execute the commands below:

pip3 install homeasisistant --upgrade 
hass --version
pip3 uninstall amcrest
rm -rf /home/hass/.homeassistant/deps/amcrest*

Then try to restart your HA instance. It should take care of it.

@tchellomello I’m up to 0.37.0 now. After downgrading to 0.35.3 I was able to get up to 0.37.0
I have uninstalled amcrest and removed the amcrest entries under …/deps/
I rebooted my pi and it has recreated the amcrest.py under sensors, and the amcrest entries under …/deps/
I am, however, getting this in the event log:

17-01-31 14:08:31 ERROR (MainThread) [homeassistant.components.camera] Error while setting up platform amcrest
Traceback (most recent call last):
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py", line 151, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.4/asyncio/tasks.py", line 286, in _wakeup
    value = future.result()
  File "/usr/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/lib/python3.4/concurrent/futures/thread.py", line 54, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/homeassistant/components/camera/amcrest.py", line 67, in setup_platform
    config.get(CONF_USERNAME), config.get(CONF_PASSWORD)).camera
  File "/home/hass/.homeassistant/deps/amcrest/amcrest.py", line 32, in __init__
    timeout_protocol=timeout_protocol
  File "/home/hass/.homeassistant/deps/amcrest/http.py", line 55, in __init__
    self.version = get_distribution('amcrest').version
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 552, in get_distribution
    dist = get_provider(dist)
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 426, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 968, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/srv/hass/hass_venv/lib/python3.4/site-packages/pkg_resources/__init__.py", line 854, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'amcrest' distribution was not found and is required by the application

After running pip3 install amcrest, most of those errors go away and I’m back to where I started with trying to add the motion_detector sensor for my IP3M-954E

@tkvtec yes, that is a known issue now that was fixed yesterday as reported at https://github.com/home-assistant/home-assistant/issues/5627

It should be fixed by 0.37.1 that might be released tonight.

@tchellomello
Great, thanks for the update!
I just had a look at the changes to be made, and thought those changes would be what is needed. I’m starting to understand this stuff! I get computers and “some” programming, but python is a completely new to me. Theoretically I can manually make those changes, right? (just trying to get a further understanding for testing purposes, and maybe become a better “tester”)

Just wanted to say that you are awesome and I am jealous of your awesome developer/python skills. Thanks for the work and effort you put into this!

@tkvtec it would be awesome to have you as a tester for the next features we create on Amcrest. Maybe we can create a new request for what would be nice to have we can start working on this as a team.

In theory you could do the changes manually, but the 0.37.1 just got released today, so just updating would do the trick.

The steps below should clean any manual change and use the version shipped into 0.37.1

rm -f /home/hass/.homeassistant/deps/amcrest*
pip3 uninstall amcrest 
pip3 install homeassistant --upgrade
hass --version # should be 0.37.1

@trektronic it is very nice to collaborate on this project. I’m a big fan of home assistant. It has a great community too and a good place to learn more about programming and python. Thank you!

@tchellomello
Sorry for the delayed update, but I ran the 37.1 update and still get the same errors related to the IP3M cameras. I think it might have something to do with a different firmware/web interface differences between the cameras and not being supported the same way. I have removed the IP3M camera from my sensors.yaml to just get rid of the errors for now, and I’ll be pretty busy for the next few weeks with some flooring and painting projects in the house, but I’m more than happy to provide any information needed to help get the IP3M cameras supported.

Hello @tkvtec,

Could you share the traceback you are gettting with the newer version?

Which timezone are you in? We can try to troubleshoot it via gitter.

mmello

@tchellomello
Looks like the latest Amcrest Firmware breaks functionality. I just updated cameras with latest firmware and now all error in HASS.

17-04-10 10:03:30 ERROR (Thread-8) [custom_components.sensor.amcrest] Unable to connect to Amcrest camera: 401 Client Error: Unauthorized for url: http://10.166.2.130:80/cgi-bin/global.cgi?action=getCurrentTime

Hello @tkvtec, thanks for reporting this issue.

We already have an open PR to get this addressed at https://github.com/tchellomello/python-amcrest/pull/72.

Many thanks to the @dparker18.

Oh, great! Thanks for the update. I should have looked.

@tkvtec PR submitted to support new Amcrest firmware.

Many thanks to the @dparker18

https://github.com/home-assistant/home-assistant/pull/7130

Hi, I’ve just got one of the Amcrest IPM-721W indoor camera. What do I need to get started? Do you have comprehensive instructions somewhere that I can follow? Thanks!

1 Like

Yeah also got mine. Not sure how to set it all up with ptz etc.

Late to the party, but it would be super cool to tap into leveraging the two way audio in the amcrest cams that support it. I would love to have automated responses if it recognizes the person in the picture and responses for strangers. May tackle this in the future if i find it’s possible and no one gets to it before me.

Hi @tchellomello, great work that you’ve done here! I see that a few of your updates have made it into homeassistant, but I don’t see the functionality for ptz presets (unless I’m doing something wrong?) Do you plan to push that functionality into HA as well?

@raff take a look at this link https://community.home-assistant.io/t/amcrest-cameras/25605/2