Sinatra

Summarized using AI

R-House

Fernand Galiana • August 27, 2009 • Earth

In the video "R-House" presented by Fernand Galiana at the LoneStarRuby Conf 2009, the speaker discusses the intersection of home automation and software development, highlighting innovative approaches to creating a smart home environment. The presentation covers various home automation systems, emphasizing the importance of open-source contributions and community engagement in technological advancements.

Key points addressed in the talk include:

- Introduction to Home Automation: Galiana introduces the concept of home automation, focusing on systems that manage lighting, music, and climate control seamlessly.

- Energy Consumption Concerns: The speaker discusses the impact of energy usage in homes, raising awareness about rising costs and the importance of efficiency, particularly regarding heating, cooling, and electronics.

- Open-source Solutions: He emphasizes the significance of utilizing open-source projects like LinuxMCE, which support multiple protocols including Zigbee and Z-Wave, enabling robust home automation setups.

- R-House Gem: Galiana introduces the R-House gem, detailing how it integrates with LinuxMCE to control various devices in a unified manner.

- Development Overview: He shares his experience in developing a bridge between Ruby and C++ within the LinuxMCE framework, enabling event management and device control.

- Practical Applications: Demonstrating his system, he showcases features such as remote activation of lighting and monitoring through an iPhone app. This includes managing music and climate control efficiently.
- System Integration: The talk elaborates on the ability to monitor and control multiple devices from a single dashboard, streamlining user experience.
- Community Engagement: Galiana encourages developers to contribute to open-source projects, highlighting how collaborative efforts can lead to innovative solutions in technology.

The presentation concludes with a call to action for individuals interested in home automation to explore their capabilities and available resources. Galiana stresses that creating a smart home is now more accessible than ever, enabling both convenience and sustainability.

R-House
Fernand Galiana • August 27, 2009 • Earth

R-House by: Fernand Galiana

LoneStarRuby Conf 2009

00:00:20.939 Okay, um anyway, so let's get started. I've got quite a bit to cover, uh, I think.
00:00:27.539 You've chosen wisely by coming here this afternoon. There are a lot of cool stuff I'd like to show you. Hopefully, everything works. I'm carrying about 60 to 70 pounds worth of equipment to this conference, so I could easily say I've got the most stuff here.
00:00:39.239 Thank you. Yeah, thanks. So anyway, before we actually start, I'd like to recognize the people. How many open-source contributors do we have here in the house? Okay, a few. Basically, this project would be nothing if I didn't have anything to build all this stuff on.
00:00:52.440 This project, I think, has got over 40 gems that I use to make it happen, and I just wanted to buy a round of applause for all the open-source contributors for spending nights and weekends helping us on a day-to-day basis.
00:01:11.400 So before we actually start, I'm a software guy; I'm not an electrical engineer or anything like that. There is a possibility of a small fire that may occur from this equipment here, so I would like you to notice the exit. I've got one blocked out so you can go down that way. Please note your exit path.
00:01:30.180 A little bit about me—my name is Fernand Galiana. I run the Derail Group, the Denver Rails Users Group. I also contributed a couple of gems out there; one of them is Zia, which is a graphic package to integrate with your Rails, Merb, or Sinatra applications. I also have More, which allows you to track user interactions within your website, performance issues, exceptions, and so forth. You can check them out; they're on GitHub.
00:01:57.780 How many people do home automation here? Okay, a few hands. What kind of systems do you guys use? Extended? Okay, it seems to be the popular model out there. The cool thing about Extend is you don't have to go into drywall and break holes to wire things together; you know it's relatively cheap. However, it can be very expensive to get into.
00:02:29.940 The issue is, of course, Extend works by noticing spikes in your current wiring. When the spike is detected, a light can go on or off any kind of device like that, which is great. I have used Extend in the past, but the problem I encountered is that I would walk into my house, and the light would turn off when everything was on, as if someone in the neighborhood used a hair dryer or something that triggered my house's lights.
00:02:56.840 So it's not very reliable, but let's talk a little bit about what home automation is and what kind of stuff you can do with some information. I look for home automation systems that allow me not only to control lights but also to integrate music, create my pictures and videos, and manage my climate control, like air conditioning. There's a lot of concern about security now, especially with the economic downturn, as many people fear for their safety at home.
00:03:37.500 Before this, I was talking to my neighbor who got one of those security services to help prevent her from getting ripped off. She's spending about 90 bucks a month with an outfit to avoid theft. Hello? Okay. Can you hear me now? All right. So, there's a slide here about average energy consumption in a regular-sized house. Of course, heating and air conditioning take a big chunk of the kilowatts consumed.
00:04:40.560 How many people here have a computer running 24 hours a day? Yeah, the same issue. We may consume quite a bit of power in our houses, which is interesting. A regular desktop will suck up about 120 to 150 watts or more. This is noteworthy considering the changes in the computing forums where low-power devices are now getting down to 20 watts and even 13 watts for a computer.
00:05:14.820 Vendors are trying to introduce new appliances like refrigerators or dishwashers that will run 24 hours a day but at low power consumption. We are in an energy crisis. The grid cannot possibly support the current demand. Between three and six o'clock, the power that used to cost two cents a kilowatt can go up to 80 cents because you have to fire up gas or possibly nuclear-powered generators.
00:05:50.460 It is a concern for all of us to try to limit the energy we consume, especially with the coming of electric cars, which will be plugged into the grid. The current infrastructure won't be able to scale. There are many companies, including Google, that want to tap into your power consumption data. They have devices that track how many kilowatts you are consuming and if you're going over your limit. For me, I wanted to look at my power consumption at home and identify what's using up power.
00:06:42.240 When I started looking into the community, I found a few options. I wanted to create an open-source type system because I didn't want to buy a pre-packaged solution. I felt constrained and wanted to use my skills as a software engineer to write code that I could use on a daily basis. There are different protocols out there, and we talked about Extend; there's stuff that requires wiring to your house, but the most interesting ones are Zigbee and Z-Wave. These are two-way radio frequency protocols that allow for status updates and command sending.
00:07:40.080 Zigbee is probably the most industrial solution; it's a big-bandwidth network. Z-Wave, on the other hand, is a mesh network where devices can route to expand the range. I looked at Z-Wave because it's more geared towards home automation, and there are over 200 vendors involved, including Lutron and Leviton, that provide nice switches that are integrating the Z-Wave protocol due to their low energy consumption.
00:08:17.820 One open-source system I wanted to explore was LinuxMCE. How many people have heard of LinuxMCE? A couple? Good. LinuxMCE is the largest open-source project out there focused on technology mashup. It encompasses concerns like telephony, climate control, and different protocols, including Z-Wave, Zigbee, and X10, all in one system.
00:08:43.140 The source code was contributed by a company in Florida, and a lot of it is well done. It doesn't matter what kind of device you are talking about, whether it's a device connected via IP or Z-Wave, TV, or stereo; you can interact with it using a given protocol.
00:09:12.180 Before we start looking at the code, here's a quick overview of the gear I've brought. As I mentioned, I have a lot of equipment here. This is an Asus Eee Box. If you can see it, you can come afterward and take a look. This is a 20-watt computer with an Intel Atom processor and a 160-gig hard drive. It's accessible price-wise.
00:09:51.660 Next, I have a Z-Wave module that recognizes devices. When you buy a new device for your house, you can walk around with that dongle, press a button on it, and register the device with an ID.
00:10:06.600 I also have a little Arduino board here that is registered, and when the rules fire, the light on the Arduino board will blink. I also brought a regular wired IP camera, router, speaker systems, and a global cache box that allows me to interface with my home amp, TV, and so forth.
00:10:31.380 The point I want to make is that you can integrate different protocols within the same system. Like I mentioned earlier, I contributed a gem that hopefully interests you. It's on GitHub and is called R-House.
00:10:59.880 At the core of the LinuxMCE system is the DC Router, where every message goes through to route to the appropriate device. If there's one thing you should remember from this talk, it's this concept. A DCE message protocol looks like this: the first number represents the from device ID. LinuxMCE was my choice because there were two things I found interesting: one is that Ruby can be bundled with it, which is useful, and the other is that it has an underlying MySQL database that stores all the devices available on the network.
00:11:49.680 These IDs, like 28 and 0, refer to the device IDs within the system. For us Ruby developers, having a database for persistent storage from which we can extract and store information is pretty cool. The communication protocol runs from device 0 to device 28, which happens to be a light, where the message protocol controls whether I want to send a command or event.
00:12:35.400 The various parameters indicate what level I want to dim the light, with 50 being the value. The architecture consists of the DC Router, the devices, and the database, which is all hooked up and provided out of the box with LinuxMCE. My challenge was to integrate the C++ world with the Ruby world. I needed a way to use my Ruby development skills to enhance the system and add technology I was familiar with.
00:13:10.920 So, I created something called the RS Interceptor, which comes with the R-House gem as a script. You register the RS Interceptor with the LinuxMCE as a device. Once registered, you can express interest in lighting events, music events, and climate control events. The router will forward events to the RS Interceptor, which serves as a bridge between the C++ world and Ruby.
00:13:45.420 I also created a web service called R-House, allowing you to control your home automation system without being physically present at home. For example, I have an iPhone app running here. I can be across the world and switch my lights off and on. This system also allows you to monitor sensor events and get notifications, such as when someone is at your door.
00:14:29.700 The interceptor helps to manage events coming from various devices. When multiple devices activate events quickly, I utilize a RabbitMQ instance to wrap each event and push it onto a queue. This is like creating your own application within the R-House framework, where you can use worker processes to handle events.
00:14:58.020 I've implemented a Nozio Gem called My R-House as a sample application for the R-House framework. It provides a rules engine triggering various events and logs them. At the end of the month, you can check your wattage consumption for your lighting system.
00:15:54.540 R-House Web Service is the point of integration where you can use any technology to connect to the system. The R-House web service is built using Sinatra. How many people use Sinatra here? A good number! So, let's dive into a demo. It's interesting because last time I set this up, I had my house tweeting notifications when actions occurred such as when lights turned on or off—this morning, I even received a reply on one of my tweets.
00:16:55.140 So, let’s jump to the demo. I have an occupancy sensor that tracks brightness, temperature, and whether someone is in the room. It also monitors battery level, and when I trigger it, actions should occur. For example, when music plays, the light dims to create a nice mood.
00:17:25.740 Here's how it happens: when I trip the event, it triggers the RS Interceptor, which activates the rules engine, saying, 'Oh, we detected movement; dim lights to 50 and play some soothing music.' Let's check out another scenario. This time, I'm going to set a different state in the memory cache to see how it reacts.
00:19:31.680 During the demo, I can interact with different devices, adjusting lights and controlling cameras. Each sensor event generates a signal, visible through the RS Interceptor, giving a visual cue as events occur, allowing me to monitor lighting states easily.
00:20:17.660 For instance, when I issued a command to turn off a light, I can check the response. If I set the light to dim to 50 percent, the Arduino should give a visual indication to confirm the action. This is how the R-House system centralizes control over various devices, combining efficiency with the ability to integrate multiple devices seamlessly.
00:21:18.260 Through the web dashboard, I can check usage patterns and control the thermostat or any other appliance. It's user-friendly and allows managing lighting and climate control effectively without needing to be physically at home.
00:21:53.680 The monitoring dashboard shows energy usage over time, telling me how long devices are on. I can also manage thermostat settings remotely, ensuring efficiency while I'm away from home. The dashboard reflects all integrations, providing easy access to the entire home automation setup.
00:23:10.480 One core feature is the ability to identify who is at my door through Z-Wave technology when someone rings the bell. The system can trigger notifications on my devices so I can monitor, see, or respond to visitors without needing to get up.
00:23:52.760 This setup provides flexibility as I can easily switch between devices using a unified control system, eliminating the clutter of multiple remotes. My goal is to streamline the user interface so everything is accessible from a single dashboard.
00:24:30.020 Integration is key: I’ve created a web and mobile interface, ensuring I can access my system from anywhere. Whether controlling lights, music, or temperature, the entire structure is interconnected to create a seamless automation experience.
00:25:22.039 I work on the user interface and integrate it with my music library. The media control can be done right through my mobile device, allowing playback, pause, and volume adjustments for my home system from wherever I am.
00:26:12.359 The music streams from my home’s media center, and I can control it precisely through my mobile interface. It integrates effortlessly with the Ruby on Rails ecosystem, making it easier to expand when needed.
00:26:47.620 To sum up, my LinuxMCE setup is not just a tech experiment; it’s a functional home automation solution that combines energy efficiency, security, and convenience into a single manageable interface. I encourage everyone to explore the possibilities of home automation and find something you're passionate about in this tech space.
00:27:54.120 Before we wrap up, I’d love to share some resources and provide information on getting started. The LinuxMCE site has plenty of resources, and I have links in my presentation materials for those interested. This project is about collaborating and innovating, so if you have ideas or contributions, please reach out!
00:28:39.800 Thank you all for being here. I hope you found some useful insights today about harnessing technology for home automation. I'm happy to take questions.
00:29:16.200 To clarify, the monitoring function utilizes RabbitMQ to track events from lighting systems and calculates energy usage efficiently. You could integrate such a system into your home easily with the right devices and protocols.
00:29:54.600 Let me emphasize the community-driven aspect of these projects. Learning to write code that interacts with physical devices can enrich your daily life and help you integrate technology more seamlessly.
00:30:37.040 The integration with electrical systems and automated tracking could lead to massive savings in energy bills, providing a compelling reason to consider these types of home renovations.
00:31:15.040 Building these systems should be as much about fun and personal satisfaction as it is about practicality. Your setup can be tailored to meet your unique needs while keeping costs manageable.
00:31:59.540 As we conclude, consider this: home automation is no longer just futuristic sci-fi. With the tools and knowledge available, you, too, can create a smart home that provides both convenience and sustainability.
00:32:38.940 Thank you for your time, and I hope you leave inspired to explore the world of home automation and the endless possibilities it presents.
Explore all talks recorded at LoneStarRuby Conf 2009
+14