@hreintke your fix worked, and, by printing the value of dat over serial while the device ran I was able to record two instances in about 20 hours where the value of dat spontaneously became 0xFFFFFFFF.
@ystrem: its too much superlatives - "control all devices in home" - I just dont buy this. All devices? and installation less then minute. Probably its not just installation - configuration- integration - what about time taken for this...?
It seems unreal for me... But maybe for somebody else they will buy it :)