Skip to main content

Quickfix: Zigbee/Z-Wave USB on QNAP

I am running Home Assistant as a docker installation on my QNAP TS-251+ NAS and wanted to add Z-Wave/ZigBee capabilities to my home automation using the HUSBZB-1 USB Stick, a combinedĀ Z-Wave/ZigBee controller. Got mine for ~45EUR incl. shipping and import tax from amazon.com.

Stick arrived today – plugged into the NAS – checked if detected as USB-Serial – NOPE šŸ™

A quick “lsusb” dump told me that the device has been detected, but the drivers where not loaded, so no /dev/ttyUSBx – QNAP is not loading the modules by default.

FIX:

Login to your QNAP via SSH an run the following commands:

Re-plug the stick and you (should) have two new devices: /dev/ttyUSB0 and /dev/ttyUSB1 šŸ™‚

And if you want to use aĀ Aeotec AEOEZW090-C Z-Wave controller, log in to your QNAP and run

Conbee:

insmod /usr/local/modules/ftdi_sio.ko

Basic D-duino code (OLED, WifiManager)

In aĀ previousĀ blog post I introduced to you the D-duino ESP8266 boards. In this blog post, I’ll show you a smallĀ Arduino code which is providing the basic functionality for my next projects.

What’s in the box

I am using the awesome WifiManager library. I will handle the configuration and connection to a WiFi network. If Ā the ESP is unconfigured or the AP is not reachable, it will start an access point by its own. You can connect to this AP and a caption portal will open. Scan for networks, select one and enter the password. The configuration will be saved in the EEPROM. No need to set the credentials inside of your code.

Over-the-Air update is also implemented. This makes it very easy to update the code without connecting the MCU via USB to the host. It’s also faster than serial uploads.

Last part is of course the OLED display. I am using theĀ ESP8266_SSD1306 library. It has some very nice features like progress bars, several graph commands (lines, shapes etc.), pictures and of text.

Read More

DIY IoT Central – Home Assistant / InfluxDB / Grafana

Get started with Home Assistant, InfluxDB and Grafana.

Laying the Foundation

Create several directories to persist configurations, logs & data

You’ll most likely use different directory names – keep in mind that you have to update theĀ docker-compose.yaml too
/share/Container/home-assistant Home Assistant configuration
/share/Container/influxdb InfluxDB Data & Config
/share/Container/grafana/log Grafana Logs
/share/Container/grafana/data Grafana Data

Basic configuration

InfluxDB Generate the default config for InfluxDB

docker run --rm influxdb:1.2-alpine influxd config > influxdb.conf

Now move theĀ influxdb.conf to your config directory (in my caseĀ /share/Container/influxdb)

Home Assistant If no configuration is found, Home Assistant will create a basic configuration itself after the container has started.

Read More

Use a ESP8266 to control your A/C via MQTT

We had some very (very!) hot days here in Sydney, up to 40 DegC over several days. After a day in the office, you open the door to your apartment and… 50 DegC šŸ™ I looked for a solution toĀ cool down home right after i left the office – with my phone – usingĀ MQTT šŸ˜‰

Hardware

I am using three components for my project. The MCU, an adapterĀ board and the IR-LED

NodeMCU

  • ESP8266
  • 4Mbyte ROM
  • On-board USB/UART

Grove Base Shield for NodeMCU

  • 5 Digital connectors
  • 2 I2C sockets
  • 1 Analog connectors (A0)
  • Power indicator LED

Shop |Ā Wiki

Grove – Infrared Emitter

  • Voltage: 3.3-5V
  • Distance:10m

Shop | Wiki

 

Software

 

The Basics

The project is based on theĀ Arduino core for ESP8266 and uses several additional libraries. I am using the platform.io IDE for development. The advantages are the fully integratedĀ build and deployment process (via USB or over WiFi), the library manager and the code completion and linting. You can download my completeĀ platform.io project here.

You’ll also need an MQTT server like RabbitMQ to send commands and receive the status. If you are familiar with Docker, you should read my previous postĀ Dockerize RabbitMQĀ to get a server up and running in no time. If not: There are several binary pages on the RabbitMQ Website.

Read More

Install rtl-sdr on a C.H.I.P

Check your hardware

First you should make sure that your rtl-sdr stick is properly connected to your c.h.i.p and that your power source is suitable to drive the chip plus the rtl-sdr. Some of them are consuming more than 500mA (which isĀ out of specĀ for USB2.0) which can cause the system crashing if under load.

Connect your rtl-sdr to the c.h.i.p, login and run lsusb -t. You should see an output like the one on the screenshot below. The last two lines are the rtl-sdr stick.

Read More

Setup a C.H.I.P in Headless mode (no screen)

So you got your C.H.I.P but unfortunately you can’t connect to a Display and you don’t have a keyboard available? This guide should help you to get started. You will connect the C.H.I.P to your wi-fi, update the software and install a vnc server to use the gui.

Initial connection

Connect you C.H.I.P via USB to your Computer.

Open your favourite terminal program and connect to the comport with 115200Ā baud. For windows you can use putty. On OSX i suggest using cu.

On OSX i am using this commandĀ sudo cu -l /dev/cu.usbmodem1423 -s 115200

If you’re connected and you don’t see any login screen just hit enter once

Login with the default credentials (chip/chip)

Read More

OSX: Use a GUI (X11) app in Docker

Prerequisites

First install socat via brew:

If you don’t have brew installed, just follow theseĀ instructions.

Next is XQuartz. Download the DMG fromĀ http://www.xquartz.org/ and install it.

 

Preparations

Start socat:

Now start XQuartz. Go to PreferencesĀ and enable “Allow connections from network clients”:

 

XQuarts Setting Menu

Quartz Settings

Now find the ip address of our VM. Open virtualboxĀ and go toĀ the settings of your VM. Click to the “Network” Tab.

Screenshot 2016-02-18 21.56.24In my example, the interface we’re looking for is “vboxnet2“.

Lookup the ip by executing “ifconfig vboxnet2” in the terminal.
Screenshot 2016-02-18 21.57.48

Now we’re ready to start Firefox inside of a docker container šŸ™‚

This will download a minimal image (~200MB) and start Firefox

Firefox

New toys – ESP8266 Modules

Yeah, new hardware to tinker with: a ESP-01 and a NodeMCU Board šŸ™‚

Specs

The ESP8266 is a powerful and cheap SoC (System on a Chip) with onboard WiFi (b/g/n) capabilities. It has 16 GPIO pins, UART, i2c, SPI andĀ QSPI for external flash memory.

ESP-01 Module

esp-01
ESP-01 Module

This very cheap module consist of o ESP8266, A PCB-Trace antenna and an external 1MB flash chip. It’s not breaking out every GPIO pins – justĀ 2 (GPIO0 & 2).

This module has 8 pins: VCC & GND for power, RXD & TXD for serial communication, RST for reset (yeah, really :p ), CH_PD for chip enabled/disable and GPIO0 & GPIO3. This chip is intended for small projects or as a Serial-Wifi bridge.

Be aware: The module has no onboard logic-level-converter. So if you hook up this board to more than 3.3v, you will most likely see magic smoke !

You can get these board for ~3-6 AUD$ from eBay.

 

NodeMCU v2

NodeMCU (ESP8266)
NodeMCU v2

This module is a complete development board. It is utilising a ESP-12E which is basically a ESP8266, 4MB flash and an antenna on one small pcb. This pcb is soldered to the devboard which is powered by usb (3.3v step-down-converter), a USB-Bridge for easy programming and 2 buttons (reset and flash). You can use 10GPIO pins for your own projects – every of this pins is able to provide you i2c, 1-Wire and pwm functionality.

Again: The module has no onboard logic-level-converter for the GPIO pins!

It comes preflashed with the NodeMCU firmware (www.nodemcu.com) which enables you to program this module in LUA. It costs about 8-13 AUD$ on eBay.

 

Outlook

As i have some experience with Arduinos, i’ll most likely try to use the Arduino IDE to program this little friends –Ā  (https://github.com/esp8266/Arduino)

My first Project will be a Wifi-Remote-Controller (infrared bridge) for my Daikin AC

The best for last: A complete Docker-RPi-RTL-SDR ADSB/ACARS Solution

 

After my last two blogposts [1][2], many of you asked “Why Docker on a Raspberry?” if you can install all the software directly (“There are so much tutorials“). Yeah, that’s right – but think how much work you have to invest to get the following setup running:

sdr_gear

  • Raspberry Pi 2 & 2Ā RTL-SDR Sticks
    • Nr 1 is monitoring ADSB via dump1090
    • Nr 2 is monitoring ACARSĀ on 2 frequencies via acarsdec
  • FR24FEED (www.flightradar24.com) is taking the data from dump1090 and feeds it to FR24
  • FlightAirMap (PHP/MySQL) is taking the data from acarsdec and dump1090 to generate a comprehensive statistic and live map of your received data.
  • A Mysql server for storing the Data behind FlightAirMap

You needĀ five services which you have to install/compile, to configure, to link and to manage.

But there is a much more convenient solution: docker-compose and one (!) configuration file šŸ™‚

FlightAirMap & dump1090 Screenshots

flightairmap_3
FlightAirMap

flightairmap_2
FlightAirMap

flightairmap_1
FlightAirMap

dump1090
dump1090

Read More