<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://blueirissoftware.com/forum/app.php/feed/topic/2780" />

	<title>Blue Iris</title>
	<subtitle>Blue Iris User Group</subtitle>
	<link href="https://blueirissoftware.com/forum/index.php" />
	<updated>2021-10-25T19:27:57+00:00</updated>

	<author><name><![CDATA[Blue Iris]]></name></author>
	<id>https://blueirissoftware.com/forum/app.php/feed/topic/2780</id>

		<entry>
		<author><name><![CDATA[varghesesa]]></name></author>
		<updated>2021-10-25T19:27:57+00:00</updated>

		<published>2021-10-25T19:27:57+00:00</published>
		<id>https://blueirissoftware.com/forum/viewtopic.php?p=11006#p11006</id>
		<link href="https://blueirissoftware.com/forum/viewtopic.php?p=11006#p11006"/>
		<title type="html"><![CDATA[Profiles and Schedules]]></title>

		
		<content type="html" xml:base="https://blueirissoftware.com/forum/viewtopic.php?p=11006#p11006"><![CDATA[
<span style="font-size:150%;line-height:116%">Introduction</span><br><br>Profiles and Schedules allow users to change BI functionality depending on time.  For example, maybe alerts to guards are turned on during off hours for cameras facing the front door and off during business hours.  <br><br>The <a href="https://youtu.be/XjDX5KfdHa0" class="postlink">Profiles and Schedules 101 webinar</a> walks through many of the common use cases to provide a holistic view on how to use these features.  <br><br>Similar to the other 101 series onboarding webinars, this webinar complements the corresponding section in the Help file, Shields, Profiles and Schedules.<br><br><br><span style="font-size:150%;line-height:116%"><strong class="text-strong"><a name="Geofencing">Geofencing</a></strong></span><br><br>Geofencing allows users to use their phone to switch profiles based on location.  For example, many users want to turn their indoor cameras off when entering the house and on when leaving the house.  If you prefer to watch instead of read, the <a href="https://www.youtube.com/watch?v=XjDX5KfdHa0" class="postlink">Profiles and Schedules webinar</a> walks through setting up Geofencing.  Geofencing is discussed at 1:00 hr into the webinar.<br><br>Below is a simple implementation of geofencing.<br><br><strong class="text-strong">Scenario</strong><br>Turn the shield to red (disarm BI) when user enters the house.  Turn shield to green (arm BI) when user leaves the house.  The webinar discusses switching profiles, a similar but more more challenging setup with profiles.<br><br><strong class="text-strong">Setup</strong><div style="margin-left:3em"><br><strong class="text-strong">BI Server</strong><div style="margin-left:3em"><br><strong class="text-strong">Enter / Exit Actions</strong><br>Global settings -&gt; Mobile devices tab.  Select a device.  <br>When the mobile app enters or leaves the geofence, the app notifies the server.  It does so by calling the functions set by the Enter / Exit geofence features.  Setup the mobile device to turn the Shield to red when exiting the geofence and green when entering the geofence.<br><br><div class="inline-attachment"><dl class="file"><dt class="attach-image"><img src="https://blueirissoftware.com/forum/download/file.php?id=2240" class="postimage" alt="profiles and schedules_geofence actions.png" onclick="viewableArea(this);" /></dt></dl></div><br><strong class="text-strong">Location settings</strong><br>For best results, use google maps or some other internet service to get the GPS coordinates for your home / office and manually set GPS coordinates.  Global settings-&gt;Schedule tab.  <strong class="text-strong">Latitude/Longitude values</strong>.  Help button has more details.  Not setting the server location correctly leads to inaccuracy and missed geo-fence updates.<br><br></div><strong class="text-strong">Mobile phone settings</strong><br><br>For geofence to work correctly, <strong class="text-strong">Always</strong> needs to be selected for Location services.  The screenshot also shows good phone settings for the app to work in general.<br><br><div class="inline-attachment"><dl class="file"><dt class="attach-image"><img src="https://blueirissoftware.com/forum/download/file.php?id=2241" class="postimage" alt="geofence phone settings.png" onclick="viewableArea(this);" /></dt></dl></div><br><strong class="text-strong">Mobile app settings</strong><br><br>Select the geofence radius.  50m generally provides good results for homes/offices.  <strong class="text-strong">When asked, select Server location, NOT Your current location.</strong>  If you followed steps above, the server location should be set correctly.<br><br>I also enable the geofence notifications.  I like knowing when the phone updates the geofence status.  <strong class="text-strong">Particularly good to enable when troubleshooting.</strong>  <br><br><div class="inline-attachment"><dl class="file"><dt class="attach-image"><img src="https://blueirissoftware.com/forum/download/file.php?id=2242" class="postimage" alt="Geofence app settings.png" onclick="viewableArea(this);" /></dt></dl></div><br>Example of geofence update notification on the phone.  <strong class="text-strong">If you do NOT receive these notifications when entering / leaving the home / office, then your phone is not providing location services to the BI app.</strong><br><br><div class="inline-attachment"><dl class="file"><dt class="attach-image"><img src="https://blueirissoftware.com/forum/download/file.php?id=2243" class="postimage" alt="app geofence notification .png" onclick="viewableArea(this);" /></dt></dl></div><br></div><strong class="text-strong">Debug logs</strong><br><br>The logs tell you what is happening behind the scenes.  After you leave/enter the home/office, visit the debug logs if your server is not updating.<br><br>In the mobile app go to the debug logs (? -&gt; debug log).<br>Hit the forward button (top right) and send an email to yourself with the logs.<br>Go to the email and scroll to the bottom.  Sometimes the logs are long and gmail will provide a link to go to the entire message.  Unfortunately the logs are chronological so the latest commands will exist at the bottom of the logs. <div style="margin-left:3em"><br><div class="inline-attachment"><dl class="file"><dt class="attach-image"><img src="https://blueirissoftware.com/forum/download/file.php?id=2244" class="postimage" alt="debug log_mail long.png" onclick="viewableArea(this);" /></dt></dl></div><br></div>Not sure what other mail servers/app do.  Regardless make sure you are at the bottom of the logs.  The timestamps will let you know.  For example the last event in the logs for me currently is:<br><div class="codebox"><p>Code: </p><pre><code>2021-20-12 7:36:13: http://10.0.0.5:7000/json &lt;-- {"result":"success","session":"120a393377c7609350e071d84b1d5b95"}</code></pre></div>7:36:13 corresponds close to the time of writing this article.<br><br>At 6:14 pm I left the house.  Mobile app identified so.<div style="margin-left:3em"><div class="codebox"><p>Code: </p><pre><code>2021-19-12 18:14:31: didExitRegion: Mabury Square</code></pre></div></div>Turn the shield to green using the LAN address.<div style="margin-left:3em"><div class="codebox"><p>Code: </p><pre><code>2021-19-12 18:14:31: http://10.0.0.5:7000/json --&gt; {cmd = geofence;inside = 0;session = 8837a256b21b0ea5510e1266e3e304e3;uuid = "35B6C6BB-5CAE-4FEC-92C8-6F60BA874CC2";}</code></pre></div></div>Turn the Shield to green using the WAN address<div style="margin-left:3em"><div class="codebox"><p>Code: </p><pre><code>2021-19-12 18:14:31: https://a444-99-57-143-35.ngrok.io/json --&gt; {cmd = geofence;inside = 0;session = 8837a256b21b0ea5510e1266e3e304e3;uuid = "35B6C6BB-5CAE-4FEC-92C8-6F60BA874CC2";}</code></pre></div></div>App confirms Shield was turned to green.<div style="margin-left:3em"><div class="codebox"><p>Code: </p><pre><code>2021-19-12 18:14:31: didDetermineState: 22021-19-12 18:14:31: https://a444-99-57-143-35.ngrok.io/json &lt;-- {"result":"success","session":"8837a256b21b0ea5510e1266e3e304e3"}2021-19-12 18:14:31: Geofence status updated successfully: Mabury Square2021-19-12 18:14:31: UNMutableNotificationContent</code></pre></div><br></div>Returned home at 8:34 pm.<div style="margin-left:3em"><div class="codebox"><p>Code: </p><pre><code>2021-19-12 20:34:25: didEnterRegion: Mabury Square</code></pre></div></div>Turn the Shield to red using the LAN address.<div style="margin-left:3em"><div class="codebox"><p>Code: </p><pre><code>2021-19-12 20:34:25: http://10.0.0.5:7000/json --&gt; {cmd = geofence;inside = 1;session = 72f5bf0d98256d676780c99020b467cd;uuid = "35B6C6BB-5CAE-4FEC-92C8-6F60BA874CC2";}</code></pre></div></div>Turn the Shield to red using the WAN address.<div style="margin-left:3em"><div class="codebox"><p>Code: </p><pre><code>2021-19-12 20:34:25: https://a444-99-57-143-35.ngrok.io/json --&gt; {cmd = geofence;inside = 1;session = 72f5bf0d98256d676780c99020b467cd;uuid = "35B6C6BB-5CAE-4FEC-92C8-6F60BA874CC2";}</code></pre></div></div>App confirms success in turning Shield to red.<div style="margin-left:3em"><div class="codebox"><p>Code: </p><pre><code>2021-19-12 20:34:25: didDetermineState: 12021-19-12 20:34:26: https://a444-99-57-143-35.ngrok.io/json &lt;-- {"result":"success","session":"72f5bf0d98256d676780c99020b467cd"}2021-19-12 20:34:26: Geofence status updated successfully: Mabury Square</code></pre></div></div>Turn the Shield to red using the WAN address (app always tries both addresses in case of failure).<div style="margin-left:3em"><div class="codebox"><p>Code: </p><pre><code>2021-19-12 20:34:26: UNMutableNotificationContent2021-19-12 20:34:53: didDetermineState: 12021-19-12 20:34:53: https://a444-99-57-143-35.ngrok.io --&gt; {cmd = geofence;inside = 1;session = 34e417dd1ca061fd06c843953cb0189e;}2021-19-12 20:34:53: https://a444-99-57-143-35.ngrok.io/json &lt;-- {"result":"success","session":"34e417dd1ca061fd06c843953cb0189e"}2021-19-12 21:18:45: didDetermineState: 12021-19-12 21:18:45: http://10.0.0.5:7000 --&gt; {cmd = geofence;inside = 1;session = 08fb4ab6675179c1299245835db04647;}</code></pre></div></div>Below are routine calls from the app to confirm state has not changed on the phone, i.e. app is still inside.<br>One check at 21:18:45.  Another at 21:31:23.<div style="margin-left:3em"><div class="codebox"><p>Code: </p><pre><code>2021-19-12 21:18:45: http://10.0.0.5:7000/json &lt;-- {"result":"success","session":"08fb4ab6675179c1299245835db04647"}2021-19-12 21:31:23: didDetermineState: 12021-19-12 21:31:23: http://10.0.0.5:7000 --&gt; {cmd = geofence;inside = 1;session = 37c64a3c0f882a0a5dad681e19b40b05;}2021-19-12 21:31:23: http://10.0.0.5:7000/json &lt;-- {"result":"success","session":"37c64a3c0f882a0a5dad681e19b40b05"}2021-20-12 7:36:13: didDetermineState: 12021-20-12 7:36:13: http://10.0.0.5:7000 --&gt; {cmd = geofence;inside = 1;session = 120a393377c7609350e071d84b1d5b95;}</code></pre></div></div><p>Statistics: Posted by <a href="https://blueirissoftware.com/forum/memberlist.php?mode=viewprofile&amp;u=521">varghesesa</a> — Mon Oct 25, 2021 7:27 pm</p><hr />
]]></content>
	</entry>
	</feed>
