Announcement

Collapse
No announcement yet.

Zoneminder Ubuntu Server Installation 2021 - MQTT integration

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Zoneminder Ubuntu Server Installation 2021 - MQTT integration

    Revisiting this endeavor - Zoneminder is Linux software



    First wrote about Zoneminder here ==>

    Zoneminder Ubuntu Server Installation with ZMXAP to use with HS MCSXP - December 18, 2010, 12:03 PM

    Just recently purchased another Lenova Tiny computer for use with Ubuntu 20.01. I am using Lenova Tiny computers for (and a couple of desktops)

    1 - Windows 2016 64 bit server - used for RDP for Windows Leviton PCA, UPB Upstart, Hikvision software, Homeseer Designer, et al
    2 - Ubuntu 18.04 64 bit server - running LMS and Plexserver and MythTV

    Hardware used for new Zoneminder computer - identical to computer servers 1 and 2

    1 - Lenova Tiny M93P with 16Gb RAM / Haswell chip set / i5 / Bluetooth / WLAN / Gb NIC / 1 Tb 2.5" HD
    2 - Optional USB / RS-232 side mounted expansion interface

    Software base:

    1 - Ubuntu 20.04 LTS - Desktop - optional server installation with LAMP

    2 - Zoneminder Installation following this receipe:

    ZoneMinder on Ubuntu 20.04 -
    Posted on July 15, 2020 by Brian, the Inept Tech

    Prerequisites

    Before we can install ZoneMinder we have to install and configure the software it needs to run. This includes Apache2, PHP7, & MySQL. We can install these one by one or, the easy way, by using tasksel.

    Code:
    sudo apt install tasksel
    sudo tasksel install lamp-server
    Note that you were not asked for password during the MySQL installation. Starting in 16.04 there is no need for a root password. Instead you can only connect via local socket, meaning you have to type “sudo mysql” at the command line to log in as root.

    Next, per ZoneMinder’s recommendation, we’ll replace the default MySQL config file.

    Code:
    sudo rm /etc/mysql/my.cnf
    sudo cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf
    Edit my.cnf and add sql_mode = NO_ENGINE_SUBSTITUTION to the [mysqld] section.

    Code:
    sudo nano /etc/mysql/my.cnf
    Click image for larger version  Name:	zm-1.jpg Views:	1 Size:	77.9 KB ID:	1459607

    Save the file and restart mysql

    Code:
    sudo systemctl restart mysql
    Time & Time Zones

    This one is very important and one that you don’t see mentioned a lot. You need to setup the time and time zones before installing ZoneMinder. If you make changes afterwards, you’ll start to see error messages in the ZM logs and, in my case, lose access to see videos from the last hour.

    Code:
    sudo dpkg-reconfigure tzdata
    If you’re in the US, like me, do not select US. Instead select America and find your time zone there. For me, its America > Chicago

    Next, set the time in PHP.

    Code:
    sudo nano /etc/php/7.4/apache2/php.ini
    Search for date.timezone and uncomment the line by removing the ; at the begging. Set your time zone according to the PHP website. Again, making sure they match. For me its America/Chicago.

    By default MySQL is set to system time. If you changed the Time Zone on the system, restart the service before checking MySQLs time. To check, run this command:

    Code:
    sudo systemctl restart mysql
    sudo mysql -e “SELECT NOW();”
    If the time matches, then you’re good to go.

    ZoneMinder Installation

    First we’ll need to install the official ZoneMinder PPA from Isaac Conner and then we can install ZoneMinder

    Code:
    sudo add-apt-repository ppa:iconnor/zoneminder-1.34
    sudo apt install -y zoneminder
    Once the installation finishes, we’ll need to configure Apache2 by copying and enabling the zm.conf file, enabling a few mods, and finially restarting ZoneMinder and Apache2.

    Code:
    sudo chmod 740 /etc/zm/zm.conf
    sudo chown root:www-data /etc/zm/zm.conf
    sudo chown -R www-data:www-data /usr/share/zoneminder/
    
    sudo a2enmod cgi rewrite expires headers
    sudo a2enconf zoneminder
    
    sudo systemctl enable zoneminder
    sudo systemctl start zoneminder
    
    sudo systemctl restart apache2
    Zoneminder should be installed and ready to add cameras.

    To test this, go to hxxp://ip_address/zm and the interface should be available.
    Its also a good idea to test the API by going to hxxp://ip_address/zm/api/host/getVersion.json.
    You should see the API version in your browser.

    Click image for larger version  Name:	zm-2.jpg Views:	1 Size:	11.6 KB ID:	1459608
    That’s it! ZoneMinder is ready to go and you can start adding your cameras. I wont cover cameras here since there are a ton of different models and what works for me, might not work for you. But, I will say, get yourself an ONVIF compliant camera and you shouldn’t have any issues.
    - Pete

    Auto mator
    Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
    Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
    HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

    HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
    HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

    X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

    #2
    Adding cameras - here using one Hikvision Doorbell Camera add using ONVIF

    Note: updated Nelly DB2 Doorbell - which talks RTSP, JPG and ONVIF using Hikvision Batch Configuration application.

    This section will review firmware modifications to wireless Nelly DB2 Doorbell. This removes ALL cloud connectivity / Hikvision (and OEM vendors) smart phone applications.

    Using a Ring configuration in house #2

    This section will show you how to integrate the cloud Ring configuration for home use using a Ring to MQTT plugin.
    - Pete

    Auto mator
    Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
    Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
    HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

    HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
    HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

    X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

    Comment


      #3
      Zoneminder external triggers via MQTT

      This section involves editing the external Zoneminder event script to be used for MQTT I am currently sending out hardwired doorbell MQTT events and built in PIR to ONVIF to MQTT events.
      - Pete

      Auto mator
      Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
      Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
      HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

      HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
      HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

      X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

      Comment


        #4
        Zoneminder Timelapse videos

        This script will create a timelapse video of whatever camera you chose.
        - Pete

        Auto mator
        Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
        Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
        HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

        HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
        HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

        X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

        Comment


          #5
          Zoneminder client ZmNinja installation (here using IPSec, OpenVPN)

          1 - Ubuntu
          2 - Windows
          3 - Android
          4 - iPhone
          - Pete

          Auto mator
          Homeseer 3 Pro - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e 64 bit Intel Haswell CPU 16Gb
          Homeseer Zee2 (Lite) - 3.0.0.548 (Linux) - Ubuntu 18.04/W7e - CherryTrail x5-Z8350 BeeLink 4Gb BT3 Pro
          HS4 Lite - Ubuntu 22.04 / Lenovo Tiny M900 / 32Gb Ram

          HS4 Pro - V4.1.18.1 - Ubuntu 22.04 / Lenova Tiny M900 / 32Gb Ram
          HSTouch on Intel tabletop tablets (Jogglers) - Asus AIO - Windows 11

          X10, UPB, Zigbee, ZWave and Wifi MQTT automation-Tasmota-Espurna. OmniPro 2, Russound zoned audio, Alexa, Cheaper RFID, W800 and Home Assistant

          Comment

          Working...
          X