{"id":1404,"date":"2024-08-05T12:00:00","date_gmt":"2024-08-05T19:00:00","guid":{"rendered":"https:\/\/letsbuildroboticswithshadow8472.com\/?p=1404"},"modified":"2024-08-05T03:09:10","modified_gmt":"2024-08-05T10:09:10","slug":"motioneye-one-step-closer-to-a-critter-cam","status":"publish","type":"post","link":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/2024\/08\/05\/motioneye-one-step-closer-to-a-critter-cam\/","title":{"rendered":"MotionEye: One Step Closer to a Critter Cam"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Good Morning from my Robotics Lab! This is Shadow_8472, and today I am revisiting my naughty critter cam again. Let\u2019s get started!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Project Recap<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Earlier this year, I spent a week learning about DietPi, a lightweight OS for \u201cSystem On a Chip\u201d computers &#8212; notably Raspberry Pi, and Motion, an open source home surveillance platform. These fit great into my Raspberry Pi 3B+. I burned out after getting it to stream video to a webpage.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Version numbers have marched on since, and updates were in order. Long story short, it was simpler to reinstall and relive the week in the span of one day. I set the standard \u201cnew install\u201d settings, and installed motion from within DietPi\u2019s \u201chedged garden.\u201d I copied a default config file at \/etc\/motion\/motion.conf to \/root (I am approaching this as a short-term\/low security project) and struggled against the documentation. It led me to mess with mmalcam_params when all I needed was:<\/p>\n\n\n\n<pre class=\"wp-block-verse\">rotate 180<br>webcontrol_localhost false<br>stream_localhost false<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">These lines rotate the image and unlock Motion\u2019s webUI.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">MotionEyeOS<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The final deciding factor to reinstall started when I came across a new command for listing ports Linux will respond on:<\/p>\n\n\n\n<pre class=\"wp-block-verse\">ss -list<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">I found port 8765 with a login I couldn\u2019t get in. Only after a total reinstall did I look up motionEye and find the default login is \u201cadmin\u201d with an empty password. It\u2019s a nice webUI, but it won\u2019t share the camera with motion proper, and it took me a while to cycle through the different options to find the feed. My favorite feature is that it passed the \u201cOops, it lost power\u201d test.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Push Notifications<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">MotionEye can run a commands when it sees something move, which can be anything from object detection to filter false positives to an automated squirt gun when it recognizes naughty behavior. My next major milestone though should be push notifications. On Linux, I can use notify-send over ssh, but I\u2019d need to research an equivalent way for it to show up on Windows, Mac, and Android for other family members. In the long run, it will be simpler to dust off my Discord bot skills and give a LAN address.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So, that\u2019s what I did. I made a bot that sends a hard coded message to a hard coded channel and closes itself as part of its startup function.<\/p>\n\n\n\n<pre class=\"wp-block-verse\">#!\/usr\/bin\/python3<br><br>import os<br>import discord<br><br>intents = discord.Intents.default()<br>client = discord.Client(intents=intents)<br><br>#On startup: send message to and close program<br>@client.event<br>async def on_ready():<br>channel = client.get_channel(&lt;channel_ID&gt;)<br>await channel.send(f\"Motion Detected!\\nhttp:\/\/192.168.0.50:8765\")<br>exit()<br><br>client.run('&lt;Bot_Login_Token&gt;')<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">MotionEye could run the bot once I placed it in \/mnt\/dietpi_userdata\/, gave it permission to execute, and ensured it belonged to the dietpi user. Before too long, I had notifications through Discord to check Motion, and the hardest part of deployment was turning on the Pi\u2019s power switch. For my \u201cShow &amp; Tell,\u201d my father and I rigged up a cat tower and an LED work light on a stand to watch the stairs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Takeaway<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This temporary setup remains incomplete. For starters, the Discord bot wastes around four seconds logging in. I will eliminate this delay once I can get a signal from MotionEye into a running bot. Also of concern is that I want the bot ignoring humans \u2013 which means object detection, a field I\u2019m not far into yet.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Final Question<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Am I missing anything obvious on my road map? Let me know in the comments below or on my <a href=\"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/discord-invite\/\" target=\"_blank\" rel=\"noreferrer noopener\">Socials<\/a>!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Good Morning from my Robotics Lab! This is Shadow_8472, and today I am revisiting my naughty critter cam again. Let\u2019s get started! Project Recap Earlier this year, I spent a week learning about DietPi, a lightweight OS for \u201cSystem On a Chip\u201d computers &#8212; notably Raspberry Pi, and Motion, an open source home surveillance platform. &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/2024\/08\/05\/motioneye-one-step-closer-to-a-critter-cam\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;MotionEye: One Step Closer to a Critter Cam&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[26],"tags":[344,391],"class_list":["post-1404","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi","tag-dietpi","tag-motioneye"],"_links":{"self":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/1404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/comments?post=1404"}],"version-history":[{"count":1,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/1404\/revisions"}],"predecessor-version":[{"id":1405,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/posts\/1404\/revisions\/1405"}],"wp:attachment":[{"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/media?parent=1404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/categories?post=1404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/letsbuildroboticswithshadow8472.com\/index.php\/wp-json\/wp\/v2\/tags?post=1404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}