home-assistant.github.io/blog/categories/user-stories/atom.xml
2018-03-11 22:16:40 +00:00

269 lines
12 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title><![CDATA[Category: User-Stories | Home Assistant]]></title>
<link href="https://home-assistant.io/blog/categories/user-stories/atom.xml" rel="self"/>
<link href="https://home-assistant.io/"/>
<updated>2018-03-11T22:06:17+00:00</updated>
<id>https://home-assistant.io/</id>
<author>
<name><![CDATA[Home Assistant]]></name>
</author>
<generator uri="http://octopress.org/">Octopress</generator>
<entry>
<title type="html"><![CDATA[Laundry Sensors with NodeMCU and Home Assistant]]></title>
<link href="https://home-assistant.io/blog/2016/08/03/laundry-automation-update/"/>
<updated>2016-08-03T17:22:00+00:00</updated>
<id>https://home-assistant.io/blog/2016/08/03/laundry-automation-update</id>
<content type="html"><![CDATA[_This is a guest post by Home Assistant user and contributor [Nolan Gilley](https://github.com/nkgilley)._
Today I'll show you how I used Home Assistant, a NodeMCU (ESP8266), and a couple of accelerometers to automate our laundry room. This is a rewrite of an [old post](https://home-assistant.io/blog/2015/08/26/laundry-automation-with-moteino-mqtt-and-home-assistant/) where I did the same thing using a Moteino & Raspberry Pi. This version only requires a NodeMCU.
We have an older washer and dryer which doesn't have any form of notification when cycles complete. Home Assistant was the obvious solution, I just needed to create sensors for the washer and dryer. I tried using sound sensors but found them unreliable. I ended up using an accelerometer attached to the back of each appliance. I also added magnetic reed switches on the doors of the washer and dryer to detect whether they're open or closed. I connected the accelerometers and reed switches to an NodeMCU which will relay the data to my MQTT broker.
<p class='img'>
<img src='/images/blog/2016-07-laundry-automation/block-diagram.png' />
Block diagram of schematic
</p>
<!--more-->
After taking some sample data from the accelerometers while each appliance was in operation, I decided to plot the data to help determine the proper thresholds of when the devices were running or off. I had to do this in order to get precise ranges so the dryer sensor wouldn't get tripped by the washer or vice versa. In the plot below you can see the acceleration in each direction for the accelerometer connected to the dryer. It's easy to see when the dryer is in operation here. I used the same technique for the washer's accelerometer.
<p class='img'>
<img src='/images/blog/2016-07-laundry-automation/data-graph.png' />
Graph showing the accelerometer data
</p>
Next it was just a matter of integrating everything with Home Assistant. I was able to use the [MQTT component](/components/mqtt/) to read the washer and dryer states from the Moteino and display it in Home Assistant.
<p class='img'>
<img src='/images/blog/2016-07-laundry-automation/screenshot-ha.png' />
Status of the dryer and washer in Home Assistant
</p>
Next I wrote [scripts](/components/script/) that are run whenever the washer or dryer completes a load. This is triggered by the [automation component](/getting-started/automation/). When the laundry is complete I have the lights in the house turn red and [notify me via Join](/components/notify.joaoapps_join/). Once the door is opened and laundry emptied another script runs that sets the lights back to normal. So far it has been very helpful and very reliable.
<p class='img'>
<a href='/images/blog/2016-07-laundry-automation/protoboard.jpg'>
<img src='/images/blog/2016-07-laundry-automation/protoboard.jpg' />
</a>
NodeMCU connected to MPU-6050 accelerometer.
</p>
Materials used:
- [NodeMCU](https://www.amazon.com/gp/product/B010O1G1ES)
- [2 x Accelerometers](http://www.amazon.com/gp/product/B008BOPN40)
- [2 x Reed switch](http://www.amazon.com/gp/product/B004PARDRO)
[Sketch for the NodeMCU is available here.](https://github.com/nkgilley/nodemcu-laundry/blob/master/nodemcu-laundry.ino)
Home Assistant Configuration:
```yaml
mqtt:
broker: 192.168.1.100
port: 1883
keepalive: 60
qos: 0
sensor:
- platform: mqtt
name: "Dryer Status"
state_topic: "sensor/dryer"
unit_of_measurement: ""
- platform: mqtt
name: "Washer Status"
state_topic: "sensor/washer"
unit_of_measurement: ""
automation:
- alias: Washer complete
trigger:
platform: state
entity_id: sensor.washer_status
from: 'Running'
to: 'Complete'
action:
service: script.turn_on
entity_id: script.washer_complete
- alias: Washer emptied
trigger:
platform: state
entity_id: sensor.washer_status
from: 'Complete'
to: 'Empty'
action:
service: scene.turn_on
entity_id: scene.normal
script:
washer_complete:
alias: Washer Complete
sequence:
- alias: Join Notification
service: notify.join
data:
message: "The washing machine has finished its cycle, please empty it!"
- alias: Living Room Lights Blue
service: scene.turn_on
data:
entity_id: scene.blue
```
Resources used:
- [Inspiration and Help with Arduino code](http://www.instructables.com/id/Uber-Home-Automation-w-Arduino-Pi/step13/Washer-Dryer-Smartifier-Water-Leak-Sensor/)
]]></content>
</entry>
<entry>
<title type="html"><![CDATA[Laundry Automation: insight and notifications]]></title>
<link href="https://home-assistant.io/blog/2015/08/26/laundry-automation-with-moteino-mqtt-and-home-assistant/"/>
<updated>2015-08-26T15:12:00+00:00</updated>
<id>https://home-assistant.io/blog/2015/08/26/laundry-automation-with-moteino-mqtt-and-home-assistant</id>
<content type="html"><![CDATA[_This is a guest post by Home Assistant user and contributor [Nolan Gilley](https://github.com/nkgilley)._
In our house, laundry has been a struggle for quite some time. Our washer and dryer both lack a buzzer which leads to forgotten laundry, and stinky mess that needs to be rewashed. I decided to create a solution by monitoring the washer and dryer myself with some cheap electronics.
As an avid user of Home Assistant, I decided it would be the perfect application to manage the UI and notification system. Now all I needed was a way to monitor the washer and dryer. I tried using sound sensors but found them unreliable. I ended up opting for an accelerometer attached to the back of each appliance. I also added magnetic reed switches on the doors of the washer and dryer to detect if the doors are open or closed. I connected the accelerometers and reed switches to a [Moteino](https://lowpowerlab.com/moteino/), an arduino clone with an RF transceiver. The Moteino can perform the logic to figure out which state the appliances are in and wirelessly communicate that data with another Moteino that is connected via serial to my Raspberry Pi. The Raspberry Pi reads the serial data and repeats it over MQTT for Home Assistant to use. This is great because I don't have to run Home Assistant on the Raspberry Pi. I can run it on a faster machine and point the [MQTT component](/components/mqtt/) to my Raspberry Pi.
After taking some sample data from the accelerometers while each appliance was in operation, I decided to plot the data to help determine the proper thresholds of when the devices were running or off. I had to do this in order to get precise ranges so the dryer sensor wouldn't get tripped by the washer or vice versa. In the plot below you can see the acceleration in the x direction for the accelerometer connected to the washing machine. It's easy to see when the washing machine is in operation here. I used the same technique for the dryer's accelerometer.
<p class='img'>
<a href='/images/blog/2015-08-laundry-automation/data-graph.png'>
<img src='/images/blog/2015-08-laundry-automation/data-graph.png' />
</a>
Graph showing the accelerometer data
</p>
<!--more-->
Next it was just a matter of integrating everything with Home Assistant. I was able to use the [MQTT component](/components/mqtt/) to read the washer and dryer states from the Moteino and display it in Home Assistant.
<p class='img'>
<img src='/images/blog/2015-08-laundry-automation/screenshot-ha.png' />
Status of the dryer and washer in Home Assistant
</p>
Next I wrote [scripts](/components/script/) that are run whenever the washer or dryer completes a load. This is triggered by the [automation component](/getting-started/automation/). When the laundry is complete I have the lights in the house turn red and [notify me via PushBullet](/components/notify.pushbullet/). Once the laundry is taken care of another script runs that sets the lights back to normal. So far it has been very helpful and very reliable.
<p class='img'>
<a href='/images/blog/2015-08-laundry-automation/moteino-and-sensors.jpg'>
<img src='/images/blog/2015-08-laundry-automation/moteino-and-sensors.jpg' />
</a>
Top left: reed switch. Bottom left: moteino. Right: Accelerometer.
</p>
Materials used:
- [Moteino](https://lowpowerlab.com/moteino/)
- [2 x Accelerometers](http://www.amazon.com/gp/product/B008BOPN40)
- [2 x Reed switch](http://www.amazon.com/gp/product/B004PARDRO)
- [Home Assistant](https://home-assistant.io/)
[Sketch for the Moteino is available here.](https://codebender.cc/sketch:144743)
Home Assistant Configuration:
<p class='note'>
The automation and script syntax here is using a deprecated and no longer supported format.
</p>
```yaml
mqtt:
broker: 192.168.1.100
port: 1883
keepalive: 60
qos: 0
sensor:
platform: mqtt
name: "Dryer Status"
state_topic: "sensor/dryer"
unit_of_measurement: ""
sensor 2:
platform: mqtt
name: "Washer Status"
state_topic: "sensor/washer"
unit_of_measurement: ""
automation:
alias: Dryer complete
platform: state
state_entity_id: sensor.dryer_status
state_from: 'Running'
state_to: 'Complete'
execute_service: script.turn_on
service_entity_id: script.dryer_complete
automation 2:
alias: Dryer emptied
platform: state
state_entity_id: sensor.dryer_status
state_from: 'Complete'
state_to: 'Empty'
execute_service: script.turn_on
service_entity_id: script.dryer_cleared
script:
dryer_complete:
alias: Dryer Complete Script
sequence:
- alias: Pushbullet Notification
execute_service: notify.notify
service_data:
message: "The dryer has finished its cycle, please empty it!"
- alias: Living Room Lights Red
execute_service: scene.turn_on
service_data:
entity_id: scene.red
- delay:
seconds: 1
- alias: Living Room Lights Off
execute_service: light.turn_off
service_data:
entity_id: group.living_room
- delay:
seconds: 1
- alias: Living Room Lights Red
execute_service: scene.turn_on
service_data:
entity_id: scene.red
dryer_cleared:
alias: Dryer Cleared Script
sequence:
- alias: Living Room Lights Off
execute_service: light.turn_off
service_data:
entity_id: group.living_room
- delay:
seconds: 1
- alias: Living Room Lights Normal
execute_service: scene.turn_on
service_data:
entity_id: scene.normal
```
Resources used:
- [Inspiration and Help with Arduino code](http://www.instructables.com/id/Uber-Home-Automation-w-Arduino-Pi/step13/Washer-Dryer-Smartifier-Water-Leak-Sensor/)
- [Moteino Code](https://github.com/LowPowerLab/RFM69/)
]]></content>
</entry>
</feed>