Wordclock…

I made a Wordclock with MicroPython and an ESP8266, and one with a Raspberry Pi and Python.

I gave a talk at Grazer Linuxtage about the build process. You can see the talk on CCC’s media website or on YouTube.

The slides can be found here: https://flowolf.github.io/glt18-talk.

At some point I’m planning on releasing the source code and the vector files for the Wordclock face. Have still some cleaning up to do. In the mean time: there are several word clock projects out there that use a Raspberry Pi and Python; just search for them.

Flattr this!

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:

1
2
3
4
5
6
7
8
9
10
11
12
binary_sensor:
  platform: template
  sensors:
    door1:
      device_class: opening
      friendly_name: 'Haustür'
      value_template: >-
        {%- if is_state("sensor.mydoor_access_control", "22") -%}
          True
        {%- else -%}
          False
        {%- endif -%}

this can then be integrated into an automation like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
automation:
  alias: "coming home"
  hide_entity: False
  trigger:
    platform: state
    entity_id: binary_sensor.door1
    from: 'off'
    to: 'on'
  condition:
    condition: sun
    after: sunset
  action:
    - service: homeassistant.turn_on
      entity_id:
        - 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!

HOWTO setup your very own Jabber server…

XMPP (aka Jabber) in combination with OTR is a secure way to chat with others. There are some public servers available, but their popularity centralizes the infrastructure and leaves single points of failure. A recent example is Chaos Computer Club’s Jabber server (jabber.ccc.de) which was down for some days between Christmas and New Years 2014/2015, as a consequence of a DOS attack.

I’ve been setting up a Jabber server of my own on my Raspberry Pi. Here is how you can too:
Continue reading HOWTO setup your very own Jabber server…

Flattr this!

Fail2ban country statistics…

I was lucky enough to seize a “Raspberry Pi Colocation“-slot for my Raspberry Pi.

To secure it further I just recently installed fail2ban.
The software basically detects login attempts and blocks the IP for some limited time in the future. This prevents a depletive password guessing for server logins.

I was interested in the password-guessers` country of origin. Now I can confirm, at least for my Raspberry Pi, that most attacks come from China.

1
2
3
4
5
6
7
8
9
    110       CN
      2       UA
      2       RU
      2       DE
      1       VN
      1       PE
      1       KR
      1       CZ
      1       BD

the quick and dirty command for this looks like this: (you need to have ‘whois’ installed)

1
2
3
4
for i in `sudo cat /var/log/fail2ban.log | sed 's/.*[Bb]an \(.*\)/\1/' | sort | uniq | cut -d ' ' -f 1 | grep "\."`; do
  echo $i; whois $i | grep country\: |head -n 1 >> fail2ban_ctry.log ;
done
cat fail2ban_ctry.log fail2bancry2.log | sed 's/country:  //g' |sort | uniq -c |sort -nr

Flattr this!

Tech, Food, Life