Killing hanging polling in Jenkins

For one reason or another Jenkins sometimes gets stuck when polling SCM (which is, apparently, a known issue, cf [JENKINS-5413] SCM polling getting hung – Jenkins JIRA ).

This can lead to a variety of problems.

For us, some pipelines simply would not run anymore automatically.

To get rid of the hanging polling jobs, I came up the following Groovy System Script (note the “system” part). You can simply add this to a freestyle job and run at regular intervals or via the script console of the master (Manage Jenkins -> Script Console)

import hudson.model.Hudson
import hudson.model.Hudson
import hudson.triggers.SCMTrigger

now_ms = new Date().getTime()
hour_ms = 1000 * 60 * 60
// 6 hours
threshold = 6 * hour_ms 

SCM_TRIGGER_DESCRIPTOR = Hudson.instance.getDescriptorOrDie(SCMTrigger.class)
runners =  SCM_TRIGGER_DESCRIPTOR.getRunners()
runners.each() { it ->
  def tgt_name =
  def dur = now_ms - it.startTime
  println tgt_name + ' running for ' + it.duration
  if(dur > threshold) { 
    tgt = Thread.getAllStackTraces().keySet().find() { item ->
      item.getName().contains("SCM polling") && item.getName().contains(tgt_name)
    if (tgt) {
      println '-- stuck in polling, canceling '
      println '---> ' + tgt
    } else {
      println '-- not stuck in polling '
  } else {
    println '-- below threshold '
  println '---'

Fixing Boot Camp WiFi issues

After installing Windows 10 on my old MacBook Air I ran into some problems with my WiFi. Specifically, WiFi drops every so often when using Boot Camp. The network connection simply stalls for some time and then I would manually need to reconnect the connection to make it work again.

As it turns out, the solution that worked for me is quite simple: Going back to an older version of the Broadcom driver. Goto Device Manager, select “Network Adapater” and then pick the Broadcom 802.11n network adapter. The driver version used is probably something like

2016-05-09 22_29_28-Clipboard

Select “Update Driver”, then do “seach on this computer” and click on “select from list” From that list select version, click next – done.

2016-05-09 22_32_17-Edit Post ‹ Oliver van Porten — WordPress


I recently read an article in the German computer magazine c’t about controlling simple plugin switches via pilightPilight is a small piece of software with a built in web-based GUI that can control a variety of devices. This intrigued me quite a bit since I still had a cheap Brennstuhl RCS 1000 N comfort lying around here, which is exactly the switch set used in the article and is apparently supported quite well by pilight.

So, of course, I sat down and ordered a GPIO Full Kit from the pilight shop as well as a DHT22/AMS2302 temperature and humidity sensor from Amazon, plus some resistors, cables and my very first bread board.

Continue reading “Pilight”

Home Assistant

I believe home automation, at least for me, is to a large extent driven by the joy of trying out new things and extending my system. I think this is why, despite my previous endeavors into FHEM, I kept on tinkering with Home Assistant. I am a big Python fanboy and do dislike PERL with a passion, so it seems in a way natural to do so.

Home Assistant States
Snapshot of my Home Assistant setup – obviously it is a work in progress.

There are a lot of things going on around Home Assistant at the moment and I think that is quite fantastic. In this post I’d like to take a moment to describe the basic steps needed to get up and running with Home Assistant on a Raspberry Pi, including setting up InfluxDB and Grafana for all your graphing needs.

Continue reading “Home Assistant”

Home Automation with FHEM

For a while I was fairly happily running OpenHAB to control and automate my HomeMatic devices. I had a few rules configured to trigger outdoor lighting and the like. There were a few delays occasionally, though, which I think may have been due to network timing or simply due to a delay in receiving the events from the CCU2.

At some point a few weeks ago I decided that enough was enough. I moved all automation rules directly onto the CCU2. After some playing around and struggling with a few details I have a setup that works quite well now. Most importantly it is faster than it used to be, which was the whole point of the exercise.

Next to the slowness in automation I never liked the OpenHAB UI – the classic UI that is. The paper UI looks a lot nicer, but also that lacks a few features I would like to have plus is not really release for production yet.

In any case I decided it was time to move to something else. I started by exploring the benefits of using MQTT. I did that with the help of Mosquitto, hm2mqtt and Home Assistant. I even contributed some code to Home Assistant to make it work with the json messages sent by hm2mqtt. I like Home Assistant a lot, simply because it is written in Python and as such makes contributing easy for me. However, also the UI did not completely satisfy me, so I kept looking.

Sometime last week then I revisited FHEM. I had looked at FHEM in the beginning of my home automation journey and abandoned it at the time. The two main reasons were the UI, but more importantly the lack of support for using a CCU2 to control HomeMatic devices.

Luckily that has changed a lot now. While MQTT is of course always an option there is the HMCCU module now. That finally provides a way to control a CUU2 plus the module is under active development (as opposed to the old HMRPC module).

Next to that, there is also the new Tablet UI now that is visually appealing and really is absolutely what I was looking for. It is based on HTML , CSS and JavaScript and as such works in virtually any modern browser. More importantly, it is easy enough to customise the interface.

FHEM Tablet UIWhat you see here is a snapshot of my current setup. It is very much a work in progress now, but it already covers a lot more features than I used to have when still running on OpenHAB. I will post more detailed instructions and lessons learned once I am done, of course.

The one thing I currently find lacking in FHEM is the connectivity from outside your home. OpenHAB’s service is quite a nice feature which I’d like to see in FHEM as well. Using simple port forwarding will also work, I guess, but also that I still need to setup.

The other downside of FHEM is, obviously, that it is written in Perl, which I hate with a passion. I did share my first fix for HMCCU already, though, so I guess I will adapt over time. 🙂



Home Smart Home – A Few Weeks Later

After a few attempts to get my Z-Wave network to work reliably I finally decided to maybe try something else for the outdoor lights. The Z-Wave setup did not have the range to cover my driveway and yard, unfortunately.

Now, I decided to go with the HomeMatic. That really worked like a charm from day one. My current setup now looks like illustrated on the following picture.

I use three HomeMatic Actors to switch the five lamps in my yard and driveway (2+2+1). The HomeMatic motion detector is used to measure lumincance as well and switches on the lights when it gets dark permanently. At nine o’clock it then goes into motion detector mode and only switches the lights on if motion is detected. In the morning, I also turn on the lights at seven or so and turn t hem off when it gets too bright or after nine o’clock, whichever comes first.

The Z-Wave Plugin Switch control a chain of lights at the moment. Once winter is over I will find other uses for it. Finally, the WALLC-S is used to turn on the lights outside manually and I am planning on installing the AEO_MULTISENS as a secondary motion detector at some point.

Control of course happens through my OpenHAB installation on my RaspberyPI that is now equipped with a Z-Wave Plus controller and also acts as the central control unit for the HomeMatic devices through a CCU2.

Of course I also use OpenHAB to turn my DiskStation DS212+ on and off.

Finally a working setup – now off to the next advenctures in home automation. Automatic roller shutters probably. Or finally installation a tablet-based control unit in my living room. Or probably both 🙂

Resetting Z-Wave devices

Since I bought a new Z-Wave controller recently (ZME_UZB which support Z-Wave PLUS) I was now facing an issue there I needed to remove a device from my old controller (ZME_Z-StickC). However, I did not have the old controller available.

Including Z-Wave devices that are already registered with another Z-Wave network does not work immediately. The device needs to be factory reset first.

Resetting the device is easy also without the original controller, once you know how:
Simply use ANY controller and put into EXCLUSION mode. Afterwards, follow the instructions for exclusion of your device (e.g. tripple-click one of the buttons on my switch).

After that, the device is excluded (from its original network, although another controller triggered the exclude) and thus reset to factory defaults. Once that has happened inclusion works again.