﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel><title>Mads Kristensen</title>
<description>A blog about everything ASP.NET and ASP.NET Core as well as Visual Studio extensions such as Web Essentials.</description>
<generator>Miniblog.Core</generator>
<link>https://www.madskristensen.net/</link>
<item>
  <title>Receive a notification when the dishwasher finishes</title>
  <link>https://www.madskristensen.net/blog/receive-a-notification-when-the-dishwasher-finishes/</link>
  <description>&lt;p&gt;At our house, we use home automation for a lot of different things. One of them is the ability to get a quick overview of the state of our appliances such as the washer, dryer and dishwasher. That way we don’t accidentally forget to turn over the laundry or empty the dishwasher. &lt;/p&gt;  &lt;p&gt;A red tile on our dashboard means something is ready for us to take action on – in this case that would be emptying the dishwasher after it finishes. See &lt;a href="https://madskristensen.net/blog/the-dashboard-for-our-smart-home/"&gt;earlier blog post&lt;/a&gt; on how I built the dashboard below.&lt;/p&gt;  &lt;p&gt;&lt;img title="clip_image002" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" border="0" alt="clip_image002" src="https://madskristensen.net/posts/files/clip_image002_637201598987747999.jpg" width="845" height="528" /&gt;&lt;/p&gt;  &lt;p&gt;There are lots of &lt;a href="https://community.smartthings.com/search?q=laundry"&gt;tutorials&lt;/a&gt; on how to hook a “dumb” washer and dryer up to any home automation system, but I haven’t found any for the dishwasher that doesn’t involve figuring out how to hook up a &lt;a href="https://www.amazon.com/Z-Wave-Power-Switch-ZEN15-Humidifiers/dp/B07578W7KY"&gt;power meter&lt;/a&gt; to it. &lt;/p&gt;  &lt;p&gt;So, after a bit of trial and error I was able to do a highly accurate reporting mechanism using only a $20 multipurpose sensor that I had lying around. &lt;/p&gt;  &lt;h4&gt;The sensor&lt;/h4&gt;  &lt;p&gt;You need one or more sensors capable of sensing tilt, acceleration and temperature. I used the $20 &lt;a href="https://www.amazon.com/Samsung-SmartThings-Multipurpose-Sensor-GP-U999SJVLAAA/dp/B07F956F3B"&gt;Samsung Multipurpose sensor&lt;/a&gt; which integrates seamlessly into my SmartThings home automation system. &lt;/p&gt;  &lt;p&gt;Attach the sensor along the side of the dishwasher at a place where it doesn’t get in the way. My wife didn’t notice the sensor until I asked her to look several days later. &lt;/p&gt;  &lt;p&gt;&lt;img title="dishwasher-sensor" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" border="0" alt="dishwasher-sensor" src="https://madskristensen.net/posts/files/dishwasher-sensor_637201600770407300.png" width="600" height="729" /&gt;&lt;/p&gt;  &lt;p&gt;The key is that the sensor needs to be located such that it can measure the raise in temperature from inside the dishwasher as it runs through its heated drying cycle. For your dishwasher, it might be higher up or even underneath. &lt;/p&gt;  &lt;p&gt;Then go into the configuration of the sensor and specify it to be used on a garage door. &lt;/p&gt;  &lt;p&gt;&lt;img title="dishwasher-config" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" border="0" alt="dishwasher-config" src="https://madskristensen.net/posts/files/dishwasher-config_637201600775514433.png" width="600" height="812" /&gt;&lt;/p&gt;  &lt;p&gt;All that does is to use the tilt sensor to determine if it’s open or closed instead of the magnet. That way, you must open the dishwasher door all the way down to horizontal level before it registers as open. That’s what we want.&lt;/p&gt;  &lt;h3&gt;The automation logic&lt;/h3&gt;  &lt;p&gt;I’ve created a virtual switch called &lt;i&gt;Dishwasher&lt;/i&gt; that I use to store the state of the dishwasher cycles which is what I use for the dashboard. It’s turned on when the dishwasher finishes and turned back off once it’s emptied. &lt;/p&gt;  &lt;p&gt;It uses the fact that a bit of vibration occurs early on in the cycle, and temperature rapidly dropping after it finishes. The name of the multipurpose sensor is &lt;i&gt;Dishwasher Sensor&lt;/i&gt;. Here’s the logic:&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;img title="dishwasher-piston" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" border="0" alt="dishwasher-piston" src="https://madskristensen.net/posts/files/dishwasher-piston_637201600780904464.png" width="600" height="783" /&gt;&lt;/p&gt;  &lt;p&gt;Notice how it uses the variable &lt;i&gt;isRunning&lt;/i&gt; to keep track on when the dishwasher is running.&lt;/p&gt;  &lt;p&gt;That’s it. Pretty simple, but it may require a bit of trial and error on where to place the sensor on the dishwasher door.&lt;/p&gt;</description>
  <author>test@example.com</author>
  <category>home automation</category>
  <guid isPermaLink="false">https://www.madskristensen.net/blog/receive-a-notification-when-the-dishwasher-finishes/</guid>
  <pubDate>Wed, 18 Mar 2020 20:25:05 GMT</pubDate>
</item>
<item>
  <title>Hiding electronics behind fake books</title>
  <link>https://www.madskristensen.net/blog/hiding-electronics-behind-fake-books/</link>
  <description>&lt;p&gt;After showing some pictures of our &lt;a href="https://madskristensen.net/blog/the-dashboard-for-our-smart-home/"&gt;smart home dashboard&lt;/a&gt;, questions started coming in about the cables going in behind the books. Where is the modem and what else is going on? Spoiler alert, the books are fake. &lt;/p&gt;  &lt;p&gt;Here you see a couple of cables going in behind the books on the top shelve.&lt;/p&gt;  &lt;p&gt;&lt;img title="fake books 1" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" border="0" alt="fake books 1" src="https://madskristensen.net/posts/files/fake%20books%201_637161973355565458.jpg" width="1024" height="850" /&gt;&lt;/p&gt;  &lt;p&gt;Removing the books reveal a tangled mess of cords, power bricks, a modem, and a home automation hub.&lt;/p&gt;  &lt;p&gt;&lt;img title="fake books 2" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" border="0" alt="fake books 2" src="https://madskristensen.net/posts/files/fake%20books%202_637161973364015977.jpg" width="1010" height="844" /&gt;&lt;/p&gt;  &lt;p&gt;The fake books are hollow and can hold quite the amount of stuff, as you can see below. Looking at the books from above shows just how simple they’re built.&lt;/p&gt;  &lt;p&gt;&lt;img title="fake books 3" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" border="0" alt="fake books 3" src="https://madskristensen.net/posts/files/fake%20books%203_637161973370084489.jpg" width="1024" height="545" /&gt;&lt;/p&gt;  &lt;p&gt;This is easy to make yourself if you can find some decorative books you like. You can also buy it (&lt;a href="https://www.amazon.com/Covobox-electronics-outlets-documents-original/dp/B074PDZLQX/"&gt;Covobox on Amazon&lt;/a&gt;) and customize the size (width) and the colors of the books. For reference, we got the 14 inch one and that is probably the smallest I would recommend. &lt;/p&gt;  &lt;p&gt;We’ve had this for a couple of years, and it holds up great.&lt;/p&gt;</description>
  <author>test@example.com</author>
  <category>home automation</category>
  <guid isPermaLink="false">https://www.madskristensen.net/blog/hiding-electronics-behind-fake-books/</guid>
  <pubDate>Sat, 01 Feb 2020 23:42:17 GMT</pubDate>
</item>
<item>
  <title>The dashboard for our smart home</title>
  <link>https://www.madskristensen.net/blog/the-dashboard-for-our-smart-home/</link>
  <description>&lt;p&gt;I’ve had some questions lately about how we keep track of all the home automation devices spread across the house. So, I thought I’d share how our dashboard is set up. The dashboard is the web-based &lt;a href="https://sharptools.io/"&gt;SharpTools&lt;/a&gt; that runs in &lt;a href="https://www.ozerov.de/fully-kiosk-browser/"&gt;Fully Kiosk Browser&lt;/a&gt; on an &lt;a href="https://www.amazon.com/dp/B07KD6BTCZ"&gt;Amazon Fire Tablet HD 10&lt;/a&gt; which is magnetically attached to the wall. &lt;/p&gt;  &lt;p&gt;&lt;a href="https://madskristensen.net/posts/files/20200130_165855165_iOS_637160068674899332.jpg"&gt;&lt;img title="20200130_165855165_iOS" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" border="0" alt="20200130_165855165_iOS" src="https://madskristensen.net/posts/files/20200130_165855165_iOS_thumb_637160068681994799.jpg" width="1280" height="956" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Since it hangs so close to shelving, the charging cable is nicely hidden, so we didn't need to install additional electrical outlets behind the tablet.&lt;/p&gt;  &lt;p&gt;&lt;a href="https://madskristensen.net/posts/files/20200130_165901366_iOS_637160068686605643.jpg"&gt;&lt;img title="20200130_165901366_iOS" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" border="0" alt="20200130_165901366_iOS" src="https://madskristensen.net/posts/files/20200130_165901366_iOS_thumb_637160068691533235.jpg" width="1280" height="956" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Though the tiles looked blue above due to lighting and old phone camera, all tiles are actually gray, and red is used for the ones that need our attention when certain events occur - like when the washer is done and we need to move the clothes to the dryer. This helps keep the visual noise to a minimum and the red is really easy to see from across the room.&lt;/p&gt;    &lt;p&gt;The bottom row is half way below the fold and we utilize this for both navigation to other dashboard (the left 3 bottom tiles) and some infrequent commands. The calendar is well suited for being cut off since it easily scrolls to reveal future calendar entries without scrolling the whole screen.&lt;/p&gt;  &lt;p&gt;&lt;a href="https://madskristensen.net/posts/files/20200130_040848334_iOS_637160068695832579.jpg"&gt;&lt;img title="20200130_040848334_iOS" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" border="0" alt="20200130_040848334_iOS" src="https://madskristensen.net/posts/files/20200130_040848334_iOS_thumb_637160068700727722.jpg" width="1280" height="794" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The first sub-dashboard is for the lights around the house. We use orange as a neutral color instead of green/red or similar. That's because it is neither good nor bad if a light is on or off. So orange in this case just means that something is active or on.&lt;/p&gt;  &lt;p&gt;&lt;a href="https://madskristensen.net/posts/files/20200130_040906613_iOS_637160068706563715.jpg"&gt;&lt;img title="20200130_040906613_iOS" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" border="0" alt="20200130_040906613_iOS" src="https://madskristensen.net/posts/files/20200130_040906613_iOS_thumb_637160068712057096.jpg" width="1280" height="794" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The second sub-dashboard tell us the status of more security related information. It tells us what external doors and windows are open, if the door is locked, the cameras armed and who's home.&lt;/p&gt;  &lt;p&gt;&lt;a href="https://madskristensen.net/posts/files/20200130_145903231_iOS_637160068716826729.jpg"&gt;&lt;img title="20200130_145903231_iOS" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" border="0" alt="20200130_145903231_iOS" src="https://madskristensen.net/posts/files/20200130_145903231_iOS_thumb_637160068721040256.jpg" width="1280" height="794" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;It also has a link to a sub-sub-dashboard for showing battery status of our various devices. This uses the Battery Tile and will change color as the battery levels get below 30% and again below 10%. None of my devices are low on battery - thanks to this dashboard.&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;a href="https://madskristensen.net/posts/files/20200130_150015824_iOS_637160068725228694.jpg"&gt;&lt;img title="20200130_150015824_iOS" style="display: inline; background-image: none;" border="0" alt="20200130_150015824_iOS" src="https://madskristensen.net/posts/files/20200130_150015824_iOS_thumb_637160068729956912.jpg" width="1284" height="804" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The third sub-dashboard is temperature and weather information from around the house.&lt;/p&gt;  &lt;p&gt;&lt;a href="https://madskristensen.net/posts/files/20200130_041009032_iOS_637160068747908242.jpg"&gt;&lt;img title="20200130_041009032_iOS" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" border="0" alt="20200130_041009032_iOS" src="https://madskristensen.net/posts/files/20200130_041009032_iOS_thumb_637160068756270625.jpg" width="1280" height="794" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;That’s it. I tried to keep it simple, but still containing all the information I need. What do you think?&lt;/p&gt;</description>
  <author>test@example.com</author>
  <category>home automation</category>
  <guid isPermaLink="false">https://www.madskristensen.net/blog/the-dashboard-for-our-smart-home/</guid>
  <pubDate>Thu, 30 Jan 2020 18:18:23 GMT</pubDate>
</item>
<item>
  <title>Home automation sensors</title>
  <link>https://www.madskristensen.net/blog/home-automation-sensors/</link>
  <description>&lt;p&gt;Motion, contact, and light sensors are the most commonly used sensors for home automations in my house. With these sensors, you can make a &lt;a href="https://madskristensen.net/blog/home-automation-ideas/"&gt;wide variety of automations&lt;/a&gt;. But there are so many different manufacturers, protocols, and price points that it can be hard to choose which devices to buy and use.&lt;/p&gt;
&lt;p&gt;When setting up automations, check out these set of &lt;a href="https://madskristensen.net/blog/home-automation-best-practices/"&gt;best practices&lt;/a&gt; to avoid common mistakes. It boils down to having automations that do the same thing as you (and your guests) would do before the automation existed. For instance, turn on the light when entering the bedroom, but not if it&amp;rsquo;s filled with sunlight.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sensor speed&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Before we dive in, I want to make a note about sensor speed. For lighting automations, speed is usually the most important factor to consider. When entering a dark room, most people instinctively reach for the light switch. It&amp;rsquo;s in their muscle memory.&lt;/p&gt;
&lt;p&gt;When a lighting automation is slow, that muscle memory triggers, and they reach for the switch. Just before pressing the switch, the automation turned on the light, so they end up turning the light switch off.&lt;/p&gt;
&lt;p&gt;When the lighting automation is super-fast, that muscle memory never triggered in the first place and the automation feels magical.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;When using Samsung SmartThings hub, make sure to run all your lighting automations in the Smart Lighting SmartApp. For all involved devices (usually switches/bulbs + sensors) make sure they use local device handlers. Then the automation will execute locally without accessing the internet. The speed difference from local to internet execution is significant.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I&amp;rsquo;m not affiliated with any manufacturer or reseller. I&amp;rsquo;ve tried enough sensors to give me an idea about which ones work better than others for my needs. You might have a different experience or know of sensors that I haven&amp;rsquo;t tried. In that case, please share that in the comments below.&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-weight: normal;"&gt;Motion sensors&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;The most important factors to consider when buying a motion sensor are speed, battery life, and design.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Zigbee vs. Z-Wave&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Of all the sensors I&amp;rsquo;ve tried, the Zigbee ones are the fastest. I don't know why that is, but &lt;a href="https://community.smartthings.com/t/faq-where-to-locate-motion-sensor-for-fastest-response/55798/6"&gt;others have experienced the same thing&lt;/a&gt;. So, for automations where speed is important such as turning lights on when entering a room, I would go with a Zigbee device every single time. The difference in speed is very noticeable.&lt;/p&gt;
&lt;p&gt;For automations where speed isn&amp;rsquo;t as important, such as for detecting when motion has stopped, then battery life and design matters more.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Placements&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Motion sensors look a little bit like small spy cams, so I try to make them as invisible as I can to not freak out my guests. Especially the ones placed in the bathrooms. Good places to but them are corners just below the ceiling.&lt;/p&gt;
&lt;p&gt;For super-fast detection when someone enters a room, place the motion sensor on the ceiling close to the wall directly above the door pointing downwards.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Which one to get&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;If I could have only a single type of motion sensor, I would choose the &lt;a href="https://www.amazon.com/gp/product/B07F8ZHBLS/"&gt;Samsung SmartThings Motion Sensor&lt;/a&gt;. It magnetically attaches to its base and the battery life is superb.&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-weight: normal;"&gt;Contact sensors&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;Also known as door/window sensors. This type of sensor consists of 2 pieces &amp;ndash; a magnet and a sensor. When the magnet moves away from the sensor, it&amp;rsquo;s in its &amp;ldquo;open&amp;rdquo; state and when they are together it&amp;rsquo;s &amp;ldquo;closed&amp;rdquo;. Again speed, battery life, and design are the most important features to consider.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Zigbee vs. Z-Wave&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Just like with the motion sensor, speed can be the deciding factor. If opening a door should trigger the lights to come on, then Zigbee is the way to go. For everything else, battery life and design are more important. For me, that means I use Zigbee devices for doors and Z-Wave devices with larger batteries for windows.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Placements&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For doors, place them on the side of the door that is away from the main areas in the house. For instance, put them inside the closet where nobody can see them when closed. Put them on the bedroom side of the door instead of the hallway side.&lt;/p&gt;
&lt;p&gt;For windows, place them where they are hardest to see. You can&amp;rsquo;t really hide them.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Color&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Some manufacturers make different colored sensors. Try to match the color of the sensor with that of where you put them. This makes them more invisible.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Which one to get&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For doors, I use the &lt;a href="https://www.amazon.com/gp/product/B06XDJ3KYC/"&gt;Visonic MCT-340 E&lt;/a&gt; which is super-fast and relatively small compared to most other contact sensors. For windows or other places where speed isn&amp;rsquo;t an issue and battery life matters more, the &lt;a href="https://www.amazon.com/dp/B079MB2FQN/"&gt;NEO Z-Wave sensor&lt;/a&gt; is great. My shower door has a brown metal frame, so for that I use the slightly bigger &lt;a href="https://www.amazon.com/dp/B01N5HB4U5/"&gt;Z-Wave Rare Earth Magnet sensor&lt;/a&gt; which comes in brown.&lt;/p&gt;
&lt;h2&gt;&lt;span style="font-weight: normal;"&gt;Light sensors&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;With a light or illuminance sensor, we can adjust our automation based on the amount of light present in the room. That way we can avoid turning on the lights when the room is already filled with sunlight. Or we can adjust the dimming level of a light switch to the amount of light presently in the room.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Zigbee vs. Z-Wave&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;For me, it usually comes down to speed. In this case, it probably doesn&amp;rsquo;t matter since light measurement isn&amp;rsquo;t done in real-time but usually captured every 1-5 minutes depending on the sensor. So, battery life and design are more important to consider than speed.&lt;/p&gt;
&lt;p&gt;Usually, light sensors don&amp;rsquo;t come as standalone sensors, but as part of multi-sensors that also does motion and temperature sensing. At the time of writing, I have yet to find a light sensor that also has a super-fast motion sensor.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Placements&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;You could place a light sensor in each room, but that would most likely be overkill. Unless you already have a multi-sensor in the rooms with light sensing capabilities. Instead, what I&amp;rsquo;ve done is to place one sensor on each side of the house. So, no matter what room I automate, I know the amount of light coming to the windows on that side of the house.&lt;/p&gt;
&lt;p&gt;Place them in the window close to the glass so curtains don&amp;rsquo;t get in between them and the window itself.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Which one to get&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I use the &lt;a href="https://www.amazon.com/dp/B01M1NBH3D/"&gt;Dome Z-Wave Motion/Light sensor&lt;/a&gt; because it is relatively cheap and gives consistent light level readings. It&amp;rsquo;s important to notice that I don&amp;rsquo;t use the motion sensor in this device at all. It&amp;rsquo;s too slow and it doesn&amp;rsquo;t allow me to place it in the best position for light sensing.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;When using SmartThings Hub, use the &lt;em&gt;Z-Wave Temp/Light Sensor&lt;/em&gt; device handler for this sensor. It allows it to run locally.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I hope you found this helpful. Remember to check out more &lt;a href="https://madskristensen.net/blog/home-automation-ideas/"&gt;home automation ideas&lt;/a&gt; and the &lt;a href="https://madskristensen.net/blog/home-automation-best-practices/"&gt;best practices&lt;/a&gt;.&lt;/p&gt;</description>
  <author>test@example.com</author>
  <category>home automation</category>
  <guid isPermaLink="false">https://www.madskristensen.net/blog/home-automation-sensors/</guid>
  <pubDate>Tue, 16 Apr 2019 15:22:59 GMT</pubDate>
</item>
<item>
  <title>Home automation ideas</title>
  <link>https://www.madskristensen.net/blog/home-automation-ideas/</link>
  <description>&lt;p&gt;Here are a bunch of home automation ideas for your inspiration. These are examples of automation rules that have worked well for my family. They might work well for yours too.&lt;/p&gt;  &lt;p&gt;The ideas are technology agnostic and describe the concept rather than the exact implementation. They should work with just about any home automation system and they all adhere to the &lt;a href="https://madskristensen.net/blog/home-automation-best-practices/"&gt;home automation best practices&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Let’s dig in.&lt;/p&gt;  &lt;h2&gt;Modes&lt;/h2&gt;  &lt;p&gt;Most home automation systems have the notion of modes. Typically, the names of these modes are &lt;i&gt;Home&lt;/i&gt;, &lt;i&gt;Away&lt;/i&gt; and &lt;i&gt;Night&lt;/i&gt;, but there can be variations and some system let you add additional modes. You can use these modes as conditions for the home automation rules. For example, when the mode is set to &lt;i&gt;Night&lt;/i&gt;, turn on lights on low dim in the kitchen when motion is detected.&lt;/p&gt;  &lt;p&gt;When set properly, modes are useful in many automations.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Night&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Manually set house in &lt;i&gt;Night&lt;/i&gt; mode&lt;/li&gt;    &lt;li&gt;Automatic detection&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Set the mode to &lt;i&gt;Night&lt;/i&gt; when clicking a physical button or switch. A voice assistant could also trigger it when you say “goodnight”. Physical buttons are often easier to use than a voice assistant and works when offline.&lt;/p&gt;  &lt;p&gt;Setting &lt;i&gt;Night&lt;/i&gt; mode could trigger the following events:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Turn off lights in the kitchen, living room and elsewhere &lt;/li&gt;    &lt;li&gt;Turn off media – music, TV etc.&lt;/li&gt;    &lt;li&gt;Lock the exterior doors if unlocked&lt;/li&gt;    &lt;li&gt;Close the garage door if open&lt;/li&gt;    &lt;li&gt;Arm the alarm system&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;b&gt;Home&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;There are two scenarios for when you want to trigger &lt;i&gt;Home&lt;/i&gt; mode. The first is when you get out of bed in the morning and the second is when you come home to an empty house after having been away.&lt;/p&gt;  &lt;p&gt;In the morning, press a physical button or switch or say “good morning” to your voice assistant. The button/switch could be the same one that put the house into &lt;em&gt;Night&lt;/em&gt; mode. &lt;/p&gt;  &lt;p&gt;After being away, unlocking the front door, opening the garage door or simply the detection of motion can put the house back in &lt;i&gt;Home&lt;/i&gt; mode automatically.&lt;/p&gt;  &lt;p&gt;Setting &lt;i&gt;Home&lt;/i&gt; mode could trigger the following events:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Turn on lights if dark inside&lt;/li&gt;    &lt;li&gt;Play music&lt;/li&gt;    &lt;li&gt;Turn on thermostat to cool or heat the house&lt;/li&gt;    &lt;li&gt;Turn on indoor holiday decorations&lt;/li&gt;    &lt;li&gt;Dock the robot vacuum&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;b&gt;Away&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;This mode should be set when everybody leaves the house, and nobody is home. Saying “goodbye” to the voice assistant is one way to set it, but it should really happen automatically instead. That way you never forget it and don’t have to worry about it.&lt;/p&gt;  &lt;p&gt;Automatic detection could happen this way:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;House is in &lt;i&gt;Home&lt;/i&gt; mode &lt;/li&gt;    &lt;li&gt;No motion detected in the house for 10 minutes&lt;/li&gt;    &lt;li&gt;All phones or presence sensors report they are not home&lt;/li&gt;    &lt;li&gt;No one is taking a nap in the house&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Detecting someone napping during the daytime can be hard. We use white noise machines in the kids’ room for when they nap, so we use a power meter to detect when it’s on. When on, the house doesn’t go into &lt;i&gt;Away&lt;/i&gt; mode. If you don’t use a white noise machine, a night/salt/lava lamp or similar will work just as well.&lt;/p&gt;  &lt;p&gt;If you wish to know when the mode changes between &lt;i&gt;Home&lt;/i&gt; and &lt;i&gt;Away&lt;/i&gt;, send a push notification to your phone if your system supports it. &lt;/p&gt;  &lt;p&gt;Setting &lt;i&gt;Away&lt;/i&gt; mode could trigger the following events:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Lock all exterior doors if unlocked&lt;/li&gt;    &lt;li&gt;Close garage door if left open&lt;/li&gt;    &lt;li&gt;Turn off all lights, fans, and appliances in the house&lt;/li&gt;    &lt;li&gt;Start the robot vacuum&lt;/li&gt;    &lt;li&gt;Put the thermostat in “eco” mode&lt;/li&gt;    &lt;li&gt;Between sunset and midnight, turn on away-lights&lt;/li&gt;    &lt;li&gt;Arm the alarm system&lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Bathroom&lt;/h2&gt;  &lt;p&gt;This is for bathrooms that have both a tub or shower and a toilet.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Lights&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Turn on lights when someone enters&lt;/li&gt;    &lt;li&gt;Turn off lights when everyone leaves&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;b&gt;Fan&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Turn on fan when door closes&lt;/li&gt;    &lt;li&gt;Turn off fan after 15 minutes&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Use a motion sensor to turn on the lights when someone enters the bathroom. Use a door sensor to detect when the door is closed. When closed, the lights must not turn off automatically. That ensures that the lights don’t turn off while you’re in the shower or taking your time on the toilet.&lt;/p&gt;  &lt;p&gt;The fan turns on automatically when the door closes and turns off again after 15 minutes.&lt;/p&gt;  &lt;p&gt;When in &lt;i&gt;Night&lt;/i&gt; mode, the lights should only come on at a low dim.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Shower door&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;This is if you have a dedicated light just for the shower.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Turn on shower lights and bathroom fan when shower door opens&lt;/li&gt;    &lt;li&gt;When shower lights are on, don’t turn off any other bathroom lights&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;If you have a glass shower door, add a door sensor too it. When the door opens, turn on the shower lights and fan. Turn off lights and fan after 15 minutes. &lt;/p&gt;  &lt;h2&gt;Garage&lt;/h2&gt;  &lt;p&gt;Whether you park your car in the garage or use it for storage or workspace, here are some automations that apply to all scenarios.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Lights&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Turn on when someone enters&lt;/li&gt;    &lt;li&gt;Turn off after the last person leaves &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Add one or more motion sensors to cover the whole garage. When motion is detected, turn on the lights. When no motion was detected for 1 minute, turn off the lights. Depending on the location and speed of the motion sensors, consider adding a door sensor to the internal door that triggers the lights upon opening.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Door&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;When going to bed, close garage door if open&lt;/li&gt;    &lt;li&gt;When leaving the house, close garage door if open&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;When the home automation system goes into &lt;i&gt;Night&lt;/i&gt; or &lt;i&gt;Away&lt;/i&gt; mode, check if the garage door is open and then close it.&lt;/p&gt;  &lt;h2&gt;Hallway closet&lt;/h2&gt;  &lt;p&gt;Some closets don’t have any lights or power outlets on the inside. The closest light source could be a ceiling light on the outside. Then we’ll use that in our automation.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Lights&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;When in &lt;i&gt;Home&lt;/i&gt; mode&lt;/li&gt;    &lt;li&gt;Turn lights on when door opens&lt;/li&gt;    &lt;li&gt;Turn lights off when door closes&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Add a door sensor that triggers the light to turn on and off when the door opens and closes, respectively. If the light is located outside the closet, you may want to check if it was on before opening the door, so the automation doesn’t turn it off when the door closes.&lt;/p&gt;  &lt;p&gt;“Dumb” battery powered LED lights with basic motion sensing capabilities are also useful. We use them in some closets that have no other light source or power outlet. &lt;/p&gt;  &lt;h2&gt;Walk-in closet&lt;/h2&gt;  &lt;p&gt;Typically, a small room full of clothes and a ceiling light. The door is probably left open all the time.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Lights&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Turn on when someone enters&lt;/li&gt;    &lt;li&gt;Turn off after the last person leaves &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Add a motion sensor above the door pointing slightly downwards so it covers the whole closet as well as the door entrance. When motion is detected, turn on the lights. When no motion was detected for 1 minute, turn off the lights.&lt;/p&gt;  &lt;p&gt;When in &lt;i&gt;Night&lt;/i&gt; mode, turn on the lights at a lower dim setting to not be blinded by the bright light.&lt;/p&gt;  &lt;h2&gt;Kids rooms&lt;/h2&gt;  &lt;p&gt;Our kids can’t reach the light switch in their rooms, so automated lighting was very important for us. Otherwise they would keep asking us to come turn on the lights for them.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Lights&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;When in &lt;i&gt;Home&lt;/i&gt; mode&lt;/li&gt;    &lt;li&gt;Turn on when someone enters&lt;/li&gt;    &lt;li&gt;Turn off after the last person leaves &lt;/li&gt;    &lt;li&gt;Turn off lights when white noise machine starts (nap/bedtime begins)&lt;/li&gt;    &lt;li&gt;Turn on lights at low dim setting when white noise machine is off&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Then slowly brighten lights over a 5-minute period&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;&lt;b&gt;Blinds&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Close blinds when white noise machine starts (nap/bedtime begins)&lt;/li&gt;    &lt;li&gt;Open blinds 10 minutes after white noise machine is off&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Motion sensor triggers lights on/off when someone enters and leaves the room. A power meter connected to the white noise machine triggers the lights off when turned on. Turning off the white noise machine should very slowly start to brighten the ceiling lights from the lowest dim setting.&lt;/p&gt;  &lt;p&gt;Use an illumination (light) sensor to detect how light it is in the room before turning on the light. There is no reason to turn on lights in a room full of sunlight.&lt;/p&gt;  &lt;h2&gt;Master bedroom&lt;/h2&gt;  &lt;p&gt;This room is notorious for being hard to automate. The reason is that there are so many usage scenarios that it is hard to identify patterns automatically. We tried automating the lights, but there would be times when that would be annoying. We made modifications and kept iterating until we came up with a simple rule that works:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;When in &lt;em&gt;Home&lt;/em&gt; mode&lt;/li&gt;    &lt;li&gt;And it is dark outside (no light coming in)&lt;/li&gt;    &lt;li&gt;Turn on &lt;b&gt;master&lt;/b&gt; &lt;b&gt;bathroom&lt;/b&gt; lights when someone enters bedroom&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Most of the time we enter the bedroom, it is to pass through into the master bathroom, which is also where the walk-in closet is. So, turning on the bathroom lights does light up the bedroom a bit, so we don’t have to walk in the dark. &lt;/p&gt;  &lt;h2&gt;Outside&lt;/h2&gt;  &lt;p&gt;Landscape lights are pretty, and they help you see the driveway when coming home at night.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Lights&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Turn on at sunset&lt;/li&gt;    &lt;li&gt;Turn off at sunrise&lt;/li&gt;    &lt;li&gt;Turn on additional driveway lights when car pulling in&lt;/li&gt;    &lt;li&gt;Turn on holiday lights at 30-60 minutes before sunset&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;You can buy “dumb” light switches with sunset/sunrise capability, but they are no fun and if you have multiple lights, then you can’t fully coordinate them. &lt;/p&gt;  &lt;p&gt;Hook up a motion sensor to trigger the driveway lights to guide the car in. Turn back off after 5 minutes of no motion detected.&lt;/p&gt;  &lt;h2&gt;Car&lt;/h2&gt;  &lt;p&gt;These days, the smart home includes the car.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Door lock&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Unlock front door when coming home&lt;/li&gt;    &lt;li&gt;Lock front door when leaving&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Place a presence sensor somewhere in your car(s) and automatically unlock the front door when you arrive home. Unless the garage door is open/opening. If the garage door is open/opening then you are probably going to enter the house through the garage, so no need to unlock the door.&lt;/p&gt;  &lt;h2&gt;Miscellaneous&lt;/h2&gt;  &lt;p&gt;Here are some additional automations that could apply to multiple rooms or the whole house.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Windows&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;When a window has been open for more than 1 minute, turn thermostat off&lt;/li&gt;    &lt;li&gt;When closing all windows, turn thermostat back on&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Add window sensors (same as door sensor) to all windows.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Night lights&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Turn on lights when motion is detected&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;In the kitchen, living room and elsewhere, turn on lights at a very low dim setting when motion is detected in &lt;i&gt;Night&lt;/i&gt; mode. Make sure it’s dim enough that it won’t wake up anyone sleeping in their rooms with the door open. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Door lock notifications&lt;/b&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Send notification when non-members of the household come and go&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Get a push notification when anyone that has their own code to your smart lock uses it. That helps you keep track of how long the house cleaners spent cleaning or if your parents came to drop that thing of you asked them to while you were at work.&lt;/p&gt;</description>
  <author>test@example.com</author>
  <category>home automation</category>
  <guid isPermaLink="false">https://www.madskristensen.net/blog/home-automation-ideas/</guid>
  <pubDate>Thu, 21 Mar 2019 15:18:19 GMT</pubDate>
</item>
<item>
  <title>Home automation best practices</title>
  <link>https://www.madskristensen.net/blog/home-automation-best-practices/</link>
  <description>&lt;p&gt;After having spent a lot of time and effort installing smart devices throughout my entire house and automating them, I&amp;rsquo;ve learned a lot of do&amp;rsquo;s and don&amp;rsquo;ts. It&amp;rsquo;s been a long process of trial and error to come up with the right automations that work for all scenarios. Along the way, certain patterns and practices emerged that made it easier for me to setup automations correctly the first time and sparked joy for everybody in my household.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve also come to believe that most of these practices are not specific to my household but are universal in nature and can be used by other home automation enthusiasts. Since I couldn&amp;rsquo;t find anything similar online, I thought I&amp;rsquo;d share these practices here in case you find them useful.&lt;/p&gt;
&lt;p&gt;Here we go:&lt;/p&gt;
&lt;h2&gt;Works for everybody&lt;/h2&gt;
&lt;p&gt;Every member of the household and guests must have a neutral to positive experience with the automations. Few things are more annoying than having lights turn off in the bathroom while you are in there or accidently triggering the alarm system&amp;rsquo;s siren while the baby is sleeping.&lt;/p&gt;
&lt;p&gt;Especially guests that are less familiar with any automations can be annoyed if not done correctly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;An example&lt;/strong&gt; would be our spare room which turns the lights on when you enter and turns it off after a minute of no motion. It works flawlessly for everyday use, but we also use it as an occasional guest room. My mom came to visit for 2 weeks and experienced having the lights go on and off at inconvenient times &amp;ndash; when taking a nap for instance. The automation wasn&amp;rsquo;t designed for that use pattern. The fix was to install a door sensor and disable all automations in the room when the door was closed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Another example&lt;/strong&gt; is our guest bathroom lights which automatically turn on when people enter. In the beginning, the placement of the motion sensor and the logic of the automation resulted in a short delay from entering until the lights came on. The consequence was that people&amp;rsquo;s muscle memory had them reaching for the light switch. But once clicked, the automatic lights had just been activated so the result was the lights turned off instead of on. The fix was to place the motion sensor in a better location and to optimize the automation logic for speedy execution. Now the lights come on without delay and people&amp;rsquo;s muscle memory to turn on the switch isn&amp;rsquo;t triggered.&lt;/p&gt;
&lt;p&gt;This rule can be hard to adhere to when you first create the individual automations. Sometimes only real-life usage will reveal cracks in the logic that need fixing.&lt;/p&gt;
&lt;h2&gt;Adapts to natural behavior&lt;/h2&gt;
&lt;p&gt;Home automation systems should improve people&amp;rsquo;s lives. As such, the automations must work in ways that follow the natural behavior of the people it serves. It&amp;rsquo;s an easy pitfall to build automations that works perfectly when people use it in the &amp;ldquo;correct&amp;rdquo; way, but if that is not how people behave in real life, then the automation needs adjustment.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;An example&lt;/strong&gt; are my linen closet lights. The automation would turn on the lights when the door opened and turn it back off when it closed. Sounds simple enough and it worked great. Except for the fact that to close the door, we would often just push it ajar leaving it not fully closed. In those situations, the light wouldn&amp;rsquo;t turn off and the automation seemed broken to us. The fix was to move the door sensor from the corner of the door to a location where &lt;em&gt;almost closed&lt;/em&gt; was understood by the automation as closed.&lt;/p&gt;
&lt;h2&gt;No further explanation needed&lt;/h2&gt;
&lt;p&gt;When the smart home works for everybody and adapts to the natural behavior of people in it, it shouldn&amp;rsquo;t be necessary to explain how it all works. However, some automations work beyond people&amp;rsquo;s natural behavior and are not discoverable unless taught. Once learned, using the automations should become a natural behavior for people.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;An example&lt;/strong&gt; could be a smart light switch that supports double tapping as a trigger to control multiple lights in the room. You cannot tell that the light switch has this feature, so unless you are told about it, you don&amp;rsquo;t know. One way people can take advantage of these hidden features is to make them into a pattern throughout the house. The pattern could be that double tapping any light switch will turn on/off all lights in the same room. You could even mark the switches with this capability for easy visual identification. Once taught, people can apply that same logic to any room and no further explanation is needed.&lt;/p&gt;
&lt;h2&gt;Resiliency built in&lt;/h2&gt;
&lt;p&gt;When your internet is down or the smart home hub fails, the smart home must still be functional. All lights must be operational from switches, the door locks still able to let you in etc. It&amp;rsquo;s ok that the automations don&amp;rsquo;t all work. In other words, the smart home must fail gracefully.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;An example&lt;/strong&gt; of when it doesn&amp;rsquo;t fail gracefully is when the internet in our house went down for a few days after a major snow storm. The smart home hub was still working, but it could only execute the automations that didn&amp;rsquo;t require an internet connection and I couldn&amp;rsquo;t use the app to control it either for the same reason. So, I couldn&amp;rsquo;t stop some automations from happening such as lights going on in bedrooms at the middle of the night, because the house wasn&amp;rsquo;t able to put itself into night mode without internet. I had to unplug the hub.&lt;/p&gt;
&lt;p&gt;After we regained our internet connection and plugged the hub back in, I made a bunch of changes to ensure that all essential automations would run locally (meaning no internet required), and that the non-essentials would fail gracefully. I also made sure to be able to control various states and variables through physical switches and buttons so I can disable some automations in case internet connection is lost again.&lt;/p&gt;
&lt;p&gt;A way of thinking about this is to approach home automation as steps of a pyramid. Each step in the pyramid requires the existence of the one below it and should be completely independent of any steps above it.&lt;/p&gt;
&lt;p&gt;&lt;img style="border: 0px currentcolor; margin-right: auto; margin-left: auto; float: none; display: block; background-image: none;" title="" src="https://madskristensen.net/posts/files/image_636873281501800888.png" alt="Home automation pyramid" width="493" height="294" border="0" /&gt;&lt;/p&gt;
&lt;h3&gt;Core functionality&lt;/h3&gt;
&lt;p&gt;Start at the bottom where the core functionality must always be operational. Only a power outage can disable the core functionality. In practice, this means that when the smart home hub and/or internet is down, the smart home gracefully degrades back into a fully functioning &lt;em&gt;dumb&lt;/em&gt; home.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Examples&lt;/strong&gt; are all lights, fans, door locks, and thermostats which should be operational from their physical controls such as a wall switch.&lt;/p&gt;
&lt;h3&gt;Basic automations&lt;/h3&gt;
&lt;p&gt;If something happened that only allows some automations to work, make sure they are the basic automations. It would most likely be lighting, door locks and such that is to be considered basic, but it is up to each smart home to determine which automations are of a more essential nature. Make sure this step can be executed fully locally and doesn&amp;rsquo;t have any dependencies on the &lt;em&gt;Extras&lt;/em&gt; step above it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Examples&lt;/strong&gt; are door- and motion sensor-based lighting automations, as well as bathroom fan and thermostat operations.&lt;/p&gt;
&lt;h3&gt;Extras&lt;/h3&gt;
&lt;p&gt;The Extras are non-essential automations and ones that require an internet connection. We want to keep this step as small as possible since these automations are the ones that are likely to break down first.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Examples&lt;/strong&gt; would be automations/controls initiated through voice assistants such as Amazon Echo or Google Home. It is also anything that require an internet connection such as certain types of Wi-Fi switches, plugs and light bulbs.&lt;/p&gt;
&lt;p&gt;I really enjoy automating our home and I look forward to sharing more learnings, tips, tricks and other stories in the future.&lt;/p&gt;</description>
  <author>test@example.com</author>
  <category>home automation</category>
  <guid isPermaLink="false">https://www.madskristensen.net/blog/home-automation-best-practices/</guid>
  <pubDate>Mon, 04 Mar 2019 20:29:13 GMT</pubDate>
</item>
<item>
  <title>How to upgrade extensions to support Visual Studio 2019</title>
  <link>https://www.madskristensen.net/blog/how-to-upgrade-extensions-to-support-visual-studio-2019/</link>
  <description>&lt;p&gt;Recently, I’ve updated over 30 of my extensions to support Visual Studio 2019 (16.0).&lt;/p&gt;  &lt;p&gt;To make sure they work, I got my hands on a very early internal build of VS 2019 to test with (working on the Visual Studio team has its benefits). I’ve learned that the upgrade process is probably the easiest I’ve ever experienced.&lt;/p&gt;  &lt;p&gt;I wanted to share that experience with you to show just how easy it is. Then you’ll know what to do once you get a copy of Visual Studio 2019.&lt;/p&gt;  &lt;h2&gt;Updates to .vsixmanifest&lt;/h2&gt;  &lt;p&gt;We need to make a couple of updates to the .vsixmanifest file. First, we must update the supported VS version range.&lt;/p&gt;  &lt;h3&gt;&amp;lt;InstallationTarget&amp;gt;&lt;/h3&gt;  &lt;p&gt;Here’s a version that support every major and minor versions of Visual Studio 14.0 (2015) and 15.0 (2017) all the way up to but not including version 16.0.&lt;/p&gt;  &lt;pre&gt;&amp;lt;Installation InstalledByMsi=&amp;quot;false&amp;quot;&amp;gt; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;InstallationTarget Id=&amp;quot;Microsoft.VisualStudio.Pro&amp;quot; Version=&amp;quot;[14.0,16.0)&amp;quot; /&amp;gt; &lt;br /&gt;&amp;lt;/Installation&amp;gt;&lt;/pre&gt;

&lt;p&gt;Simply change the upper bound of the version range from 16.0 to 17.0, like so:&lt;/p&gt;

&lt;pre&gt;&amp;lt;Installation InstalledByMsi=&amp;quot;false&amp;quot;&amp;gt; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;InstallationTarget Id=&amp;quot;Microsoft.VisualStudio.Pro&amp;quot; Version=&amp;quot;[14.0,17.0)&amp;quot; /&amp;gt; &lt;br /&gt;&amp;lt;/Installation&amp;gt;&lt;/pre&gt;

&lt;h3&gt;&amp;lt;Prerequisite&amp;gt;&lt;/h3&gt;

&lt;p&gt;Next, update the version ranges in the &amp;lt;Prerequisite&amp;gt; elements. Here’s what it looked like before:&lt;/p&gt;

&lt;pre&gt;&amp;lt;Prerequisites&amp;gt; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;Prerequisite Id=&amp;quot;Microsoft.VisualStudio.Component.CoreEditor&amp;quot; Version=&amp;quot;[15.0,16.0)&amp;quot; DisplayName=&amp;quot;Visual Studio core editor&amp;quot; /&amp;gt; &lt;br /&gt;&amp;lt;/Prerequisites&amp;gt;&lt;/pre&gt;

&lt;p&gt;We must update the version ranges to have the same upper bound as before, but in this case we can make the upper bound open ended, like so:&lt;/p&gt;

&lt;pre&gt;&amp;lt;Prerequisites&amp;gt; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;Prerequisite Id=&amp;quot;Microsoft.VisualStudio.Component.CoreEditor&amp;quot; Version=&amp;quot;[15.0,)&amp;quot; DisplayName=&amp;quot;Visual Studio core editor&amp;quot; /&amp;gt; &lt;br /&gt;&amp;lt;/Prerequisites&amp;gt;&lt;/pre&gt;

&lt;p&gt;This means that the Prerequisite needs version 15.0 or newer.&lt;/p&gt;

&lt;p&gt;See the updated .vsixmanifest files for &lt;a href="https://github.com/madskristensen/MarkdownEditor/blob/master/src/source.extension.vsixmanifest"&gt;Markdown Editor&lt;/a&gt;, &lt;a href="https://github.com/madskristensen/BundlerMinifier/blob/master/src/BundlerMinifierVsix/source.extension.vsixmanifest"&gt;Bundler &amp;amp; Minifier&lt;/a&gt;, and &lt;a href="https://github.com/madskristensen/ImageOptimizer/blob/master/src/source.extension.vsixmanifest"&gt;Image Optimizer&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;What else?&lt;/h2&gt;

&lt;p&gt;Nothing. That’s it. You’re done.&lt;/p&gt;

&lt;p&gt;Well, there is one thing that may affect your extension. Extensions that autoload a package has to do so in the background as stated in this &lt;a href="https://blogs.msdn.microsoft.com/visualstudio/2018/05/16/improving-the-responsiveness-of-critical-scenarios-by-updating-auto-load-behavior-for-extensions/"&gt;blog post&lt;/a&gt;. Check out this &lt;a href="https://github.com/Microsoft/VSSDK-Extensibility-Samples/tree/master/AsyncPackageMigration"&gt;great walkthrough&lt;/a&gt; on how to make that change if you haven’t already since it’s been supported since Visual Studio 2015.&lt;/p&gt;

&lt;p&gt;What about the references to &lt;em&gt;Microsoft.VisualStudio.Shell&lt;/em&gt; and other such assemblies? As always with new version of Visual Studio, they are automatically being redirected to the 16.0 equivalent and there is backwards compatibility to ensure it will Just Work&lt;sup&gt;TM&lt;/sup&gt;.&amp;#160; And in my experience with the upgrade is that they in fact do just work.&lt;/p&gt;

&lt;p&gt;I’m going to head back to adding VS 2019 support to the rest of my extensions. I’ve got about 40 left to go.&lt;/p&gt;</description>
  <author>test@example.com</author>
  <category>visual studio</category>
  <category>vsix</category>
  <guid isPermaLink="false">https://www.madskristensen.net/blog/how-to-upgrade-extensions-to-support-visual-studio-2019/</guid>
  <pubDate>Mon, 17 Sep 2018 22:02:41 GMT</pubDate>
</item>
<item>
  <title>Getting started writing Visual Studio extensions</title>
  <link>https://www.madskristensen.net/blog/getting-started-writing-visual-studio-extensions/</link>
  <description>&lt;p&gt;I’m often asked how to best learn to build Visual Studio extensions, so here is what I wished someone told me before I got started.&lt;/p&gt;  &lt;h2&gt;Don’t skip the introduction&lt;/h2&gt;  &lt;p&gt;It’s easy to create a new extensibility project in Visual Studio, but unless you understand the basics of how the extensibility system works, then you are setting yourself up for failure.&lt;/p&gt;  &lt;p&gt;The best introduction I know of is &lt;a href="https://channel9.msdn.com/events/Build/2016/B886"&gt;a session from //build 2016&lt;/a&gt; and it is as relevant today as it was then.&lt;/p&gt;  &lt;p&gt;[youtube:MFiRotBsVKU]&lt;/p&gt;  &lt;h2&gt;Know the resources&lt;/h2&gt;  &lt;p&gt;Where do you get more information about the various aspects of the Visual Studio APIs you wish to use? Here are some very helpful websites that are good to study.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="https://docs.microsoft.com/visualstudio/extensibility/starting-to-develop-visual-studio-extensions"&gt;Official documentation&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="https://github.com/Microsoft/VSSDK-Extensibility-Samples"&gt;Official extensibility samples repo on GitHub&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="https://gist.github.com/madskristensen/7310c0d61694e323f4deeb5a70f35fec"&gt;Visual Studio Extension Checklist&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://dotneteers.net/blogs/divedeeper/search.aspx?q=learnvsxnow"&gt;LearnVSXNow! series by Dotneteers&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Know how to search for help&lt;/h2&gt;  &lt;p&gt;Writing extensions is a bit of a niche activity so searching for help online doesn’t always return relevant results. However, there are ways we can optimize our search terms to generate better results. &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Use the precise interface and class names as part of the search term&lt;/li&gt;    &lt;li&gt;Try adding the words &lt;em&gt;VSIX&lt;/em&gt;,&lt;em&gt; VSSDK&lt;/em&gt; or&lt;em&gt; Visual Studio &lt;/em&gt;to the search terms&lt;/li&gt;    &lt;li&gt;Search directly on GitHub instead of Google/Bing when possible&lt;/li&gt;    &lt;li&gt;Ask questions to other extenders on the &lt;a href="https://gitter.im/Microsoft/extendvs"&gt;Gitter.im&lt;/a&gt; chatroom &lt;/li&gt; &lt;/ul&gt;  &lt;h2&gt;Use open source as a learning tool&lt;/h2&gt;  &lt;p&gt;You probably have ideas about what you want your extension to do and how it should work. But what APIs should you use and how do you hook it all up correctly? These are difficult questions and a lot of people give up when these go unanswered. &lt;/p&gt;  &lt;p&gt;The best way I know of is to find extensions on the &lt;a href="https://marketplace.visualstudio.com/vs"&gt;Marketplace&lt;/a&gt; that does similar things or uses similar elements as to what you want to do. Then find the source code for that extension and look at what they did and what APIs they used and go from there.&lt;/p&gt;  &lt;h2&gt;Additional tools&lt;/h2&gt;  &lt;p&gt;There is an open source extension for Visual Studio that provides additional features for extension authors that I can highly recommend. Grab the &lt;a href="https://marketplace.visualstudio.com/items?itemName=MadsKristensen.ExtensibilityTools"&gt;Extensibility Tools&lt;/a&gt; extension on the Marketplace.&lt;/p&gt;  &lt;p&gt;Also, a NuGet package exist containing Roslyn Analyzers that will help you writing extensions. Add the &lt;a href="https://www.nuget.org/packages/Microsoft.VisualStudio.SDK.Analyzers/"&gt;Microsoft.VisualStudio.SDK.Analyzers&lt;/a&gt; package to your extension project.&lt;/p&gt;  &lt;p&gt;I hope this will give you a better starting point for writing extensions. If I forgot to mention something, please let me know in the comments.&lt;/p&gt;</description>
  <author>test@example.com</author>
  <category>visual studio</category>
  <category>vsix</category>
  <guid isPermaLink="false">https://www.madskristensen.net/blog/getting-started-writing-visual-studio-extensions/</guid>
  <pubDate>Tue, 26 Jun 2018 16:14:03 GMT</pubDate>
</item>
<item>
  <title>Visual Studio extensibility samples</title>
  <link>https://www.madskristensen.net/blog/visual-studio-extensibility-samples/</link>
  <description>&lt;p&gt;Having great samples to help you learn about any programming language or paradigm can be very valuable. In my opinion, a good sample can be characterized by:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Being easy to replicate&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Having clear steps that guide the reader to replicating the behavior of the sample into their own code base is paramount. Without clear guidance and explanation on how to consume the sample, the sample is much less efficient and may lead to the reader becoming annoyed. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Being self-contained&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The sample needs to contain the needed documentation, code comments and simplicity that makes it easy to understand. It must keep the concept count to a minimum to reduce noise. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Linking to additional resources&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;A sample is not a replacement for full documentation but shows how to implement concepts that can pan multiple sets of documentation. If the reader is interested in knowing more details about the various technologies and concepts used by the sample, links must be made available.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Being able to build and run&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;It should be possible to clone the sample to your machine, open it in Visual Studio and being able to run and debug effortlessly. Setting breakpoints and inspecting the code is a fantastic way to help understand how the sample works.&lt;/p&gt;  &lt;h2&gt;New samples&lt;/h2&gt;  &lt;p&gt;The Visual Studio extensibility team has a notable &lt;a href="https://github.com/Microsoft/VSSDK-Extensibility-Samples"&gt;set of samples&lt;/a&gt; for various different aspects of writing extensions. However, they do not adhere to the rules outlined above and we are looking into updating them accordingly and adding new ones as well.&lt;/p&gt;  &lt;p&gt;So, we’ve created some experimental samples on GitHub that addresses some pain points we’ve noticed over the years. They are:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;strong&gt;&lt;a href="https://github.com/madskristensen/OptionsSample"&gt;Doing options the right way&lt;/a&gt;&lt;/strong&gt; - This sample shows how to correctly specify and consume options for a Visual Studio extension that is both thread-safe and performant.&lt;/li&gt;    &lt;li&gt;&lt;a href="https://github.com/madskristensen/VisibilityConstraintsSample"&gt;&lt;strong&gt;VisibilityConstraints&lt;/strong&gt;&lt;/a&gt; - This sample shows how to use the &lt;em&gt;&amp;lt;VisibilityConstraints&amp;gt;&lt;/em&gt; element in a Visual Studio extension to remove the need to use the &lt;em&gt;ProvideAutoload&lt;/em&gt; attribute on a package class.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;&lt;a href="https://github.com/madskristensen/ProtocolHandlerSample"&gt;Protocol Handlers&lt;/a&gt;&lt;/strong&gt; - This sample shows how to associate a URI protocol with Visual Studio and handle the passed in URI. For instance, a link with a custom protocol (such as vsph://anything/I/want) will open Visual Studio and pass the URI to the extension.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;&lt;a href="https://github.com/madskristensen/TextmateSample"&gt;Textmate Grammar&lt;/a&gt;&lt;/strong&gt; - This is a sample project that demonstrates how to ship Textmate grammars inside Visual Studio extensions.&lt;/li&gt; &lt;/ol&gt;  &lt;h2&gt;Give us feedback &lt;/h2&gt;  &lt;p&gt;Please help give us feedback on these new types of samples by either commenting on this blog post or, even better, opening issues directly on the samples on GitHub. The more feedback we get, the better the samples get, and we can start writing lots more of them.&lt;/p&gt;  &lt;p&gt;Also, what scenarios should the next batch of Visual Studio extensibility samples address?&lt;/p&gt;</description>
  <author>test@example.com</author>
  <category>visual studio</category>
  <category>vsix</category>
  <guid isPermaLink="false">https://www.madskristensen.net/blog/visual-studio-extensibility-samples/</guid>
  <pubDate>Tue, 24 Apr 2018 16:56:54 GMT</pubDate>
</item>
<item>
  <title>3 new extensions for Visual Studio extenders</title>
  <link>https://www.madskristensen.net/blog/3-new-extensions-for-visual-studio-extenders/</link>
  <description>&lt;p&gt;Building extensions for Visual Studio has its challenges, but as the new PM on the extensibility team I’ve made it my mission to make it easier. One way of doing that is to provide features that can take some of the pain out of common tasks associated with extension authoring.&lt;/p&gt;  &lt;p&gt;Here are three brand new extensions that might be helpful.&lt;/p&gt;  &lt;h2&gt;Command Explorer&lt;/h2&gt;  &lt;p&gt;This extension shows the group and menu identifiers of existing commands to make it easy to find out where to place your custom commands.&lt;/p&gt;  &lt;p&gt;&lt;a href="https://madskristensen.net/posts/files/CommandExplorer_636597539971546485.png"&gt;&lt;img title="CommandExplorer" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" border="0" alt="CommandExplorer" src="https://madskristensen.net/posts/files/CommandExplorer_thumb_636597539978436396.png" width="1024" height="416" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=MadsKristensen.commandexplorer"&gt;Read more and download Command Explorer&lt;/a&gt; from Marketplace and check out the &lt;a href="https://github.com/madskristensen/CommandTableInfo"&gt;source on GitHub.&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Registry Explorer&lt;/h2&gt;  &lt;p&gt;This extension provides a tool window for looking at the Visual Studio registry hive. It shows the registry from both the &lt;strong&gt;UserRegistryRoot&lt;/strong&gt; and &lt;strong&gt;ApplicationRegistryRoot&lt;/strong&gt; (_Config).&lt;/p&gt;  &lt;p&gt;&lt;img style="border: 0px currentcolor; border-image: none; background-image: none;" border="0" alt="Tool Window" src="https://raw.githubusercontent.com/madskristensen/RegistryExplorer/master/art/window.png" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=MadsKristensen.registryexplorer"&gt;Read more and download Registry Explorer&lt;/a&gt; from Marketplace and check out the &lt;a href="https://github.com/madskristensen/RegistryExplorer"&gt;source on GitHub&lt;/a&gt;.&lt;/p&gt;  &lt;h2&gt;KnownMonikers Explorer&lt;/h2&gt;  &lt;p&gt;Provides a tool window for Visual Studio extension authors that lets you easily browse all the image monikers in the &lt;strong&gt;KnownMonikers&lt;/strong&gt; catalog and save them at any size to PNG, JPG or Gif on disk.&lt;/p&gt;  &lt;p&gt;&lt;img alt="Context Menu" src="https://raw.githubusercontent.com/madskristensen/KnownMonikersExplorer/master/art/context-menu.png" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=MadsKristensen.knownmonikersexplorer"&gt;Read more and download Registry Explorer&lt;/a&gt; from Marketplace and check out the &lt;a href="https://github.com/madskristensen/KnownMonikersExplorer"&gt;source on GitHub&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;All three extension require Visual Studio 2017 Update 6 since it uses the new Async Tool Window feature.&lt;/p&gt;  &lt;p&gt;I hope these extensions will help make you a more productive and happier Visual Studio extender. Let me know in the comments.&lt;/p&gt;</description>
  <author>test@example.com</author>
  <guid isPermaLink="false">https://www.madskristensen.net/blog/3-new-extensions-for-visual-studio-extenders/</guid>
  <pubDate>Thu, 19 Apr 2018 16:59:58 GMT</pubDate>
</item></channel>
</rss>