merge from trilu
small changes
change from Thorsten: http://forum.fhem.de/index.php/topic,20620.msg169842.html#msg169842