<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>motion Archives - Tom Barbette</title>
	<atom:link href="https://perso.uclouvain.be/tom.barbette/tag/motion/feed/" rel="self" type="application/rss+xml" />
	<link>https://perso.uclouvain.be/tom.barbette/tag/motion/</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2017 11:09:25 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://perso.uclouvain.be/tom.barbette/wp-content/uploads/2022/04/cropped-logo-uclouvain-2021-barbette-32x32.png</url>
	<title>motion Archives - Tom Barbette</title>
	<link>https://perso.uclouvain.be/tom.barbette/tag/motion/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Home-Assistant : live camera feed and motion detection with a USB camera using motion</title>
		<link>https://perso.uclouvain.be/tom.barbette/home-assistant-live-camera-feed-and-motion-detection-with-a-usb-camera-using-motion/</link>
		
		<dc:creator><![CDATA[Tom Barbette]]></dc:creator>
		<pubDate>Fri, 30 Dec 2016 10:50:08 +0000</pubDate>
				<category><![CDATA[Domotic]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[detection]]></category>
		<category><![CDATA[motion]]></category>
		<category><![CDATA[pi]]></category>
		<category><![CDATA[raspberry]]></category>
		<category><![CDATA[raspberry-pi]]></category>
		<guid isPermaLink="false">http://queen.run.montefiore.ulg.ac.be/~barbette/?p=642</guid>

					<description><![CDATA[<p>I want to display my webcam feed on home assistant. That&#8217;s easy and well explained on home assistant&#8217;s website. However they do not tell how to implement a motion detection system at the same time. First step : set up the camera live feed as explained in the docs In your configuration.yaml [code]camera: &#8211; platform: &#8230; </p>
<p class="link-more"><a href="https://perso.uclouvain.be/tom.barbette/home-assistant-live-camera-feed-and-motion-detection-with-a-usb-camera-using-motion/" class="more-link">Continue reading<span class="screen-reader-text"> "Home-Assistant : live camera feed and motion detection with a USB camera using motion"</span></a></p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/home-assistant-live-camera-feed-and-motion-detection-with-a-usb-camera-using-motion/">Home-Assistant : live camera feed and motion detection with a USB camera using motion</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I want to display my webcam feed on home assistant. That&#8217;s easy and well explained on home assistant&#8217;s website. However they do not tell how to implement a motion detection system at the same time.</p>
<p>First step : set up the camera live feed as explained in the docs</p>
<p>In your configuration.yaml</p>
<p>[code]camera:<br />
  &#8211; platform: mjpeg<br />
    mjpeg_url: http://localhost:8081<br />
    name: Salon[/code]</p>
<p>Install motion :</p>
<p>[code]sudo apt-get install motion[/code]</p>
<p>Configure /etc/motion/motion.conf (change these values <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f642.png" alt="🙂" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>[code]daemon on<br />
stream_port 8081<br />
stream_quality 80<br />
stream_maxrate 12<br />
stream_localhost on[/code]</p>
<p>And then restart motion :</p>
<p>[code]sudo service motion restart[/code]</p>
<p>And home assistant, then the webcam should appear ! Yeah !</p>
<p>Now the motion detection. The method I took is to use the mqtt protocol. A binary sensor will be the state of motion detection, motion will publish updates to the given topic to say if motion is on or off, and home assistant will subscribe to it.</p>
<p>Add this in your HA configuration.yaml</p>
<p>[code]mqtt: #I pass the mqtt setup process<br />
broker: 127.0.0.1<br />
port: 1883<br />
client_id: home-assistant<br />
keepalive: 60<br />
protocol: 3.1</p>
<p>binary_sensor:<br />
&#8211; platform: mqtt<br />
state_topic: &#8220;living_room/cam1&#8221;<br />
name: cam1<br />
sensor_class: motion[/code]</p>
<p>Install mosquitto-clients :</p>
<p>[code]sudo apt-get install mosquitto-clients[/code]</p>
<p>The commande to start a motion event is :</p>
<p>[code]mosquitto_pub -r -i motion-cam1 -t &#8220;living_room/cam1&#8221; -m &#8220;ON&#8221; [/code]</p>
<p>-r sets the retain flag<br />
-i is just a client id<br />
-t is the topic, which should match the configuration in mqtt<br />
-m Sets the message content, ON for motion being detected, OFF for a still image.</p>
<p>Then we have to update motion.conf accordingly:</p>
<p>[code]on_event_start mosquitto_pub -r -i motion-cam1 -t &#8220;living_room/cam1&#8221; -m &#8220;ON&#8221;<br />
on_event_end mosquitto_pub -r -i motion-cam1 -t &#8220;living_room/cam1&#8221; -m &#8220;OFF&#8221;[/code]</p>
<p>And restart motion ! And it&#8217;s finished !</p>
<p>The post <a href="https://perso.uclouvain.be/tom.barbette/home-assistant-live-camera-feed-and-motion-detection-with-a-usb-camera-using-motion/">Home-Assistant : live camera feed and motion detection with a USB camera using motion</a> appeared first on <a href="https://perso.uclouvain.be/tom.barbette">Tom Barbette</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
