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

Hello everyone,

I’ve been working to extend the Amcrest camera platform to support PTZ actions (move camera) and navigate to the preset position via HA.

In parallel, I’ve started the Amcrest sensor that will monitor some information from your Camera. So far, I’ve implemented 3 sensors:

  • Notifies if motion was detected (True/False)
  • Return the used/free free on the SD card
  • Return the number of preset position saved on your camera

Futhermore the sensor also includes the serial number, build firmware date and software version.




If you are an Amcrest Camera user, what sensors would you like to monitor on your camera?

Please let me know any ideas and I’ll try to incorporate them on the PR next week.

Note: If you are interested in testing this preview sensor, you can follow some instructions available at https://gist.github.com/tchellomello/0f87e134fdfcbd10350f53679812336d. I’ve published the test code and the instructions too.

Thank you!!!

2 Likes

The sdcard and motion_detector sensors look great! I have not tested them out yet - maybe tomorrow when I have some time.

I really like the idea of moving the camera from within HA (when viewing the live stream)! I think that having manual control (up, down, left, right) would be important, especially if I want to see something slightly beyond the camera’s view. Presets would be very nice too.

Keep up the great work on this! I’m excited to see where you take this.

1 Like

Indeed, keep up the excellent work. I am going to be buying some Amcrest indoor and outdoor cameras soon and this would be awesome.

1 Like

@StormStrikes @colinodell Awesome guys!! Thanks for the feedback and I’m very excited about the Amcrest cameras too.

I’ve put together a test plot which is already working on my HA instance that uses the python-amcrest module to move the camera to a preset PTZ position (https://github.com/tchellomello/python-amcrest/blob/master/src/amcrest/ptz.py#L210-L221).

Of course this is not yet integrated with the HA. The HA will load all the preset positions saved using the underlying library https://github.com/tchellomello/python-amcrest/blob/master/src/amcrest/ptz.py#L31-L35 and then the user will be select to select from a dropdown which position to move the camera.

This is an example of what I’m doing right now via command line:

#shell_commands.yaml
amcrestcam2_goto_preset_crib: /home/hass/.virtualenvs/home_assistant/bin/amcrest-cli --camera amcrestcam2 --ptz-goto-preset 0 1
amcrestcam2_goto_preset_roomview: /home/hass/.virtualenvs/home_assistant/bin/amcrest-cli --camera amcrestcam2 --ptz-goto-preset 0 2
amcrestcam2_goto_preset_nursechair: /home/hass/.virtualenvs/home_assistant/bin/amcrest-cli --camera amcrestcam2 --ptz-goto-preset 0 3

#groups.yaml
alice bedroom camera:
  name: Alice's Bedroom Camera
  entities:
    - input_select.amcrestcam2_presets
    - script.amcrestcam2_goto_preset_crib
    - script.amcrestcam2_goto_preset_nursechair
    - script.amcrestcam2_goto_preset_roomview
    - camera.amcrest_alice_bedroom

#scripts.yaml
amcrestcam2_goto_preset_crib:
  alias: 'Crib'
  sequence:
    - service: shell_command.amcrestcam2_goto_preset_crib

amcrestcam2_goto_preset_roomview:
  alias: 'Room View'
  sequence:
    - service: shell_command.amcrestcam2_goto_preset_roomview

amcrestcam2_goto_preset_nursechair:
  alias: 'Nursing Chair'
  sequence:
    - service: shell_command.amcrestcam2_goto_preset_nursechair

With that then we could accomplish this for now:

So with some work on the HA UI, the Amcrest camera will be able to load automatically all preset PTZ positions and allow the user to move the camera without any custom script as I showed above. What do you guys think?

Thank you!
mmello

@tchellomello I had put off purchasing the cameras because I did not want to really mess with setting all this up but your module is encouraging me to go ahead and get at least on PTZ to play with now.

If I may further add, I really like your implementation of preset positions. Personally, I think this is a much better way to do things. I mean, think about it, just how much are you going to be logging into HA and moving the camera around? I suspect most use cases would involve not doing much with it until some kind of alert came in such as motion detected. Even then, when I logged in to check on the camera, particularly on a mobile device, I dont want to be trying to fine tune movements and zoom levels with my finger, pinching, etc.

It seems like a much better method to predetermine the best coverage areas and zoom levels and just tap on a link and have the camera move there.

So keep it up. When I get my camera, I will be using your module to test things out. I was going to start with the outdoor cameras since it seemed like it would be easier to set those up, but now I will go ahead and get me a PTZ camera. Hopefully, I will have it in a few days and can provide further feedback.

Awesome @StormStrikes!!! Yes, that is beauty of open source!!!

Back in the day I was looking for a camera and @barrettford introduced me to Amcrest camera. Its been a great journey so far.

@colinodell added an awesome PR that allows now live streaming via mjpeg which is a huge step forward.

Thank you for your kind words and help. Let’s move it forward.

Ahhh I just bought other brand camera.

Knowing your component I would get Amcrest cameras only.

Which model you support?

Hello @anon35356645,

Since the Amcrest HA components uses the underlying library python-amcrest, according with https://github.com/tchellomello/python-amcrest#supportability-matrix right now we tested on models IP2M-842W, IP2M-841B and IP2M-841W.

It should work on the others models too.

@tchellomello I got my Amcrest PTZ today and wanted to try out your component. However, I am getting an error when use the instructions. It states to:

pip3 install git+https://github.com/tchellomello/python-amcrest@amcrest_simplified_response --upgrade

I tried it both with and without sudo and get the following error:

 Downloading/unpacking git+https://github.com/tchellomello/python-amcrest@amcrest_simplified_response
  Cloning https://github.com/tchellomello/python-amcrest (to amcrest_simplified_response) to /tmp/pip-3syeu2lh-build
  Could not find a tag or branch 'amcrest_simplified_response', assuming commit.
error: pathspec 'amcrest_simplified_response' did not match any file(s) known to git.
  Complete output from command /usr/bin/git checkout -q amcrest_simplified_response:

----------------------------------------
Cleaning up...
Command /usr/bin/git checkout -q amcrest_simplified_response failed with error code 1 in /tmp/pip-3syeu2lh-build
Storing debug log for failure in /root/.pip/pip.log

Any ideas on what I can check or do?

@StormStrikes you’re getting that error because the command you entered is trying to checkout the amcrect_simplified_response branch. This branch has been merged into master and deleted.

Try removing @amcrest_simplified_response from the command. (Or if that fails, try using replacing it with @master instead.)

1 Like

Hello @StormStrikes,

Yes as @colinodell mentioned that branch was committed. I’ve updated the instructions on gist URL. You can try to install it by running:

  pip3 install git+https://github.com/tchellomello/python-amcrest --upgrade

Thank you!

Yep, I got it installed, now I just need to figure out how to use it all. Thanks.

1 Like

Let us know if you need any further assistance.

I surely will, thank you .

1 Like

PR submitted https://github.com/home-assistant/home-assistant/pull/5310 to Amcrest Sensors.

Hopefully we will make it on 0.36 version.

Great work! I’m very pleased to see this. I just got a couple Amcrest cameras added last night. Eager to try this out!

I’m not sure how easy it is to implement this, but to add a time graph display on the Motion Sensor to see when there was motion would be a nice addition.

1 Like

Looking into getting this or Foscam but leaning toward this based on your work and what seems to be more developer support for Amcrest than Foscam. Question, what format is the feed? Does it support audio? Would two-way audio be a possibility via HA?

Thank you @tkvtec. I think with more people using we will have more features added to the Amcrest cameras soon.

We PR to have Amcrest sensors were accepted yesterday. You can take a look on how it will looks like by checking the link https://github.com/home-assistant/home-assistant/pull/5310.

The graph will be possible using the built-in graphs function available on HA. With the motion_dectector sensor introduced by the PR#5310, we should be able to get a graph about it.

The card will be displayed like this:

Then to have a more robust graph you can export the data to a Grafana database and use graphite to plot your graphs.

Thank you again and let’s make the component even better in the future.

teamwork++ opensource++ HA++
mmello

Hello @mstberto,

Nice. I’m very happy with my Amcrest cameras and having the possibility to explore their SDK API and bring some functionalities to HA is very awesome.

On the next version 0.37, the feed will be over mjpeg. @colinodell provided an awesome patch that allows it now. Regarding the audio, I’m not sure if HA supports it but that is definitely a cool feature.

@tchellomello This looks to be working great on my IP2M-841, but I don’t get the sensor for my Amcrest IP3M‑954E outdoor bullet cam. I’m really mostly intersted in the motion detection.
I found I forgot to add the other camera under my sensors.yaml, but once I added it there when I restart HA I get (which may have happened before I added that (after upgrading HA to latest version), but I just never noticed it in the logs):

17-01-28 08:43:28 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

After removing the IP3M from sensors.yaml, I get no Amcrest platform error in the log. It seems that motion detection might not be fully supported on the bullet cam?