Home Assistant: Logging to a central server

As the Raspberry Pi is relatively cheap, you might think: Why not having multiple Home Assistant installations running in my house? This gives you some advantages:

  • You might monitor temperature and humidity in different rooms.
  • If one instance fails, the other can still do the same job.

However, even with multiple HA instances, it might make sense to have the sensor data logged to a central instance. This makes data analytics much easier.

I use InfluxDB to store the sensor data. With our latest patch that will be included in Home Assistant 0.25, it is now possible to distinguish between the data from the different HA instances.

The logging configuration on the two HA instances would then look like this:

influxdb:
  host: 192.168.1.199
  tags:
    instance: living_room
influxdb:
  host: 192.168.1.199
  tags:
    instance: balcony

Teardown: Broadlink RM Mini 3

You might have read already, that I don’t like the Broadlink products as they do not offer any open APIs. But maybe, they are at least hackable?

Let’s check the RM Mini 3 Infrared sender/receiver.

Taking of the cap shows us the infrared LEDs and a single IR receiver:

rm3-1

This is what I would have expected. Are there any surprises on the main board?

rm3-2

Not really. The main processor is an Marvel 88MC200. This is a simple Cortex M3 based micro-controller that is clocked at 200 MHz. There is no need for a more powerful processor in this device. As it doesn’t have a WiFi controller integrated, there is a second controller on the board: the 88W8801 is a Marvel WiFi chip.

While in theory it might be possible to upload a different software onto the system, it will be quite complicated. You don’t want to fiddle around multiple days to re-use a 20$ device? The easiest way to re-use it is removing the whole controller, replace it with an ESP8266 and put your own firmware onto it. However, for this you don’t need to buy this device first. You can just directly connect some IR LEDs to an ESP8266 chip. This will be cheaper than the RM Mini 3.

Teardown: 433MHz window sensor

We’ve had a look at at 433Mhz window sensor before, but are they all the same? Let’s check another one:

osm900-1

Ist this one different? It definitely is a bit larger. Why?

osm900-3

It runs on AAA batteries. That makes replacing the batteries easier and most likely cheaper than the special 12V battery we saw in the other sensor. If you want to use it as a security device, it is also nice to see that there is a switch connected to the case. If somebody tries to open the device, it will also send a message.

osm900-2

On the back there aren’t any surprises. Just the transmitter chip with a few external components and an LED.

The protocol used for the 433MHz RF transmissions is trivial. There is no encryption. This means it is extremely simple to record the signal from the sensor and play it back again. It depends on your use case, if this is a problem.

As the module tested before, this one also only sends a signal when the window opens, not when it closes. Therefore it can’t be used to detect if a window is open or close.

MP1584 buck converter module

This small module MP1584 buck-converter module seems to be a good solution to power small circuits from higher voltages. Especially cool with this chip is that it accepts input voltages up to 29V. This makes it a perfect candidate for additional circuits that connect to a KNX bus. But it’s not limited to KNX buses. If you want to build a WiFi interface for your Roomba, you also have to down-regulate the 15V battery voltage to 5V or even 3.3V. You want to something to power a circuit from a car battery? This seems to be a perfect circuit for there use cases.

mp1584With it’s tiny dimensions of 17 x 22mm it’s size is around the size of 2 MicroSD cards (and much smaller than a single SD card).

The output voltage of the module is controlled by a tiny potentiometer. You will need a multimeter to check the output voltage before connecting it to a circuit.

While the plain voltage range data seems to be quite good, how does the circuit behave on different loads? Some Chinese dealers claim that similar modules should handle 3A load. If you just look at the size of the inductor you might already start thinking that this most likely isn’t true. However, DC resistance of the inductor is approximately 10mOhm (I miss my Kelvin probes and therefore could only measure this very roughly).

Let’s start with 29V input voltage – this will bring everything to the limit. Output voltage is fixed to 5V in this experiment. Without any current drawn, it still looks a bit rough:

29_0

However, a voltage swing of (Vpp) 98mV is no problem at all. Between 0.1A and 0.9A the circuit behaves quite well. Vpp is around 0.2V (a bit lower on low currents, higher in higher currents)

29_0.5

We reach the end at 1A. Now the regulator doesn’t provide a stable output voltage anymore:
29_1

But what about lower input voltages? Let’s go the the other “extreme”: 9V (it will work with even less, but let’s give it a bit headroom).

Almost perfectly clean with no load:
9_0

A bit more stable than at 29V for currents between 0.1A and 0.7A:

9_0.4

And at 0.7A we reach the end of the useable current range:

9_0.7

Conclusion: This module works fine for almost every embedded use case: Arduino, ESP8266 WiFi modules and even a Raspberry Pi without any additional USB devices plugged in.

Here are 2 animation that shows the output voltage under different loads:

29V input, 5V output, 0-1A in 0.1A steps:

29v_animated

9V input, %V output, 0-0.7A in 0.1A steps:

9v_animated

Connecting a particulate matter sensor to your PC or Mac

I’ve written before about what particulate matter sensors are and how they work. Many of these sensors come with a tiny 8-pin connector. With some luck, you even find an English data sheet. But you might just end up with a Chinese one. It might look like this:

pmsensor-cover

Luckily, most signals have english names:

datasheet

Ok, that’s all we need to know to connect this thing to a PC. You can see that the supply voltage is 5V and the I/O voltage is 3.3V. That’s perfect for most use cases. You also see that there is some kind of serial interface RX/TX and a SET and RESET input.

What do you need? The only thing you need is a USB to Serial (TTL) adapter. The come in different variants and might look like this:

usbser1 usbser2

usbser3

Before buying check 2 things: The adapter should offer 5V AND 3.3V power outputs (for this project we only need 5V, but you might need the 3.3V for other projects) and have a DTR output (we will use this to turn the sensor on and off).

Now connect the sensor to the adapter as follows:

 VCC pin 1  5V
 GND pin 2 GND
 TX pin 4  RX
 RESET  pin 6  DTR

Note that the pin numbers are for the specific sensor shown above. Check the data sheet of your sensor, the pins might be different!

Why isn’t RX not connected? All the dust sensors I’ve seen do not use this signal at all. If it isn’t used, there is no need to connect it (but you can do if you like).

Finally this will look like this:

dust-sensor-interface

You can now connect this to you PC or Mac and read data from the sensor. We will show in another article how to do this.

Measuring air quality

When people think about comfort in their apartment, most people think first about temperature. But another important factor is air quality. I don’t have to tell you that smells from cooking aren’t always the best. There are much more particles in the air that impact the quality. These particles are generally named “Particulate matter”. The EPA defines PM as follows:

“Particulate matter, or PM, is the term for particles found in the air, including dust, dirt, soot, smoke, and liquid droplets. Particles can be suspended in the air for long periods of time. Some particles are large or dark enough to be seen as soot or smoke. Others are so small that individually they can only be detected with an electron microscope. ”

Today, most measurements you find are PM2.5 measurements. This measures particles smaller than 2.5µm. Roughly one out of every three people in the United States is at a higher risk of experiencing PM2.5 related health effects.

Do you know the PM2.5 values in your living environment? Most likely not, but it is relatively easy and cheap to do do these measurements today. While calibrated sensors is still very expensive, for home-use uncalibrated sensors do a good job to give you a rough idea about possible problems.

These sensors work as follows:

dust-sensor

A light sends light into an air flow. Small particles will reflect the light. A receiver than measures these reflections. Seems very simple – right? It really is. The cheapest sensors are available for less than $20 on Chinese shopping sites. They use LEDs as a light source. Laser-based devices are a bit more expensive ($50 and up), but they can detect smaller particles.

Let’s have a look about a laser-based sensor like this:

P7180912-web

The fan creates an continuos air flow through the device. Looking into the device you see the air channel and the detector.

P7180899-web

The detector looks like this:


What else is inside?

This is the simple PCB. It is based on a small microcontroller and some external components.

The good thing about these (more expensive) sensors is that they already do the hard work for you. They have a serial output that already sends the PM1.0, PM2.5 and PM10 values.

You can use a simple USB-to-Serial converter and read the data directly from your PC. How to connect this sensor to the adapter is shown here.

References

What’s inside a cheap Chinese LED light?

LED lights have become cheaper and cheaper in the last years. But they are still a bit more expensive than Halogen lamps. To save money, some people might have a look at Chinese shopping sites. I wanted to know what you get if you pay less than 5$ for an LED lamp.

My delivery arrived like this:

led-lamp-china-broken

Yes, it fell apart already during shipping. It consists of some PCBs with LEDs soldered together by hand and a cheap plastic cap. You don’t really want to use something like this on mains voltages – right?

However, this gives us the chance to look what’s inside of this thing.

led-lamp-china-broken-inside

Ok, this is really the simplest circuit you can think of. You see a suppressor capacitor (the red one), a bridge rectifier (the small black part with the 4 pins), a small 4.7uF electrolytic capacitor and a few resistors.

The two 51Ohm resistors are connected in parallel and they limit the current flowing through the LEDs.

Better designs use switching mode power supplies with a fixed current output. However, you won’t get this if you buy the cheapest stuff on the internet.

Especially the fact that this ding falls apart on the slightest touch and every part of the circuit runs at mains voltages makes them extremely dangerous. After the the rectification you can expect almost 300V DC on the board. This is even more dangerous than 230V AC.

Do not use something like this!

Broadlink products – no APIs and other surprises

If you surf on Chinese shopping web sites you might have seen devices from Broadlink like the A1. They are quite cheap and seem to be powerful. However, have a second look before buying.

First of all, some sellers claim that the A1 has a PM2.5 particle sensor “coming soon”. Looks like this isn’t implemented yet in this software – right? Wrong! The device doesn’t have the necessary hardware included. There might be an add-on module coming in the future, but it will be a hardware-add-on, not just a software upgrade.

a1Another thing that Broadlink doesn’t publicly communicate is the fact that there are no open interfaces available. It seems that there is an SDK for the device, but Broadlink only allows to use it under NDA and it is only available as library for IOS and Android. That makes it hard to impossible to use this hardware as a part of a larger integration.

Therefore I can’t recommend any of the Broadlink products as long as Broadlink doesn’t offer any documented APIs.

Home Hack: Wifi Enabled Dog Flap/Treat Dispenser/Feeder

Every dog-owner knows the struggles of making it home in time to let the pup out, or the agony of waking up at 4am to let the Labrador outside to answer nature’s call. Well, there is good news to be heard. Wi-Fi enabled dog flaps and feeding dispensers are about to solve the most common problem known to the common pet owners.

Finding someone to pet-sit or look in your animals, whether it be a neighbour or a professional service used to involve someone else’s time and money. However, a new life-hack has revolutionised this and taken out the middle man, or in this case, your next-door neighbour who you have never really gotten to know.  Dog-flaps and feeders are now being connected to home networks and controlled by their owners from across the country when they are too busy to come home. Now, from the touch of your smartphone, you can control when and where your pet is allowed to go outside without having to leave the office.
pintofeedPintofeed is just one of the many automatic food dispensers on the domestic pet market that is controlled by its own app on your iOS, Android or Windows 8 smartphone. Once connected to Wi-Fi, you can dictate as and when the dispenser releases food for your pet, and as the app has numerous personal features, it can create feeding schedules based on your typical feeding times. It can even set up reminders to ensure your pet doesn’t miss a meal.
Similarly, with dog flaps, brands such as PetSafe have created various devices that can be controlled externally. The dog-flap is connected to your home internet and mobile or tablet, and can be opened or locked at the owner’s desire. There is also the option of having a chip implanted in the dog’s collar which can connect to the dog-flap when your pet is within a certain radius. It is then activated to open when your pet attempts to exit the home and prevents unwanted neighbourhood creatures wandering into your home.

The products and technology are becoming even more sophisticated, with in-built webcams fitted in the dispensers with a live feed to your phone, allowing you to keep tabs on your animals at any time of day. It is paving the way for single pet-owners who do not have the funds or means of employing somebody else to care for their animals to no longer schedule their life, businesses and affairs around their pets.

Comparison of Home Automation Frameworks

Good home security is for both, the “everyman”, and the “technological savants”. With the convenience of designing your own Home Automation framework, multiple Automation softwares are available, to tailor your framework to your every need:

Activehome: With an optimized design, Activehome provides a visual, interactive interface, in order to make operating your home simple. Though It has extendable capabilities to cater to your level of usage, Activehome utilizes one protocol in comparison to multi-protocol alternatives. With no user customization, Activehome is the perfect option for simple and efficient home security. Whilst the software is free, Activehome requires a hub (much like a router) starting at $77.05, and can only be accessed from one main Windows operating system; such as your desktop.

Powerhome:  Starting at $99.95, Powerhome is an affordable option of Home Automation, rich with system support and customizable features.  Accessed and controlled remotely, its lack of aesthetic sparkle is made up for with the level of customization available, for personal protocol development from the home; and anywhere else.

Homeseer: With smart learning, Homeseer accounts for home occupancy and time of day, in catering to your lighting and thermostat needs. Homeseer offers smartphone integration for remote surveillance and maintenance of your home.

Internet independent, Homeseer is guaranteed to maintain operations even when your internet is interrupted.

Starting at $124.95, Homeseer is a great multi-use, Home Automation system, for all of your security and multimedia management needs, and can be adapted to third-party hardware.

Indigo Domotics: Indigo’s 3rd party affiliation with Sony and Sharp; to name a few, caters to your Automation needs with optimum support, style, and convenience. With multiprotocol support, customers can operate Indigo through a user interface of their choice. Python language scripting is also available for your advanced customization. A Mac-based operation system, Indigo offers user integration across OS X and IOS platforms, for at home and remote access. Indigo’s automation services begin at $99.95.

Castle OS: Offers support to more smart devices than any other system, making It the ultimate choice for multi-OS households. Castle OS offers voice control, energy control, and climate control, alongside the essential home security protocols, as a standard. Castle OS provides personalization alongside a range of popular home security hardware, such as Nest Hub, Yale Locks, and Ecobee.

Domoticz: Providing the bare bones of Home Automation systems, Domoticz is an open source software primed for user customization. With Domoticz, daily household applicances, devices and sensor technology, can be monitored and controlled. With push notifications, Domoticz can warn you when weather indicative protocols have been activated, as well as alert you to any issues with your appliances and sensored technology.

Recommendation: With its multimedia capabilities, Homeseer ranks above its competitors. Providing you with safety and security, Homeseer has the solid foundations of any good Home Automation system, whilst elevating the user experience in collaborating with our daily, entertainment needs. Mainstreamed, optimized and commercial, Homeseer is a relatively low cost, bundle package for home entertainment and security.