Expose all events from an Amcrest device to an MQTT broker
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Go to file
Jeff Culverhouse f6f0d30544 Add origin, refresh broker on events 11 months ago
.github Merge pull request #62 from dchesterton/dependabot/github_actions/actions/checkout-3 4 years ago
.gitignore add support for config.yaml; sample config; revamp config 12 months ago
Dockerfile add support for config.yaml; sample config; revamp config 12 months ago
LICENSE Initial commit 5 years ago
README.md trouble with working on 2 projects at the same time 11 months ago
VERSION Add origin, refresh broker on events 11 months ago
amcrest2mqtt.py Add origin, refresh broker on events 11 months ago
config.yaml.sample add support for config.yaml; sample config; revamp config 12 months ago
docker-compose.yaml trouble with working on 2 projects at the same time 11 months ago
requirements.txt add support for config.yaml; sample config; revamp config 12 months ago

README.md

weirdtangent/amcrest2mqtt

Forked from dchesterton/amcrest2mqtt

A simple app to expose all events generated by Amcrest devices to MQTT using the python-amcrest library.

You can define config in config.yaml and pass -c path/to/config.yaml. See the config.yaml.sample file for an example.

Or, we support the following environment variables and defaults:

  • AMCREST_HOSTS (required, 1+ space-separated list of hostnames/ips)

  • AMCREST_NAMES (required, 1+ space-separated list of device names - must match count of AMCREST_HOSTS)

  • AMCREST_PORT (optional, default = 80)

  • AMCREST_USERNAME (optional, default = admin)

  • AMCREST_PASSWORD (required)

  • MQTT_USERNAME (required)

  • MQTT_PASSWORD (optional, default = empty password)

  • MQTT_HOST (optional, default = 'localhost')

  • MQTT_QOS (optional, default = 0)

  • MQTT_PORT (optional, default = 1883)

  • MQTT_TLS_ENABLED (required if using TLS) - set to true to enable

  • MQTT_TLS_CA_CERT (required if using TLS) - path to the ca certs

  • MQTT_TLS_CERT (required if using TLS) - path to the private cert

  • MQTT_TLS_KEY (required if using TLS) - path to the private key

  • MQTT_HOME_ASSISTANT_PREFIX (optional, default = 'homeassistant')

  • HOME_ASSISTANT (optional, default = false)

  • STORAGE_POLL_INTERVAL (optional, default = 3600) - how often to fetch storage data (in seconds) (set to 0 to disable functionality)

It exposes events to the following topics:

  • amcrest2mqtt/broker - broker config
  • amcrest2mqtt/[SERIAL_NUMBER]/event - all events
  • amcrest2mqtt/[SERIAL_NUMBER]/doorbell - doorbell status (if AD110 or AD410)
  • amcrest2mqtt/[SERIAL_NUMBER]/human - human detection (if AD410)
  • amcrest2mqtt/[SERIAL_NUMBER]/motion - motion events (if supported)
  • amcrest2mqtt/[SERIAL_NUMBER]/config - device configuration information

Device Support

The app supports events for any Amcrest device supported by python-amcrest.

Home Assistant

The app has built-in support for Home Assistant discovery. Set the HOME_ASSISTANT environment variable to true to enable support. If you are using a different MQTT prefix to the default, you will need to set the HOME_ASSISTANT_PREFIX environment variable.

Running the app

To run via env variables with Docker Compose

version: "3.4"
services:
  amcrest2mqtt:
    image: weirdtangent/amcrest2mqtt:latest
    container_name: amcrest2mqtt
    restart: unless-stopped
    environment:
      MQTT_HOST: 10.10.10.1
      MQTT_USERNAME: admin
      MQTT_PASSWORD: password
      MQTT_PREFIX: amcrest2mqtt
      MQTT_HOMEASSISTANT_PREFIX: homeassistant
      AMCREST_HOSTS: "10.10.10.20 camera2.local"
      AMCREST_NAMES: "Front_Yard Patio"
      AMCREST_USERNAME: viewer
      AMCREST_PASSWORD: password
      HOME_ASSISTANT: true
      STORAGE_POLL_INTERVAL: 600
      DEBUG_MODE: false

or make sure you attach a volume with the config file and point to that directory, for example:

CMD [ "python", "-u", "./amcrest2mqtt.py", "-c", "/config" ]

Out of Scope

Non-Docker Environments

Docker is the only supported way of deploying the application. The app should run directly via Python but this is not supported.

Buy Me A Coffee

A few people have kindly requested a way to donate a small amount of money. If you feel so inclined I've set up a "Buy Me A Coffee" page where you can donate a small sum. Please do not feel obligated to donate in any way - I work on the app because it's useful to myself and others, not for any financial gain - but any token of appreciation is much appreciated 🙂

Buy Me A Coffee