Category Archives: Hacking

cheap Chinese Z-Wave Sensors and Home Assistant…

cheap z-wave door sensor
cheap z-wave door sensor
I was looking for sensors that allow to monitor the status of a door. Typically those are magnet triggered switches that send some sort of signal when the magnet moves away and comes back. I wanted something based on Z-Wave. I’ve already light switch relays that are running on Z-Wave and am very happy with them. Z-Wave is on the pricier end of RF-devices. 433Mhz switches would be much cheaper, but Z-Wave offers nicer handling and hopefully more reliability.

Many of these sensors come in at around 40€. That is quite pricy so I opted for the cheap chinese solution at around 13.5€ per piece. You just have to be patient: 4+ weeks delivery time.

Setup into Home Assistant was straight forward. Add the device to the Z-Wave network via the web interface, rename it to mydoor… but then… How does the device report ‘door open’? The binary sensor that showed up, did nothing.

After some fiddling and searching I found that the sensor.mydoor_access_control changes it’s state rather unspectacularly from 23 to 22. It’s so inconspicuous that I didn’t notice the change the first few times I kept looking for changes.

Perfect! there is something we can use to integrate it to Home Assistant for automation and other stuff. Luckily there are templates that allow us to turn this into a binary sensor which is more useful in automations.
Add this to your configuration.yml:

  platform: template
      device_class: opening
      friendly_name: 'Haustür'
      value_template: >-
        {%- if is_state("sensor.mydoor_access_control", "22") -%}
        {%- else -%}
        {%- endif -%}

this can then be integrated into an automation like this:

  alias: "coming home"
  hide_entity: False
    platform: state
    entity_id: binary_sensor.door1
    from: 'off'
    to: 'on'
    condition: sun
    after: sunset
    - service: homeassistant.turn_on
        - switch.main_light

that’s it. hope this helps.

thanks to @Tinkerer from the Home Assistant chat group for the help.

Flattr this!

Home Automation with Python…

I gave a talk at Grazer Linuxtage 2017. It’s about Home Automation and how you can use Python to realize it.

The talk covers a simple example of a DIY sensor that runs MicroPython. Finally I give a short introduction to Home Assistant, a Python Home Automation Hub, that allows you to integrate with hundreds of devices. Home Assistant offers integrations to light switches, smart lights (Hue, Trådfri, Lightify,…), door sensors, heat control units, and many others.

There is a video of my talk on my Youtube channel:

Flattr this!

DIY MQTT smart plug with MicroPython…

I’ve been playing around with MicroPython and Home Assistant. MicroPython is a ‘bare-metal’-Python flavor that you can use to program ICs. Home Assistant is a home automation and home control software written in Python 3. It can be hosted on a Raspberry Pi. It enables you to connect a vast amount of different devices: lights, switches, sensors, locks etc.

This is a raw guide on how to make your own smart plug and connecting it to MQTT which is then connected to Home Assistant.

You will need a relay board (single relay), a NodeMCU board, a power adapter for 5V, a case, a button, some wire and a 1k resistor.

Connect the devices according to this schema (WARNING: Don’t do this if you’re not comfortable handling mains power!). Don’t forget earthing (it’s not on the diagram):
circuit diagram

Flash the MicroPython firmware to the NodeMCU board. Put the ‘‘ file on it as That way it will be run when the device boots up. Adjust the code to connect to your network and MQTT server first.

You can download the code here.

My device looks like this:

See the Home Assistant documentation for how to integrate the MQTT part with Home Assistant.

The nice thing is: you can press the button to switch the device. The status of the device will update via MQTT and Home Assistant gets a correct status update. You can of course switch the device from within Home Assistant as well.

Happy hacking!

Flattr this!

Bitcoin Paper Wallet Treasure Chest…

The Bitcoin Paper Wallet Treasure Chest
The Bitcoin Paper Wallet Treasure Chest
One of the challenges with bitcoin is to store them securely. There have been several well known incidents where Bitcoins have been stolen. It is no mystery. Bitcoin IS money! It’s the same with Euros or Dollars, when you have it lying around it will eventually be missing.

There is a twist with bitcoin to regular money. With Bitcoin one single piece of information is enough for the thief to steal your Bitcoins: Your private key. With Bitcoin it’s about keeping this piece of information secret.

Continue reading Bitcoin Paper Wallet Treasure Chest…

Flattr this!

Open Street Map RL Wallpaper…

The final result
The final result

We wanted to paint one wall in our vestibule to add a little more color to the room. As we could not settle on a specific color, I thought of wallpaper. And is there any better theme than OpenStreetMap Data¹?

The theme was settled. It had to be a map, but which tiles? I thought of the beautiful pencil drawn MapBox tiles I saw some time ago:

OpenStreetMap Pencil Tiles by MapBox
OpenStreetMap Pencil Tiles by MapBox

We wanted some redish color so I had to convert the image with ImageMagick:

$ ./ 25 file_in.png file_out.png
$ cat
# I found this script in the imagemagick formus:
# It does about the same as gimp with the colorize option.
test -z $1 && exit -1

hue=`convert xc: -format "%[fx:100*$hue/360]" info:`
sat=`convert xc: -format "%[fx:2*$sat]" info:`
test=`convert xc: -format "%[fx:$light<0?0:1]" info:`
light=`convert xc: -format "%[fx:abs($light)]" info:`
if [ $test -eq 0 ]; then

convert \
$2 -set colorspace RGB -colorspace gray -set colorspace sRGB \
-fill "hsl($hue%,100%,50%)" -tint 40% \
-modulate 100,$sat,100 \
-fill $fillcolor -colorize $light% $3

the result is something like this:
Continue reading Open Street Map RL Wallpaper…

Flattr this!

Maischebottich Severin EA 3653…

wer zuhause bier braut benötigt neben viel zeit und geduld auch die nötige ausrüstung. etwas mehr der letzteren wenn man direkt mit malz arbeitet.
hier fällt der arbeitsschritt des maischens an.

fürs maischen und würze kochen habe ich mir einen severin einkochautomat (3653) besorgt. das gerät kostet 70 euro und hat die richtige grösse. mit 29 litern fassungsvermögen geht sich ein 20 liter sud gut aus.

es gibt nur ein kleines problem, den überhitzungsschutz. dieser verhindert dass dickflüssige flüssigkeiten im einkochautomat erhitzt werden. er löst aus und das heizelement lässt sich für ein paar stunden nicht zum arbeiten überreden. um maische gut verarbeiten zu können muss man den überhitzungsschutz deaktivieren.

die gebrauchsanweisung zitiert:

Das Gerät ist durch einen speziellen Übertemperaturbegrenzer vor Überhitzung geschützt. Sollte der Überhitzungsschutz das Gerät abschalten, ziehen Sie den Netzstecker und lassen Sie das Gerät abkühlen. Anschließend ist das Gerät wieder funktionsbereit.
Achtung: Der Einkochautomat ist nur zur Erwärmung von Flüssigkeiten ausgelegt. Dickflüssige Speisen dürfen nicht erhitzt werden, da durch die ungleichmäßige Wärmeabnahme der Überhitzungsschutz das Gerät abschalten kann. Reklamationen aus diesem Grund können daher verständlicherweise nicht anerkannt werden.

das habe ich gelesen, nachdem mir der erste einkochautomat beim maischen den dienst quittiert hat und ich diesen beim händler gegen einen neuen ausgetauscht hatte.
nachdem ich wieder dasselbe gerät hatte, musste ich einen weg um den überhitzungsschutz finden. der stand im weg zwischen mir und meinem bier – das geht nicht. ergo überhitzungsschutz deaktivieren…

hier wird beschrieben wie man das macht. Continue reading Maischebottich Severin EA 3653…

Flattr this!