<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by oZoneDev on Medium]]></title>
        <description><![CDATA[Stories by oZoneDev on Medium]]></description>
        <link>https://medium.com/@pliablepixels?source=rss-9f5490edda4f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*anMSUzm5jBPSa7sIxmXZSQ.png</url>
            <title>Stories by oZoneDev on Medium</title>
            <link>https://medium.com/@pliablepixels?source=rss-9f5490edda4f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 19:36:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pliablepixels/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Using your own cloud function for ES]]></title>
            <link>https://medium.com/zmninja/using-your-own-cloud-function-for-es-f48897d0ff49?source=rss-9f5490edda4f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f48897d0ff49</guid>
            <dc:creator><![CDATA[oZoneDev]]></dc:creator>
            <pubDate>Sat, 17 Jul 2021 14:47:41 GMT</pubDate>
            <atom:updated>2022-07-21T16:25:17.297Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1A2toPGG80d_2PxOeGho9Q.jpeg" /></figure><p><strong>Updated Jul 21, 2022: </strong>Legacy style FCM won’t work for iOS. May work for Android.</p><p><strong>Updated Jun 28,2022: </strong>I switched off my server on Jun 24, which means you won’t be getting pushes. While the ZM team launches a new client and their cloud function, you can fall back to the old FCM style in ES that will <strong>not </strong>require my server. You may lose some functionality (forgot what) but you’ll then start getting pushes again. To do that, just change this in zmeventnotification.ini and restart the ES:</p><pre>use_fcmv1 = no</pre><p><a href="https://forums.zoneminder.com/viewtopic.php?p=127052#p127052">Thanks for that reminder dave88!</a></p><p><strong>Updated, Sep 25: 2021: </strong>In addition to setting up your own cloud function, you will likely have to recompile zmNinja to use the serviceID that is associated to your own google account. As it stands right now, zmNinja is compiled using my google service account and push tokens are generated so that only projects associated to a specific service ID are able to send push messages to zmNinja. <a href="https://forums.zoneminder.com/viewtopic.php?f=33&amp;t=31118">Follow this post </a>— its currently investigation in progress as a user is trying to get things set up.</p><p>This post is in continuation of zmNinja+ES+ML EOL and covers what you need to do to run your own cloud function. Note that as of Jul 17, ZM Devs have shown interest in migrating the cloud function to their own set up in which case you may not have to do anything (except for upgrading ZMES which will have the new cloud function URL). I plan to continue my cloud function till Year End and if ZM devs take over, I’ll make the switch in the next version of the ES.</p><p><strong>Basics</strong></p><ul><li><a href="https://firebase.google.com/docs/cloud-messaging/migrate-v1">FCMv1</a> changed the way authentication needs to be done. Instead of a static key like before, Google Firebase servers exchange OAuth keys with a trusted app. The trusted app and the google servers share a secret that is negotiated between them.</li><li>So I set up a “google cloud function” (equivalent to AWS serverless/lambdas) in python that basically uses their firebase python messaging SDK (<a href="https://firebase.google.com/docs/reference/admin/python/firebase_admin.messaging">docs</a>). This is the “<strong>Trusted App</strong>” that is authorized to send messages via Google’s firebase servers</li><li>When you send a message from your ES, it reaches this “cloud function” and the cloud function forwards to google FCM servers</li></ul><p><strong>How to set up a python cloud function in GCP</strong></p><ul><li>There are many tutorials. See <a href="https://cloud.google.com/functions/docs/first-python">this</a>.</li><li>Before you go into replicating my code, just make sure you are able to set up a function that has a public URL that returns a “hello world” or something on the browser and then you can start messing with the rest</li></ul><p><strong>Authorization between your ES and the Trusted App</strong></p><ul><li>I chose to set up a JWT auth mechanism between your ES and my Trusted App. If your JWT token doesn’t match what I expect, then I’ll kick it out in my trusted app.</li><li>The token that the ES will use depends on the token you specify in <a href="https://github.com/ZoneMinder/zmeventnotification/blob/d041b4fe61574627fd99f784c5a864738d818d14/zmeventnotification.ini#L133">fcm_v1_key</a>. If you leave it empty, the default value of my key is used <a href="https://github.com/ZoneMinder/zmeventnotification/blob/d041b4fe61574627fd99f784c5a864738d818d14/zmeventnotification.pl#L145">here</a>.</li><li>The ES reaches the ‘Trusted App’ via the URL specified in <a href="https://github.com/ZoneMinder/zmeventnotification/blob/d041b4fe61574627fd99f784c5a864738d818d14/zmeventnotification.ini#L134">fcm_v1_url</a>. If you leave it empty, the default URL of my cloud function is used <a href="https://github.com/ZoneMinder/zmeventnotification/blob/d041b4fe61574627fd99f784c5a864738d818d14/zmeventnotification.pl#L146">here</a>.</li></ul><p><strong>Authorization between the Trusted App and Google Firebase servers</strong></p><ul><li>This is automatically handled by the firebase admin SDK in python — given I hosted it as a GCP cloud function, all I need to do is initialize the app and Google takes care of authentication. If we host it elsewhere, there are <a href="https://firebase.google.com/docs/cloud-messaging/auth-server">instructions</a> on how to authenticate. I just took the easy route.</li><li>Note that Google allows for authenticated requests to reach cloud function. In my case, I set this to “allow unauthenticated” so anyone could send a push request to my cloud function as long as their JWT token is valid. However, to actually reach a device, they’d need the device token ID, which only your ES will have. This should be improved in the future to only allow authenticated requests and then have the ES and the Trusted App exchange auth info even for sending requests</li></ul><p><strong>What needs to happen when the “Trusted App” moves from me to whoever takes it over (including hosting it on your own for your own needs)</strong></p><ul><li>You need to replicate my code as a cloud function somewhere (I’d recommend GCP as its easy)</li><li>You will need to change <a href="https://github.com/ZoneMinder/zmeventnotification/blob/d041b4fe61574627fd99f784c5a864738d818d14/zmeventnotification.pl#L146">DEFAULT_FCM_V1_URL</a> in zmeventnotification.pl to your cloud function URL or simply use a custom value in<a href="https://github.com/ZoneMinder/zmeventnotification/blob/d041b4fe61574627fd99f784c5a864738d818d14/zmeventnotification.ini#L134"> fcm_v1_url</a> in zmeventnotification.ini. For example, today it is ‘<a href="https://us-central1-ninja-1105.cloudfunctions.net/send_push">https://us-central1-ninja-1105.cloudfunctions.net/send_push</a>&#39; but when you set up your own, you’ll get a different URL</li><li>Decide on a ‘secret key’. This ‘secret key’ will be stored in your cloud function and then you will use that secret key to sign a JWT token on the ES side. Let’s go through an example:</li></ul><p>Let’s suppose you decide on a secret of ‘i-love-zmninja’. Then <a href="https://gist.github.com/pliablepixels/0fc298303a740b8f1a6f7cb53d7221b4#file-main-py-L35">change this line</a> in main.py to:</p><pre>SECRET=&#39;i-love-zmninja&#39;</pre><p>You now need to create a token to use on the ES side that is signed by this secret. An easy way to generate the token is to simply use python. You will need pyjwt installed ( pip3 install pyjwt ). Launch up the python interpreter and type these commands in: (don’t type in &gt;&gt;&gt; )</p><pre>&gt;&gt;&gt; import datetime<br>&gt;&gt;&gt; import jwt<br>&gt;&gt;&gt; jwt.encode({&#39;generator&#39;: &#39;pliable pixels&#39;, &#39;iat&#39;:datetime.datetime.utcnow(),<br>&#39;client&#39;:&#39;zmninja&#39;}, &#39;i-love-zmninja&#39;, algorithm=&#39;HS256&#39;)<br></pre><p>This will produce an output like this:</p><pre>b&#39;eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJnZW5lcmF0b3IiOiJwbGlhYmxlIHBpeGVscyIsImlhdCI6MTYzMDg3MDMyNiwiY2xpZW50Ijoiem1uaW5qYSJ9.IVTP7dAA_86PrSirIexXqlt2cV2E5yh8DOXutkyDZpY&#39;</pre><p>So here:</p><blockquote>eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJnZW5lcmF0b3IiOiJwbGlhYmxlIHBpeGVscyIsImlhdCI6MTYzMDg3MDMyNiwiY2xpZW50Ijoiem1uaW5qYSJ9.IVTP7dAA_86PrSirIexXqlt2cV2E5yh8DOXutkyDZpY</blockquote><p>is your token. (ignore the b and single quotes at start and end) This is the value you put in fcm_v1_key in zmeventnotification.ini, or, you can change DEFAULT_FCM_V1_KEY in zmeventnotification.pl</p><p>Now the ES will send the token to the cloud function. The cloud function will decode the token using the secret and since the token was signed with this secret, everything should work.</p><p><strong>The cloud function code</strong></p><p>When you set up the python cloud function, two files are created:</p><ul><li>main.py — which holds the actual function code (entry point is the name you specify when creating the cloud function, in my case, it is called send_push). <a href="https://gist.github.com/pliablepixels/0fc298303a740b8f1a6f7cb53d7221b4#file-main-py">Source code here</a></li><li>requirements.txt — dependencies that get installed when the cloud function is invoked for the first time (remember these are ephemeral — these functions spin up, then are removed when there isn’t constant traffic for a while and then when the next request comes in, it spins up again — all of this is automatic). <a href="https://gist.github.com/pliablepixels/0fc298303a740b8f1a6f7cb53d7221b4#file-requirements-txt">Source code here</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f48897d0ff49" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zmninja/using-your-own-cloud-function-for-es-f48897d0ff49">Using your own cloud function for ES</a> was originally published in <a href="https://medium.com/zmninja">zmNinja</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[End of the Road (EOY 2021)]]></title>
            <link>https://medium.com/zmninja/end-of-the-road-eoy-2021-d3a68e92e472?source=rss-9f5490edda4f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3a68e92e472</guid>
            <category><![CDATA[zmninja]]></category>
            <dc:creator><![CDATA[oZoneDev]]></dc:creator>
            <pubDate>Sat, 10 Jul 2021 15:01:21 GMT</pubDate>
            <atom:updated>2021-07-10T19:40:12.251Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XMaUACLJ8o5fmeWKd-WP7w.jpeg" /><figcaption><a href="https://unsplash.com/photos/Ar5FGfHXwMU?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditShareLink">credit</a></figcaption></figure><p>Dear users, thank you for your support over the past 6+ years as I’ve evolved zmNinja, ES and the ML components.</p><p>I have unfortunately run out of time to be able to support zmNinja and ES+ML. In the interest of keeping all discussions in one place, please read more details in the ZoneMinder <a href="https://forums.zoneminder.com/viewtopic.php?f=33&amp;t=30996#p122445">forum announcement</a>.</p><p>Thanks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3a68e92e472" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zmninja/end-of-the-road-eoy-2021-d3a68e92e472">End of the Road (EOY 2021)</a> was originally published in <a href="https://medium.com/zmninja">zmNinja</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multi frame and multi-model analysis]]></title>
            <link>https://medium.com/zmninja/multi-frame-and-multi-model-analysis-533fa1d2799a?source=rss-9f5490edda4f------2</link>
            <guid isPermaLink="false">https://medium.com/p/533fa1d2799a</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[cctv]]></category>
            <category><![CDATA[zmninja]]></category>
            <category><![CDATA[zoneminder]]></category>
            <dc:creator><![CDATA[oZoneDev]]></dc:creator>
            <pubDate>Wed, 23 Dec 2020 18:08:21 GMT</pubDate>
            <atom:updated>2021-03-07T13:24:52.513Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*r4Q1MaCB-ImG8tEOWk6zzA.png" /></figure><h3>Joy!</h3><p>Starting the next release of ES, you will now be able to:</p><ul><li>Chain multiple model types when doing detection in addition to just the kind of detection</li><li>Analyze arbitrary frames during analysis (not just snapshot, alarm or one frame)</li></ul><p>The way this is implemented is I’ve added two new attributes called ml_sequence and stream_sequence in objectconfig.ini . When present, they will override all the parameters in the [object]/[face]/[alpr] sections completely. To start using them, there is a new attribute called use_sequence which should be set to yes (default is no). If not set, legacy attributes will be used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/64/1*-2U-OISrlnK-jP-KcUyAJA.png" /><figcaption><a href="https://www.flaticon.com/authors/freepik">Credit</a></figcaption></figure><blockquote>If you don’t want to wait for a formal release, feel free to play around — <a href="https://github.com/pliablepixels/zmeventnotification/issues/313#issuecomment-749162186">instructions are here</a> (please post comments in that thread too, or in slack)</blockquote><h3>Powerful sequencing with ml_sequence:</h3><p>Here, let’s start with an example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/202340529ee486eba8377f048f52e4c5/href">https://medium.com/media/202340529ee486eba8377f048f52e4c5/href</a></iframe><ul><li><strong>Lines 2–6</strong> : I want to run object detection first, then face, then alpr ( model_sequence )</li><li><strong>Lines 7–28: </strong>We now deal with how we want to handle object detections. It is a sequence on its own. Here we are saying <em>‘First, try to detect with a TPU, but make sure confidence level is at least 0.6. If that fails, try Yolo with a confidence of 0.3’</em>. Why? Because Coral TPU is really fast, but it is less accurate. So we are upping the game on Coral TPU detection to eliminate false positives but falling back to YoloV4 which is very accurate. We are also saying, only look for person when detection objects ( pattern attribute). We also have a same_model_sequence_strategy that says break on the first match. In other words, if we have chained 5 different models to try for object detection, break out when any one matches. You can change this to most or most_unique which means loop through all the variations and pick the one that either matches most objects or most unique objects (the difference here is if we detect “person, person, car, truck” then most=4 while most_unique=3)</li><li><strong>Lines 29–43</strong>: Same logic as above, but for face detection</li><li><strong>Lines 45–60: </strong>Same logic as above, but for ALPR. We’ve added another attribute here called pre_existing_labels with a value of [&#39;car&#39;, &#39;motorbike&#39;, &#39;bus&#39;, &#39;truck&#39;, &#39;boat&#39;] which means don’t run this detection type unless some previous model run found any one of the above labels. This is useful if, say, you chain object and alpr in detection. If you are paying for ALPR detection, you don’t want to call your paid for APIs if you did not detect a vehicle in the first place!</li></ul><p>There are other capabilities you can drive in ml_sequence. Read <a href="https://pyzm.readthedocs.io/en/latest/source/pyzm.html#module-pyzm.ml.detect_sequence">the docs for more details</a>.</p><h3>Powerful stream analysis with stream_sequence:</h3><p>Let’s start simple:</p><pre>use_sequence = yes</pre><pre>stream_sequence = {<br>        &#39;frame_strategy&#39;: &#39;most_models&#39;,<br>        &#39;frame_set&#39;: &#39;snapshot,alarm&#39;</pre><pre>}</pre><p>This replicates the old behavior and says for each stream to analyze, grab the snapshot and alarm frames.Then strategy says most_models which means <em>“pick the one that has matches with, well, most models”</em>. In other words, if 3 frames matched your total criteria, we will pick the one that matched across most of these models (example, object+face will be selected over 2 object matches)</p><pre>stream_sequence = {<br>        &#39;frame_strategy&#39;: &#39;most_unique&#39;,<br>        &#39;frame_set&#39;: &#39;snapshot,alarm,1,5,7,9,12,22&#39;</pre><pre>}</pre><p>This extends the previous example by adding more frames to the analysis. It also changes the model to ‘most_unique’ which means pick the frame with most unique matches. Example:</p><ul><li>Frame 1 matches ‘tree’, ‘person’, ‘person’, ‘cat’, ‘dog’, ‘bob’ (bob is a face name)</li><li>Frame 4 matches ‘truck’, ‘person’, ‘x456784’, ‘rita’ (rita is a face name) ,x456784 is a license plate)</li></ul><p>We will go with Frame 1 as # of unique matches = 4 (person, cat, dog, bob)</p><p>However, if strategy was ‘most_models’ then Frame 4 is selected because it matched ‘object’, ‘alpr’, ‘face’ while Frame 1 only matched ‘object’, ‘face’</p><pre>stream_sequence = {<br>        &#39;frame_strategy&#39;: &#39;most_unique&#39;,<br>        &#39;start_frame&#39;: 20,<br>        &#39;frame_skip&#39;:2,<br>        &#39;max_frames&#39;: 200</pre><pre>}</pre><p>This says start detection at frame=20, skip every other frame, stop when we’ve processed upto 200 total frames</p><p>There are other options as well, <a href="https://pyzm.readthedocs.io/en/latest/source/pyzm.html#pyzm.ml.detect_sequence.DetectSequence.detect_stream">see docs</a>. Not all of them will be useful if you only plan to use this with ES, but if you plan to use pyzm on your own, you’ll realize the additional value.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=533fa1d2799a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zmninja/multi-frame-and-multi-model-analysis-533fa1d2799a">Multi frame and multi-model analysis</a> was originally published in <a href="https://medium.com/zmninja">zmNinja</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[zmNinja, ES 6.x and notifications]]></title>
            <link>https://medium.com/zmninja/zmninja-es-6-x-and-notifications-7927d7d7c93e?source=rss-9f5490edda4f------2</link>
            <guid isPermaLink="false">https://medium.com/p/7927d7d7c93e</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[zoneminder]]></category>
            <category><![CDATA[cctv]]></category>
            <category><![CDATA[home-security-systems]]></category>
            <category><![CDATA[zmninja]]></category>
            <dc:creator><![CDATA[oZoneDev]]></dc:creator>
            <pubDate>Sat, 17 Oct 2020 12:15:23 GMT</pubDate>
            <atom:updated>2021-07-20T11:26:40.906Z</atom:updated>
            <content:encoded><![CDATA[<h3>An update: zmNinja, ES 6.x and notifications</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*YdEJPWdrU2cy3GGq7JrkOQ.jpeg" /></figure><p>Update Log:</p><ul><li>Jun 26, 2021: Updated that if you enable certain flags in zmeventnotification.ini I will be storing sensitive information but that is ONLY if you explicitly enable it in your config (turned off by default)</li><li>Oct 24: Updated that I am now storing first 10 characters of your alarm title and body (seems in some cases they are being sent as empty, which causes issues)</li></ul><p>Around <a href="https://medium.com/zmninja/es-6-0-and-lots-of-goodies-but-be-prepared-for-breaking-changes-d9c91b5b7137">2 months ago, I posted </a>that ES users should brace for breaking changes. I released ES 6 and zmNinja 1.6 together last week.</p><p>Please note that you need to update to ES6 for notifications to work in zmNinja 1.6.</p><p>I also wanted to post some updates on changes to how push now works:</p><ul><li>In the past, your ES would directly send a push notification to Google FCM servers and your devices would get a push notification</li><li>In ES 6, I migrated to FCMv1 which has changed how authentication works. FCMv1 uses OAuth which is more secure than long standing API keys. What I then had to do was route your ES messages to an ES cloud server (which I had to write) and my ES cloud server would forward the message forward to FCM. This is not unique — every 3rd party push notification service like PushOver, PushWoosh, etc. does the same thing. It just so happens that I preferred not to do it so far because it was more work. Now I have to do it.</li></ul><p>What that now means for you is:</p><ul><li>You are<strong> limited to 8000 push messages per month, per device</strong>. It is pretty easy to disable this limit, but please don’t. This number is quite generous and more than what many (most?) 3rd party push providers provide. The reason I put this up is for those folks who don’t care about proper zone configuration and generate gobs of pushes per second. My intermediary server is hosted as a google cloud function and I will be paying for it on a monthly basis (I guess I’ll figure out over time how much that is)</li><li>Please note that given your <strong>ES push now routes through my intermediary</strong>, I store some key log elements so I can map errors if they occur. Specifically, here is what I store:</li></ul><p>android device push:</p><pre>2021-06-26 10:31:54.188 EDT</pre><pre>send_push9l7rt5hrddpz token: ...ez5LZK6wya os:android image: key message elements:{&#39;android&#39;: {&#39;channel&#39;: &#39;zmninja&#39;, &#39;icon&#39;: &#39;ic_stat_notification&#39;, &#39;priority&#39;: &#39;high&#39;, &#39;ttl&#39;: None, &#39;image&#39;: &#39;&lt;present&gt;&#39;, &#39;tag&#39;: None}, &#39;non_platform_specific&#39;: {&#39;log_id&#39;: &#39;NONE&#39;, &#39;title&#39;: &#39;Ended:Back...&#39;, &#39;body&#39;: &#39;Motion: Ba...&#39;, &#39;log_raw_message&#39;: &#39;NO&#39;}}</pre><p>ios device push:</p><pre>2021-06-26 10:32:14.798 EDT</pre><pre>send_pushhnczmca1858d token: ...kAak5qgxb0 os:ios image: key message elements:{&#39;ios&#39;: {&#39;headers&#39;: {&#39;apns-priority&#39;: &#39;10&#39;, &#39;apns-push-type&#39;: &#39;alert&#39;}, &#39;thread_id&#39;: &#39;zmninja_alarm&#39;, &#39;image&#39;: &#39;&lt;present&gt;&#39;}, &#39;non_platform_specific&#39;: {&#39;log_id&#39;: &#39;NONE&#39;, &#39;title&#39;: &#39;CatGenie 2...&#39;, &#39;body&#39;: &#39;Motion All...&#39;, &#39;log_raw_message&#39;: &#39;NO&#39;}}</pre><p>What you see above is an <strong>actual push</strong>, some user sent using ES 6. I log the last 10 digits of your token (the token is a very long string), the OS and key android and iOS headers the ES sends out. I also store whether this push included an image or not, but don’t store the image as it may contain a private URL with username and password. I also store the timestamp of when this push was sent (actually, google does that in my log view). Finally, I store the first 10 characters of your alarm title and body.</p><p>On Jun 26, 2021: I added a few options that you can turn on in zmeventnotification.ini that can help me in debugging if you enable them</p><pre><em># Make this yes if you are having push notification issues <br># and want me to take a look at what is going on on my server side. # Default is no</em></pre><pre><em># WARNING: If you enable this, I&#39;ll get to see your push notification # details including your full token and possibly your ZM user and <br># password that you provide as part of the picture URL. <br># I try and automatically replace it, but no guarantees if the regex<br># fails in certain conditions. SO KEEP THIS OFF unless you&#39;ve <br># chatted with me</em></pre><pre><em># and you know we have exchanged notes. You should turn this off once debugging is over</em></pre><pre>fcm_log_raw_message=no</pre><pre><em><br># If you want me to help you debug what is going wrong in FCM, it <br># helps if you add a unique ID here so that I know what to look for # it can be anything. Default is NONE</em></pre><pre><em>fcm_log_message_id=I_LOVE_LAMBSHANKS</em></pre><p>Here is an example log that I get when you enable fcm_log_raw_message AND fcm_log_message_id (Note you can enable one and disable the other)</p><pre>2021-06-26 10:17:52.684 EDT</pre><pre>send_pushhncz39yg6a42 token: ...LbGcpb30fU os:ios image: key message elements:{&#39;ios&#39;: {&#39;headers&#39;: {&#39;apns-priority&#39;: &#39;10&#39;, &#39;apns-push-type&#39;: &#39;alert&#39;}, &#39;thread_id&#39;: &#39;zmninja_alarm&#39;, &#39;image&#39;: &#39;&lt;present&gt;&#39;}, &#39;non_platform_specific&#39;: {&#39;log_id&#39;: &#39;I_LOVE_LAMBSHANKS&#39;, &#39;title&#39;: &#39;Front Door...&#39;, &#39;body&#39;: &#39;[s] detect...&#39;, &#39;log_raw_message&#39;: &#39;yes&#39;}}</pre><pre>token: ...LbGcpb30fU os:ios image: key message elements:{&#39;ios&#39;: {&#39;headers&#39;: {&#39;apns-priority&#39;: &#39;10&#39;, &#39;apns-push-type&#39;: &#39;alert&#39;}, &#39;thread_id&#39;: &#39;zmninja_alarm&#39;, &#39;image&#39;: &#39;&lt;present&gt;&#39;}, &#39;non_platform_specific&#39;: {&#39;log_id&#39;: &#39;I_LOVE_LAMBSHANKS&#39;, &#39;title&#39;: &#39;Front Door...&#39;, &#39;body&#39;: &#39;[s] detect...&#39;, &#39;log_raw_message&#39;: &#39;yes&#39;}}</pre><pre>2021-06-26 10:17:52.684 EDT</pre><pre>send_pushhncz39yg6a42 RAW message ID:PLIABLEPIXELS being sent to FCM:{&quot;apns&quot;: {&quot;headers&quot;: {&quot;apns-priority&quot;: &quot;10&quot;, &quot;apns-push-type&quot;: &quot;alert&quot;}, &quot;payload&quot;: {&quot;aps&quot;: {&quot;badge&quot;: 1, &quot;mutable-content&quot;: 1, &quot;sound&quot;: &quot;default&quot;, &quot;thread-id&quot;: &quot;zmninja_alarm&quot;}}}, &quot;data&quot;: {&quot;eid&quot;: &quot;62091&quot;, &quot;image_url_jpg&quot;: &quot;https://&lt;MY_SERVER_NAME&gt;/zm/index.php?view=image&amp;eid=62091&amp;fid=objdetect&amp;width=600&amp;username=something&amp;password=something &quot;mid&quot;: &quot;2&quot;, &quot;notification_foreground&quot;: &quot;true&quot;}, &quot;notification&quot;: {&quot;body&quot;: &quot;[s] detected:(coral) person:77% Motion Front Path at 10:17 AM, 26-Jun&quot;, &quot;title&quot;: &quot;Front Door Alarm (62091)&quot;}, &quot;token&quot;: &quot;d7QzQrsBD6A:APA9&lt;REST_OF_MY_TOKEN&gt;&quot;}</pre><p>Notes:</p><ul><li>&lt;MY_SERVER_NAME&gt; will be the actual server IP/hostname</li><li>&lt;REST_OF_MY_TOKEN&gt; will be your full device token</li><li>username=something&amp;password=something is after my code replaces your passwords, so most likely your login details will be protected but <strong>NO GUARANTEES</strong> — there may be some condition where the regex fails</li></ul><p><strong>Cloud Function details &amp; source code</strong></p><p>Finally, everything in the ES is open source. So it is proper that I also tell you what exactly the cloud function code does. What I can’t tell you however is the key I use to sign authentication, because that is private to me. The details of this cloud function are <a href="https://medium.com/zmninja/using-your-own-cloud-function-for-es-f48897d0ff49">here</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6cb247d935ca14143eeb490bdc1cece5/href">https://medium.com/media/6cb247d935ca14143eeb490bdc1cece5/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7927d7d7c93e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zmninja/zmninja-es-6-x-and-notifications-7927d7d7c93e">zmNinja, ES 6.x and notifications</a> was originally published in <a href="https://medium.com/zmninja">zmNinja</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ES 6.0 and lots of goodies (but be prepared for breaking changes)]]></title>
            <link>https://medium.com/zmninja/es-6-0-and-lots-of-goodies-but-be-prepared-for-breaking-changes-d9c91b5b7137?source=rss-9f5490edda4f------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9c91b5b7137</guid>
            <category><![CDATA[home-security]]></category>
            <category><![CDATA[zoneminder]]></category>
            <category><![CDATA[zmninja]]></category>
            <category><![CDATA[cctv]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[oZoneDev]]></dc:creator>
            <pubDate>Sat, 15 Aug 2020 16:35:30 GMT</pubDate>
            <atom:updated>2020-08-16T17:13:22.302Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*WlJvbsOM_0TtUmI_bnOcCA.jpeg" /><figcaption>You’re either falling or you’re rising. It’s all perspective.</figcaption></figure><p>I am close to releasing ES 6.0 and along with it many updates to <a href="https://github.com/pliablepixels/pyzm">pyzm</a> and <a href="https://github.com/pliablepixels/mlapi">mlapi</a>. A lot of updates have gone in, both as features and under-the-hood structural changes for the greater good. This post covers some highlights:</p><p>Let’s start with the good stuff:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/100/1*IAfKURtCfYLgC1Lt8MPcRw.png" /></figure><ul><li>ES now support detection using <a href="https://coral.ai/?gclid=CjwKCAjwj975BRBUEiwA4whRB7nsDr-iYUyu0Tm4JKNPrkczK53MWFRmn6rm_6XOP-L6IWLx0I0M-xoC580QAvD_BwE">Google Coral USB stick</a>. It’s a great little stick that costs around $60 and offers fast object detection. Note that you can use any <a href="https://coral.ai/models/">coral compatible model</a> you want, including creating your own or using a 3rd party model that has been converted to coral’s tflite format. By default, I download mobilenetSSD v2. It’s not as accurate as Yolov4 but works quite well. And for that speed, hell yeah.</li><li>The ES now supports a rule file called es_rules.json that is placed in /var/lib/zmeventnotification/es_rules.json — You can use it to customize notification mute times on a per monitor basis. Over time, this functionality will expand. See <a href="https://zmeventnotification.readthedocs.io/en/latest/guides/principles.html#wait-what-on-earth-is-a-rules-file">this</a> for some more details.</li><li>You can now specify how many simultaneous processes can use your target hardware at the same time (TPU/GPU or CPU). This is a great help if you find your object detection code crashing when a lot of requests come together. Any processes that exceed the maximum count will wait till the count goes below max count (see xxx_max_processes where xxx=cpu or tpu or gpu )</li><li>All the machine learning code has now moved to <a href="https://github.com/pliablepixels/pyzm">pyzm</a> — the common python library I wrote for ZM. This means we no longer need to keep updating <a href="https://github.com/pliablepixels/mlapi">mlapi</a> separately. With each update to pyzm, local detection and remote detection stay in sync. This also means mlapi now supports all detection algorithms that local detection supports including alpr. Bonus, you can now use ML code in your own python scripts like <a href="https://github.com/pliablepixels/pyzm/blob/master/example.py#L59">this</a>.</li><li>Many more fine grained controls have been introduced that allows you to switch processors based on type of detection (example, you can do object detection on a TPU, face detection on a CPU or GPU etc.)</li><li>You can now filter detection patterns based on object type. For example, you can filter for certain license plates using alpr, while using a different filtering criteria for objects.</li><li>zm_detect.py can now be used to update detection for past events as well. See --notes command line parameter. This is useful if you want to run detection in batch mode for a bunch of past events.</li></ul><p>All of this come with costs. Some due to new features, some due to my not thinking things through well before.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/100/1*l1pCSXQ8gF8kznIBMq5UwA.png" /></figure><ul><li>A lot of things have changed in objectconfig.ini . <strong>Don’t expect to just clone and start running. Please read “</strong><a href="https://zmeventnotification.readthedocs.io/en/latest/guides/breaking.html"><strong>Breaking Changes</strong></a><strong>” and follow the instructions.</strong></li><li>I’d strongly recommend you use the supplied install.sh script- it will ease a lot of your pain and also create a migrated config file for you to inspect and modify.</li><li>If you are using mlapi or pyzm in your own projects, make sure you update to the latest versions for all, or things will break.</li></ul><p>Enjoy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9c91b5b7137" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zmninja/es-6-0-and-lots-of-goodies-but-be-prepared-for-breaking-changes-d9c91b5b7137">ES 6.0 and lots of goodies (but be prepared for breaking changes)</a> was originally published in <a href="https://medium.com/zmninja">zmNinja</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ditch self-signed certs, switch to LetsEncrypt]]></title>
            <link>https://medium.com/zmninja/ditch-self-signed-certs-switch-to-letsencrypt-4a734dcd6c83?source=rss-9f5490edda4f------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a734dcd6c83</guid>
            <category><![CDATA[zmninja]]></category>
            <category><![CDATA[cctv]]></category>
            <category><![CDATA[zoneminder]]></category>
            <category><![CDATA[mobile]]></category>
            <dc:creator><![CDATA[oZoneDev]]></dc:creator>
            <pubDate>Sat, 04 Jul 2020 15:32:57 GMT</pubDate>
            <atom:updated>2020-07-04T22:40:04.069Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*lnFOJzPB1UZ0xQzDvDEhiw.jpeg" /><figcaption>Move it! Update! Migrate! (Photo by <a href="https://unsplash.com/@ryanmfranco?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Ryan Franco</a> on <a href="https://unsplash.com/s/photos/angry?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a>)</figcaption></figure><p>I’ve said this many times before in 1–1 conversations earlier. In most cases, there is really no reason for you to be using self-signed certificates with ZoneMinder. <a href="https://letsencrypt.org/">Let’sEncrypt</a> is free and you don’t need a static IP to use Let’s Encrypt.</p><p>In-fact, I’ve been running Let’sEncrypt for years now with a free DNS name from <a href="https://www.duckdns.org/">DuckDNS</a>. The logic is pretty simple — I sign up for a free domain name, and use one of the bazillion options presented <a href="https://www.duckdns.org/install.jsp">here</a> to keep my domain name mapped to my latest IP address, if and when it changes. That’s all really. And then once I have a DNS name, I use it to generate my LetsEncrypt certs using its automated bots. Instructions are <a href="https://certbot.eff.org/lets-encrypt/ubuntubionic-apache">on their website</a>.</p><p>The reason I say this is for a long time, browsers have been discouraging self-signed certificates and with every new version, they add more constraints. IOS 13 and Catalina, for example, tightened up their TLS certificates requirements as documented <a href="https://support.apple.com/en-us/HT210176">here</a>.</p><p>So upgrade, if you can! Thanks!</p><p>Oh an iOS users, with 1.4.009 of zmNinja, if you can’t see monitor feeds and you are using self-signed certs, I’ve pushed 1.4.010 that will fix this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a734dcd6c83" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zmninja/ditch-self-signed-certs-switch-to-letsencrypt-4a734dcd6c83">Ditch self-signed certs, switch to LetsEncrypt</a> was originally published in <a href="https://medium.com/zmninja">zmNinja</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[1.4.007 and some updates]]></title>
            <link>https://medium.com/zmninja/1-4-007-and-some-updates-6e67e306f221?source=rss-9f5490edda4f------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e67e306f221</guid>
            <category><![CDATA[surveillance]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[cctv]]></category>
            <category><![CDATA[zoneminder]]></category>
            <dc:creator><![CDATA[oZoneDev]]></dc:creator>
            <pubDate>Thu, 14 May 2020 14:41:21 GMT</pubDate>
            <atom:updated>2020-05-18T16:46:17.281Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*5oManbIKySw4PQY5MSciow.jpeg" /><figcaption>I am officially out of ideas on interesting banner art. This is supposed to be you loving zmNinja updates.</figcaption></figure><p>It’s been a while since I gave an update on what’s coming up. I just released 1.4.007 that hopefully has a few useful updates for you:</p><p>(Full <a href="https://github.com/pliablepixels/zmNinja/blob/v1.4.007/CHANGELOG.md">CHANGELOG</a>)</p><p><strong>Better control of montage scaling</strong></p><p>If I am not mistaken, the zmNinja montage screen is probably the most used screen in the app and control of scaling the monitor sizes is important. This has also been one of the key pain points of zmNinja — the library I use (<a href="https://packery.metafizzy.co/">packery</a>) seems to have a mind of it’s own and often lays out monitors not exactly like we’d want.</p><p>First, to help on the scaling of monitors with “+” and “-” buttons, zmNinja now support fractional scaling. Simply put, go to Developer settings, can change your montage resize factor to 0.2(%) or even lower. So far, I’ve only supported integers. Basically, the reason I did not support fractions was that I had to pre-create CSS classes for each scale and it was not possible to support infinite classes for infinite fractions. Well, I changed that code to do dynamic CSS computation and what that now means for you is when you increase or decrease monitor size in montage, you have better control.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ww6sPLA_bkZ_lUSEjuwa2Q.png" /></figure><p><strong>More Real Estate</strong></p><p>Next up, I’ve often received inputs that people want to see more on their montage, and if there was only a way to remove the footer bar, like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*OdI_rliE7dQbRWinMepJVA.png" /></figure><p>Well ok, you pixel nuts (said in a loving way, promise).</p><p>Back to developer options:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*py_QzAe5dNUYVHKsg3avVA.png" /></figure><p>And you now have:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*smAM7fYC5uOJJ-mx6u8kmw.png" /><figcaption>Booyah. You’re welcome</figcaption></figure><p><strong>But back to spaces and flow</strong></p><p>And then there is this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*y0RVk0xNdOQKdkt4JodPPQ.png" /><figcaption>frustrated person icon credit:<a href="http://clipart-library.com/clipart/frustrated-cliparts_5.htm">http://clipart-library.com/clipart/frustrated-cliparts_5.htm</a></figcaption></figure><p>When you have several monitors and you twist and tweak the montage settings, you are sometimes just not able to eliminate empty spaces to the right. When you try, the monitor goes to the next row. Actually, now with fractional scaling support (see first feature above), you should be able to control this better, but how about an automatic option?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*YmxNetbFZdWth8oQjB1afw.png" /><figcaption>You don’t need rogain anymore. Don’t pull your hair out because of zmNinja</figcaption></figure><p>Now, if you tap on the “grid” button icon on the top right you will be asked how many columns you want. Let’s say you say “3”. (Oh, BTW in previous versions this button had a different icon and actually just “compacted the monitors” better. That has now moved to the grey button bar and is highlighted in yellow above)</p><p>So, back to the main story, you said “3”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*BuBnhd-ksW0ZXhAhlHrJ_Q.png" /></figure><p>Boom! Flush resizing. No white spaces. Save your scalp.</p><p><strong>ZM Groups</strong></p><p>Finally, I now support ZM Groups. Note that this needs ZM Master as of May 2020 (Or you could try replacing your GroupsController.php file). Adding this support required an extension to the API /groups/associations.json</p><p>If your ZM supports that API, you’ll see a folder icon like the image below and this will populate a list of ZM groups and you can switch between them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*NA3S5FvXD8W4bbb79HXN1w.png" /></figure><p><strong>Note: </strong>ZM Groups is different from zmNinja montage profiles. They are handled differently. Once you select one or more ZM groups, you can save that as a local montage profile (and resize/move monitors as needed).</p><p><strong>Event Playback Skip (+-10s)</strong></p><p>And finally, if you are using video store (mp4, not JPEG), you can now skip back and forward by 10s as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*9MqK9c7fp7cChF_bwHErEA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e67e306f221" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zmninja/1-4-007-and-some-updates-6e67e306f221">1.4.007 and some updates</a> was originally published in <a href="https://medium.com/zmninja">zmNinja</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Live Notifications: It’s all about context]]></title>
            <link>https://medium.com/zmninja/live-notifications-its-all-about-context-f5ab9a68fe13?source=rss-9f5490edda4f------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5ab9a68fe13</guid>
            <category><![CDATA[live-notifications]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[mobile]]></category>
            <category><![CDATA[zmninja]]></category>
            <category><![CDATA[zoneminder]]></category>
            <dc:creator><![CDATA[oZoneDev]]></dc:creator>
            <pubDate>Fri, 20 Mar 2020 15:18:31 GMT</pubDate>
            <atom:updated>2020-03-22T20:16:32.656Z</atom:updated>
            <content:encoded><![CDATA[<h3>Live Notifications: It’s all about context (iOS Only)</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FgZEBpuOkPuydi%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fanimation-animated-free-gZEBpuOkPuydi&amp;image=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FgZEBpuOkPuydi%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="294" frameborder="0" scrolling="no"><a href="https://medium.com/media/55e705024d8661c1acb56f23b7267f59/href">https://medium.com/media/55e705024d8661c1acb56f23b7267f59/href</a></iframe><p><strong>(Note: Animation in notifications is only supported on IOS. Android doesn’t seem to support it)</strong></p><p>Usability is all about more <em>meaningful</em> context. In the <a href="https://medium.com/zmninja/hypercharging-push-notifications-with-pushover-and-others-23ed9ab706?source=collection_home---4------0-----------------------">last post</a> we discussed how the ES was enhanced to hypercharge push notifications by allowing integrations with 3rd party push servers that are dedicated to providing a better notification experience. Well, now we have more more:</p><p><strong>Live Notifications</strong></p><p>We all get notifications from many apps, some with images. But zmNinja is a home security app. What if we could take a step forward and send out a quick animation of the alarm, right into the notification? Sure, you can always tap a notification, open zmNinja, wait for it to retrieve the right event and then play the full event while you drag the scroll bar around looking for the alarmed spot. But what if you did not need to do that, and the notification message contains the context you need to see? And then if it looks like it warrants a deeper dive, by all means, tap on it and inspect in-app.</p><p>That is what live notifications are all about. The image above gives you an example, but here is a flow with more detail. You will see two notifications:</p><ul><li>The first one is a GIF animation delivered via pushover (They don’t do MP4 as of today)</li><li>The second one is a MP4 animation delivered by zmNinja.</li></ul><p>Both are live notifications generated by the new ES version (5.11).</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FEb8e7cIXMKM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DEb8e7cIXMKM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FEb8e7cIXMKM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/af7434f2d02ba3b475045daa0e6df615/href">https://medium.com/media/af7434f2d02ba3b475045daa0e6df615/href</a></iframe><p>Live notifications is a new feature that <strong>requires</strong>:</p><ul><li>zmNinja 1.3.091 or above</li><li>ZM 1.35 or above (built after Mar 16, 2020)</li><li>ES 5.11 and above</li></ul><p>ES 5.11 introduces an [animation] section in objectconfig.ini that lets you customize the parameters of the animation. You should read that section properly in the same objectconfig.ini provided, but I should mention a few things:</p><ul><li>You can decide if you want the ES to create GIF or MP4 animations, or both. You do that with the animation_types attribute.</li><li>MP4s generate small videos while GIFs are large (even after optimization). Due to this when you see live notifications via MP4 you’ll notice they are longer than the GIF variant. On average, GIF animations are a max of 4 seconds (i.e. +- 2 seconds around the triggered frame) while MP4 animations are around a max of 10 seconds (i.e +- 5 seconds around the triggered frame). Of course the total duration depends on how many frames have been written to disk by ZM by the time the ES gets to creating the video. Remember, this notification is being sent <em>while the event is being recorded and is triggered when the event first starts.</em></li><li>Mobile devices only give a very limited time to download the animation as well as a maximum file size. In the case of iOS it is 30 seconds to download and 5MB. So if you are not seeing images, play with the animation parameters and make sure the file size is small. In my tests, I did not get images if the file size exceeded 2MB in iOS. Go figure.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5ab9a68fe13" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zmninja/live-notifications-its-all-about-context-f5ab9a68fe13">Live Notifications: It’s all about context</a> was originally published in <a href="https://medium.com/zmninja">zmNinja</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hypercharging push notifications with PushOver (and others)]]></title>
            <link>https://medium.com/zmninja/hypercharging-push-notifications-with-pushover-and-others-23ed9ab706?source=rss-9f5490edda4f------2</link>
            <guid isPermaLink="false">https://medium.com/p/23ed9ab706</guid>
            <category><![CDATA[home-security]]></category>
            <category><![CDATA[notifications]]></category>
            <category><![CDATA[cctv]]></category>
            <category><![CDATA[zoneminder]]></category>
            <category><![CDATA[pushover]]></category>
            <dc:creator><![CDATA[oZoneDev]]></dc:creator>
            <pubDate>Sun, 08 Mar 2020 13:24:25 GMT</pubDate>
            <atom:updated>2020-03-08T23:25:38.399Z</atom:updated>
            <content:encoded><![CDATA[<h3>Hypercharging push notifications with Pushover (and others)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*cEjSdJkOwQXoGkm8YrEZqQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@lopezrobin?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Lopez Robin</a> on <a href="https://unsplash.com/s/photos/power?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Starting ES 5.9.9, I now support a mechanism were you can deliver push notifications via 3rd party push systems. I’ve been asked to support it for a while now but never got around to doing it. To be honest, I never quite saw a value, since zmNinja already supports push. However, I realized much later that there are many use-cases for push notifications that zmNinja/ES does <em>not </em>support today, that users want, which include:</p><ul><li>Critical Notifications</li><li>Quiet Times</li><li>Dekstop Notifications</li><li>and lots more</li></ul><p>Github user tarheele recently <a href="https://github.com/tarheele/zminstantnotify/blob/master/zminstantnotify-actions.pl">wrote a script</a> to support <a href="https://pushover.net/">pushover</a> (a popular 3rd party push server) for his own needs which motivated me to take a look at why people really use pushover. There are many 3rd party push solutions, but when I actually tried pushover, I was impressed:</p><ul><li>It’s <a href="https://pushover.net/pricing">pricing</a> (yeah it is not free) is very attractive. It is a one time cost of USD 5 per platform. No more fees. This gets you 7500 messages a month which is a lot.</li><li>What it does is it has its own mobile client, that receives push. It is not a fancy client, it’s intended just to receive pushes and view them. The good part is the client can be customized for many things on how pushes are delivered.</li><li>The part that I found super useful is it also provides a <a href="https://pushover.net/clients/desktop">desktop solution</a>. Basically, it delivers push notifications to your desktop as well if you want. Furthermore, if you are using MacOS (which I do), it can deliver push notifications without your browser being open. For other platforms, your browser needs to be loaded.</li></ul><p>So I promptly bought two license for pushover, one for my iOS platform (so I can install it on my iPad and iPhone) and one for my desktop. I really only needed desktop, but wanted to try out both.</p><p><strong>Desktop Notifications</strong></p><p>First, my real usecase — desktop notifications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*erUwwBd7OcYcRtIMnyo5aQ.png" /><figcaption>Desktop notifications</figcaption></figure><p>That is my desktop, showing notifications of all my alarms. This is my zmeventnotification.ini config to support pushover:</p><pre>[fcm]<br># Use FCM for messaging (default: yes).<br>enable = yes</pre><pre>[push]<br>use_api_push = yes<br>api_push_script =  /var/lib/zmeventnotification/bin/pushapi_pushover.py</pre><pre>[hook]<br>event_start_notify_on_hook_success = all<br>event_end_notify_on_hook_success = api</pre><p>Let’s parse the above:</p><ul><li>I’ve enabled FCM — this means the ES will send pushes via FCM to the zmNinja app. You can choose to disable this and only use 3rd party push, but then you’ll lose the ability to preview events on tap etc.</li><li>I’ve <em>also </em>enabled API push via pushover (Note that you need to run sudo ./install.sh to get the push scripts installed). So yes, I get duplicate notifications, one via FCM and one via Pushover for now. It’s fun.</li><li>Next up, I’ve also enabled notifications for event end, but for api (pushover) but not fcm</li></ul><p>What this means is when new events happen, they will be delivered to zmNinja and pushover. When new events finish, they will be delivered to pushover.</p><p><strong>Pushover Configuration</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GdRBnZtfjfKN9jk5cwRb9g.png" /></figure><p>If you see, in pushover, I’ve defined two clients, my iPhone and my Macbook. By default, if you send notifications via pushover, both of them will get it.</p><p>Note however, you don’t <em>have </em>to deliver it everywhere. You should customize param_dict in the <a href="https://github.com/pliablepixels/zmeventnotification/blob/master/pushapi_plugins/pushapi_pushover.py#L29-L36">pushover script</a> to include/exclude what you need. For example, if I only wanted to deliver this to my iPhoneX, I’d add a device:&quot;iphoneX&quot; to that dictionary (because that is what I’ve named my phone above). There are many more options. See <a href="https://pushover.net/api">here</a>.</p><p><strong>Customizing notifications</strong></p><p>As I mentioned, there are many customization options, including quiet time, ctitical notification support etc. Here are some options you can specify:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*sx5QUG8JPbbyK7gGt1OxzA.png" /></figure><p><strong>Caveats</strong></p><ul><li>Remember, pushover is a standalone system. So when you tap on notifications delivered by pushover, they get handled by pushover’s client, NOT zmNinja. For example, this is what happens when I tap on notifications from pushover — their client interface is loaded.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*D3AboAvYJKLag7av_k-zmA.png" /></figure><ul><li>If you are using OSX, and opt for the browser less notification (that is notification tray integration), then the notifications <em>will not</em> include images. It is a platform limitation, based on what the pushover folks told me. Tapping on it will show images because the browser client opens up.</li><li>If you are using Windows/Linux and want push notifications to desktop, your browser needs to be open, but I believe you will get images as well.</li></ul><p><strong>Beyond Pushover</strong></p><p>The entire concept of this new plugin is just to demonstrate what can be done. I provided a <a href="https://github.com/pliablepixels/zmeventnotification/blob/master/pushapi_plugins/pushapi_pushover.py">script for pushover</a>. Feel free to add your own.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=23ed9ab706" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zmninja/hypercharging-push-notifications-with-pushover-and-others-23ed9ab706">Hypercharging push notifications with PushOver (and others)</a> was originally published in <a href="https://medium.com/zmninja">zmNinja</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[pyzm: The Python ZoneMinder library you want]]></title>
            <link>https://medium.com/zmninja/pyzm-the-python-zoneminder-library-you-want-c1b1afe00bae?source=rss-9f5490edda4f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1b1afe00bae</guid>
            <category><![CDATA[home-assistant]]></category>
            <category><![CDATA[zoneminder]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[oZoneDev]]></dc:creator>
            <pubDate>Tue, 11 Feb 2020 20:50:21 GMT</pubDate>
            <atom:updated>2020-02-11T20:50:21.145Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*FXnh9HDTCj2H0aLNVs1dLw.png" /></figure><p>A few months ago, I developed <a href="https://pypi.org/project/pyzm/">pyzm</a> — an easy to use functional Python interface wrapper for ZoneMinder. This was mostly due to the fact that I need a pythonic way to interact with ZoneMinder. Not only did I want an API wrapper, but I also wanted to be able to tap into ZoneMinder’s logging system, Shared Memory and the Event server.</p><p>Thus pyzm was born, and with ZM 1.34, pyzm is now the <a href="https://zoneminder.readthedocs.io/en/1.34.2/api.html#api-wrappers">official</a> ZM python wrapper.</p><p>It really is very simple to use and has <a href="https://pyzm.readthedocs.io/en/latest/">full documentation</a>.</p><p>Here is a full example on how you go about retrieving events that had objects detected in them:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ce69dd6cea0e571877c94dae9a820a48/href">https://medium.com/media/ce69dd6cea0e571877c94dae9a820a48/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1b1afe00bae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/zmninja/pyzm-the-python-zoneminder-library-you-want-c1b1afe00bae">pyzm: The Python ZoneMinder library you want</a> was originally published in <a href="https://medium.com/zmninja">zmNinja</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>