Git Product home page Git Product logo

python-amcrest's Introduction

Python Amcrest

https://travis-ci.org/tchellomello/python-amcrest.svg?branch=master

A Python 2.7/3.x module for Amcrest Cameras using the SDK HTTP API. Amcrest and Dahua devices share similar firmwares. Dahua Cameras and NVRs also work with this module.

Documentation: http://python-amcrest.readthedocs.io/

Installation

PyPI

$ pip install amcrest --upgrade
$ eval "$(register-python-argcomplete amcrest-cli)"

# To enable amcrest-cli autocomplete in the system:
$ echo 'eval "$(register-python-argcomplete amcrest-cli)"' >  /etc/profile.d/amcrest-cli-autocomplete.sh

RPM

$ git clone [email protected]:tchellomello/python-amcrest.git
$ ./autogen.sh
$ make rpm
$ dnf/yum install amcrest-cli-NVR.rpm pythonX-amcrest-NVR.rpm

Usage

from amcrest import AmcrestCamera
camera = AmcrestCamera('192.168.0.1', 80, 'admin', 'password').camera

#Check software information
camera.software_information
'version=2.420.AC00.15.R\r\nBuildDate=2016-09-08'

#Capture snapshot
camera.snapshot(0, "/home/user/Desktop/snapshot00.jpeg")
<requests.packages.urllib3.response.HTTPResponse object at 0x7f84945083c8>

#Capture audio
camera.audio_stream_capture(httptype="singlepart", channel=1, path_file="/home/user/Desktop/audio.aac")
CTRL-C to stop the continuous audio flow or use a timer

#Move camera down
camera.ptz_control_command(action="start", code="Down", arg1=0, arg2=0, arg3=0)

#Record realtime stream into a file
camera.realtime_stream(path_file="/home/user/Desktop/myvideo")
CTRL-C to stop the continuous video flow or use a timer

Command Line

$ man amcrest-cli
or
$ amcrest-cli --help

# Saving credentials to file.
$ vim ~/.config/amcrest.conf
[patio]
hostname: 192.168.0.20
username: admin
password: 123456
port: 80

[living_room]
hostname: 192.168.0.21
username: admin
password: secret
port: 80

$ amcrest-cli --camera living_room --version-http-api
version=1.40

Text User Interface (TUI)

Configure amcrest.conf and trigger amcrest-tui, make sure the user triggering amcrest-tui have access to framebuffer device or use sudo.

NOTE: Execute it from console logins, like /dev/ttyX (Non X Window). Pseudo-terminals like xterm, ssh, screen and others WONT WORK.

$ vim ~/.config/amcrest.conf
[patio]
hostname: 192.168.0.20
username: admin
password: 123456
port: 80

[living_room]
hostname: 192.168.0.21
username: admin
password: secret
port: 80

$ amcrest-tui

Supportability Matrix

Cameras

Model Tested Status Results/Issues
IPM-721 Yes working  
IPM-HX1 Yes working  
IP2M-841 Yes working  
IP2M-842 Yes working  
IP3M-941 Yes working  
IP3M-943 Yes working  
IP3M-956 Yes working  
IP3M-956E Yes working  
IP3M-HX2 Yes working  
IP4M-1026B Yes working  
IP4M-1041B Yes working  
IP4M-1051B Yes working  
IP5M-1176EB Yes working  
IP8M-2496EB Yes working  
IP8M-T2499EW-28M Yes working  

Network Video Recorders (NVR)

Model Tested Status Results/Issues
XVR DAHUA 5104S Yes working  

If you have different model, feel fee to contribute and report your results.

Help

If you need any help, please join our community on the Gitter channels available at Gitter.

python-amcrest's People

Contributors

adpriebe avatar akram avatar alexkohanim avatar antlarr avatar balloob avatar bdraco avatar blademckain avatar briandconnelly avatar chaoticbear avatar dchesterton avatar deadended avatar dougsland avatar dparker18 avatar dshokouhi avatar flacjacket avatar kdsudac avatar kevinbdn avatar lonestriker avatar maximvelichko avatar mehdilauters avatar nitrag avatar pjrt avatar pnbruckner avatar rkben avatar ryan-blakley avatar tchellomello avatar vangorra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-amcrest's Issues

No package called "fbida"

There is currently nothing in pypi called fbida and the top google results point back to this repo. What is fbida?

sending audio

first off, this is awesome i figured i was going to end up having to put something like this together myself but it's already done!

on that note; has anyone had any luck sending audio to their cam? this utility appears to send the audio to the cam just fine. However it always sounds completely messed up when outputting through the cam. Initially i started with just curl with the same result until i stumbled upon this.

im assuming it's some type of audio encoding issue. I have tried sending in most of the available formats with different bit/sample rates with no luck.

so far this encoding gets me the closest but it's still FAR from correct

G.711A as content type
ffmpeg -i 4353.mp3 -c:a pcm_alaw -ac 1 -ar 16000 -sample_fmt s16 output.wav

./autogen --without-python3 should generate python2 package

Due static rule in spec, 'make rpm' is generating python2 for fedora or distro based on RHEL >= 8. Might be useful to users to still select python2.

Hits 1 from spec:
%if 0%{?fedora} || 0%{?rhel} >= 8
%global with_python3 1
%else
%global with_python2 1
%endif

Hint2:
We might create a AC_SUBS in configure.ac to determine the "%global python{NUMBER_VERSION} 1"

Problem with audio_stream_capture

Hi,

Probably, I'm doing something wrong but in my case method audio_stream_capture never returns. I call it like this:

camera.audio_send_stream(httptype="singlepart", path_file=<path_to_file>, channel=1, encode="AAC")
<... other_logic ...>

My camera plays the sound successfully (length of the file is ~3 sec) but the method never returns and "<... other_logic ...>" below never executes.
I also tried to play with httptype=multipart but in this case, I hear no sound from the camera.

I also tried pure Amcrest REST API and basically have the same result. HTTP request takes too long (> 30 secs for 3 sec audio file), I hear sound but never get HTTP-response since it just hits a timeout.

So the question is, what is the proper way to send audio to a camera? :)

How to use `snapshot` method to output an array of the image?

Is there a way to convert binary data from snapshot method to numpy array?

As far as I see, snapshot method can return binary data of the image, which then can be written into a .jpeg file.

I have tried np.frombuffer method to obtain the image matrix directly, without writing it to a file first, but the result is inconsistent (matrix dimension is 1-D vector and varies from timestamp to timestamp).

snapshot() does not work for some cameras (HASS: Amcrest Cameras fail after update to 0.59.1)

**Description of problem:**After upgrade to 0.59.1 only 1 of my Amcrest cameras output appear in both of my Amcrest cameras displays on the Dashboard.

I upgrade my RPI 3 running on Raspbian Stretch Desktop to HA version 0.60.0. Still having the same trouble with my Amcrest Cameras. I did see this in the Info tab if this helps!!
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))': /cgi-bin/snapshot.cgi?channel=0
2:18 PM components/camera/amcrest.py (WARNING)

Implement Tests &Travis

We should be able to run minimal auto tests before merging a patch. Initial tests could be if the patch pass against pep8 validation (flake8 tool ?).

Error while setting up camera with version 1.5.4

Hi All,

Since 1.5.4, I got the following error:

Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.7/site-packages/amcrest/init.py", line 33, in init
timeout_protocol=timeout_protocol
TypeError: init() got an unexpected keyword argument 'verify'

Using this code:

from amcrest import AmcrestCamera
myCamera = AmcrestCamera(IP, 80, user, pass).camera

Works fine in 1.5.3.

New parameter?

Thanks,
Joe

TypeError: __init__() got an unexpected keyword argument 'verify'

Getting this issue while accessing the camera. Anybody else seen this?
Would appreciate any help!

camera = AmcrestCamera('192.168.0.1', 80, 'admin', 'passd').camera
Traceback (most recent call last):
File "", line 1, in
File "/home/anaconda3/lib/python3.7/site-packages/amcrest/init.py", line 33, in init
timeout_protocol=timeout_protocol
TypeError: init() got an unexpected keyword argument 'verify'

Post Audio Stream (Enhancement)

Nice project. Thanks!
Could you implement the Post Audio Stream API (ref section 4.3.3 in the API manual 2.10 2016-05-25)?

Use case:
When motion or sound are detected, play an audio file over the camera's speaker to act as a deterrent. Examples: dog barking, TV or radio playing, background conversations, alarm sound, etc.

Documentation error in example usage

In the "Usage" section of the README.rst the example for moving the camera down has two extra parens at the end of the line:
camera.ptz_control_command(action="start", code="Down", arg1=0, arg2=0, arg3=0)))

--config-backup --save /tmp/cfg is not working

The option --config-backup --save /tmp/cfg

» amcrest-cli  --camera amcrestcam1 --config-backup --save /tmp/cfg                                                                                 ~/d/h/homeassistant
Traceback (most recent call last):
  File "/home/mdemello/.virtualenvs/home_assistant/bin/amcrest-cli", line 863, in <module>
    main()
  File "/home/mdemello/.virtualenvs/home_assistant/bin/amcrest-cli", line 849, in main
    camera.config_backup(args.save)
TypeError: 'str' object is not callable

Restore config from backup

I can see that there is a config_backup() function that calls /cgi-bin/config.backup?action=all - which, in turn, retrieves a JSON with lots of settings.

I could not find how to import it back. The only thing that resembles import in https://s3.amazonaws.com/amcrest-files/Amcrest+HTTP+API+3.2017.pdf is configManager.cgi?action=restore - however it only accepts the list of names (and not JSON), and when I tried to run it (configManager.cgi?action=restore&names[0]=MobilePushNotification) I saw zero effect.

Do you know how is it supposed to work?

Dahua & Amcrest API's the same?

I have both Amcrest IPC and Dahua IPC cameras, and the latter seem to be working great via the Home Assistant Amcrest component - including motion detection!

There currently isn't a Dahua component in HA, and I had been using the generic and ffmpeg camera components to support them. Not great, since no other camera features are supported except snapshot and streaming. Some users have gone to great lengths with Python scripts and MQTT to get motion alerts from Dahua cameras via HA.

Are you able to confirm if the Amcrest HTTP API is essentially the same as for Dahua IPC cameras ? Are you aware of any differences or issues? I am wanting to get my facts straight before publicly announcing on the HA forums that the existing Amcrest support is fully compatible with Dahua.

Thanks!

Is it possible to choose an NVR channel

I'm using this library through the latest Home Assistant, I successfully added my Amcrest NVR with this:

# Amcrest NVR
amcrest:
  - host: NVR_IP
    username: <login>
    password: <password>
    sensors:
      - motion_detector
      - sdcard
      - ptz_preset

My Overview page in HA started showing images from the camera set to the first channel in the NVR.
Is it currently possible to specify the channel so that I can get the feed from other cameras in the NVR? Are there other implications of doing this?

In general I'm trying to avoid connecting directly to the Camera's IP, I'm thinking it's more efficient to connect to the NVR.

Amcrest Doorbell

Amcrest Doorbell works great with this by the way. Can you add a doorbell sensor too?

New format returned by getSoftwareVersion

It looks like the new firmware changes the software version string too:

Traceback (most recent call last):
  File "./DPtest.py", line 8, in <module>
    print('SW info:', a.camera.software_information)
  File "/root/python-amcrest/src/amcrest/system.py", line 70, in software_information
    version, build_date = ret.content.decode('utf-8').split()
ValueError: need more than 1 value to unpack

If I print ret.content it's now:
ret.content: b'version=2.420.AC00.17.R,build:2017-03-22\r\n'

I'll add a check for this and PR, thanks for your work!

Real time notification of Event

I recently just implemented a realtime event notifier - for VideoMotion events, but you could use any event, or multiple events, it's a list.

Is anyone interested in implementing it here?

This is the basic code (part of a camera class):

def stream_motion_data(self):
        text = ''
        chars = 0
        content_len = 0
        api_URL = 'http://%s:%s/cgi-bin/eventManager.cgi?action=attach&codes=[VideoMotion]' % (self.ip, self.port)

        r=requests.get(api_URL, auth=HTTPDigestAuth(self.user, self.password), stream=True)
            if r.status_code != requests.codes.ok:
                self.log.error('bad connection: %s' % r.status_code)
                r.raise_for_status()

            for line in r.iter_lines():
                # filter out keep-alive new lines
                if line:
                    decoded_line = line.decode('utf-8')
                    if decoded_line.startswith('--'):  # start of new chunk
                        text = ''
                        chars = -1
                    else:
                        if 'Content' not in decoded_line:
                            text += '%s\n' % decoded_line
                            chars = len(text)
                            self.log.debug('current content length: %s' % chars)
                        elif 'Content-Length:' in decoded_line:
                            content_len = int(decoded_line.replace('Content-Length:','').strip())
                            self.log.debug('content length: %s' % content_len)
                        if chars == content_len:
                            self.log.debug('decoding lines')
                            self.decode_line(text)

def decode_line(self, lines):  
        self.log.info(lines)
        data = lines.split(';')
        try:
            regions = json.loads(data[-1].replace('data=',''))
            regions = regions.get('RegionName', [])
        except json.JSONDecodeError:
            regions = []
            
        self.log.debug(' '.join(data))
        if 'VideoMotion' in data[0]:
            if 'Start' in data[1]:
                self.log.info('Motion Detected, regions: %s' % (regions))

It's a bit rough, as I just hacked it together to trigger a light when motion is detected via the camera.

The output looks like this:

[I 2020-01-09 10:39:49,528] (MainThread) Motion Detected, regions: ['Region1', 'Region2']

you'd have to run it in a thread if you wanted to do anything else with the camera while it's running.

I don't want to submit a PR if no-one is interested.

Cannot access realtime_stream in cv2 python

I can see the channel 1 (low res mpeg) stream, control the camera movement, but cannot use the high-rest stream due to access problems.

camera1 = amcrest.AmcrestCamera('192.168.1.xxx', 80 'admin', 'pswd', ).camera

vs = VideoStream(camera1.realtime_stream(
    channel=0, typeno=None, path_file=None`)).start

frame = vs.read()
cv2.imshow("Frame", frame)

The result is
Trying again due to error 401 Client Error: Unauthorized for url: http://192.168.1.35:80/cgi-bin/realmonitor.cgi?action=getStream&channel=0&subtype=None

possible support for amcrest AD110 ?

just bought one of these and am now sad to see the doorbell isnt supported (I know I should have done better research..)
any way this might be supported in the future ?

Trigger Motion Detection Event via API

Does anyone know how to trigger a motion detection event via the API?

The problem I have is that the camera reacts to lights turning on as if they were motion. I have the camera recording 24/7 (ie scheduled), and when motion is detected, it records that motion flagged as motion (ie stupid file name with '[M]' in it in place of '[R]').

This works fine, but is constantly recording the hallway light turning on and off.
I also use motion (the linux program) to detect motion, and track the motion using pan and tilt. This allows me to fine tune the motion detection parameters, and filter out 'lightswitch' events (as motion calls them).
I can also trigger external events on motion detection.

My thought was to turn the camera motion detection sensitivity down (so it doesn't trigger on the light), and send a command via the API to trigger a motion event (like the external input trigger).

I can't figure how to do this via the API though. Is there a way to trigger external event or motion recording via the API?

Thanks.

Media File APIs request

Please implement the APIs on section 4.11.5-4.11.7 of the AMCREST_HTTP_API_SDK_V2.10.pdf. These media file APIs would enable SD card media file search and download, which would add some useful functionalities to the Amcrest IP camera. For example, one can write a simple automation script to download a motion-triggered recorded video on camera SD card, based on certain conditions that are practically useful, e.g. when there is no network traffic and/or within certain time frames. Currently, Amcrest Ip cams can either record motion-triggered video to sd or send off to an FTP server. While this limitation is practically good to prevent network traffic (when multiple ip cams trying to send files to an FTP server), it is a big disadvantage not having a way to store the recorded video in a safer place, other than the cam sd card.

Password with '%' character on ~/.config/amcrest.conf fails

Password with '%' character on ~/.config/amcrest.conf fails with the errro below:

Traceback (most recent call last):
  File "/home/mdemello/.virtualenvs/amcrestchime/bin/amcrest-cli", line 960, in <module>
    main()
  File "/home/mdemello/.virtualenvs/amcrestchime/bin/amcrest-cli", line 508, in main
    args.password = config.get(section, 'password')
  File "/usr/lib64/python3.5/configparser.py", line 797, in get
    d)
  File "/usr/lib64/python3.5/configparser.py", line 393, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "/usr/lib64/python3.5/configparser.py", line 443, in _interpolate_some
    "found: %r" % (rest,))
configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: "%test%"

Create function to subscribe to event message bus to allow notifications real-time upon Motion Detection

Create function to subscribe to event message bus to allow notifications real-time upon Motion Detection.

Example:

curl -k -u 'admin:secret' \
"http://amcrestcam2.local.home/cgi-bin/eventManager.cgi?action=attach&codes=\[VideoMotion\]"
-- myboundary
Content-Type: text/plain
Content-Length:37
Code=VideoMotion;action=Start;index=0

-- myboundary
Content-Type: text/plain
Content-Length:36
Code=VideoMotion;action=Stop;index=0

-- myboundary
Content-Type: text/plain
Content-Length:37
Code=VideoMotion;action=Start;index=0

-- myboundary
Content-Type: text/plain
Content-Length:36
Code=VideoMotion;action=Stop;index=0

play wav only sends static (audio)

Hello, I'm loving this project so far which has greatly simplified the API calls for the amcrest camera.

I am currently testing with this camera [IP2M-841B]. And have run into one issue so far.

I'm using the pypip package to run the funcions.

For recording which works:
camera = AmcrestCamera(ip, 80, 'user', 'password').camera camera.audio_stream_capture( httptype="singlepart", channel=1, path_file="audio.wav")

But trying to "stream" the same file just plays back about 10 seconds of static:
camera = AmcrestCamera(ip, 80, 'user', 'password').camera camera.play_wav("singlepart", channel=1, path_file="audio.wav")

Any and all help would be appreciated.

Thanks!

split amcrest-cli in multiple sources

amcrest-cli was created to support the tons of calls the python library provides.
However, as the project grows fast, now we have a bunch of calls and the cli was basically copy/past and now it's pretty big one single file. IMO, would be the best if we could split it in topics as we do in the library for easy coding.

How to use a timer to control the real stream?

As mentioned in the docs, the script to store the continuous stream is
camera.realtime_stream(path_file="/home/user/Desktop/myvideo")
CTRL-C to stop the continuous video flow or use a timer

I have a couple of questions -

  1. How to use the timer for stopping the stream?
  2. Where to put the print statement so that I can log whenever it is updating /home/user/Desktop/myvideo

if path_file:
_try:
I am putting a print statement here to see whenever it gets copied but it prints only once despite the file getting updated continuously
with open(path_file, 'wb') as out_file:
shutil.copyfileobj(ret.raw, out_file)
except HTTPError as error:
LOGGER.debug("%s Realtime stream capture to file failed due "
"to error: %s", self, repr(error))
raise CommError(error)

Motion detected event should be filtered by channel id

The 6.9 GetEventIndexes section of the API documentation gives a way to know for which channel an event happened:

URL Syntax http://<ip>/cgi-bin/eventManager.cgi?action=getEventIndexes&code=<eventCode>

Comment | Get channels indexes that event of code eventCode happens. eventCode includes:VideoMotion: VideoLoss: VideoBlind: AlarmLocal:motion detection event video loss detection eventvideo blind detection event. alarm detection event.
-- | --
Response | channels[0]=0 channels[1]=2 channels[2]=3 ...(This response means event happened on channel 0, channel 2, and channel 3.)

Using this, we should be able to have a method telling if a motion detected event has occured for a given channel or not.

Currently, it seems that we only check that channels are present in the response, but we do not give access to the filtered information.

if 'channels' not in event:

Latest firmware update requires Digest auth, breaks HTTP basic auth requests

I'm working with a IP2M-841, just upgraded to new firmware V2.420.AC00.17.R 3/22/17

After upgrading, all my third party tools and custom code using python-amcrest broke on any request:

Traceback (most recent call last):
  File "/home/homeassistant/DPtest.py", line 7, in <module>
    print(c.camera.current_time)
  File "/home/homeassistant/.homeassistant/deps/amcrest/system.py", line 19, in current_time
    'global.cgi?action=getCurrentTime'
  File "/home/homeassistant/.homeassistant/deps/amcrest/http.py", line 102, in command
    resp.raise_for_status()
  File "/home/homeassistant/.homeassistant/deps/requests/models.py", line 909, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://xyz.xyz.xyz.xyz:80/cgi-bin/global.cgi?action=getCurrentTime

I verified by tcpdump/wireshark that we're sending basic auth in the request, and the camera responds 401 and asks for digest auth.

Seems others are seeing it too:
https://amcrest.com/forum/technical-discussion-f3/cgi-sdk-no-longer-functioning-on-17r--t2401.html

I fixed it by changing to digest auth in http.py:
self._token = requests.auth.HTTPDigestAuth(self._user, self._password)

Everything is working now, happy to submit a PR

Amcrest IP8M-2496EB partially working... !

Using Hassio component Amcrest IP Camera with "camera platform amcrest" & "sensor platform amcrest" for my "IP8M-2496EB for 1 month now.

Camera is displayed perfectly after setting to (resolution) low. I use the RSTP method and I'm curious if that could be the cause of my issue. (The sensor and switch errors below mention the HTTP transport protocol. Are they not to be used with RSTP

"Sensor" and "Switch" through a time out errors ever 2 seconds. Logs fill fast. But the associatied entities appear to be functioning correctly. (ie.. they yeld "state / data" that changes accurately.)

See details below.
` Log Details (WARNING)
Fri Dec 21 2018 04:35:51 GMT-0500 (Eastern Standard Time)

Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPConnectionPool(host='192.168..', port=**): Read timed out. (read timeout=3.0)",)': /cgi-bin/magicBox.cgi?action=getSoftwareVersion `

I will adjust the scan itnerval. But I suspect this time out issue is related to setting in amcrest.py component used by hassio. Any help would be most appreciated.

I also get this error..

`Log Details (WARNING)
Fri Dec 21 2018 04:30:21 GMT-0500 (Eastern Standard Time)

Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x6f448930>, 'Connection to 192.168.. timed out. (connect timeout=3.0)')': /cgi-bin/configManager.cgi?action=getConfig&name=MotionDetect `

Obviously I redacted my internal IP of the camera...

Ability to set default timeout for all commands

Right now, it looks like scan_devices() might be the only function where you can pass in a custom timeout. In other cases, such as snapshot(), there's no way to override the default timeout of 3 seconds.

Sending audio stream makes camera unresponsive

I am sendnig some audio which plays fine on the camera, however I am then unable to send subsequent streams or query the API for information such as SD card capacity. This is the documentation I followed.

        this_camera = get_camera(call);
        file=call.data.get(ATTR_FILE);
        _LOGGER.info("Playing {} on {}".format(file,call.data[ATTR_ENTITY_ID]));
        # this_camera.play_wav(httptype='singlepart', path_file=file);
        result = this_camera.audio_send_stream(httptype='singlepart', channel=1, path_file=file, encode='MPEG2');
        _LOGGER.info(dir(result));
        return result == 'OK';

The audio_send_stream method does not return, which explains the symptoms.
Is there anything I am missing in my code? Do I have to close some stream manually?
Tried singlepart and multipart and had the same problem with the commented out attempt at play_wav.
The only way to send more audio is by rebooting the camera.

Relay input/output

I've got a couple of Amcrest IP2M-841W camera's setup at the house. I made a kludge smoke detector for one that feeds into the camera relay, using a DC-DC step up converter to get the 9v required by the sensor.

It works OK and the app on my phone pushes me a notification if the relay is triggered. But it's not really enough to wake me up or alert the whole house etc. It would be great if I could have those relays exposed to homeassisstant. I'm not a software developer and don't have a sense for what it would take to get them working. Just wanted to post here and see if there's any interest.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.