Fix all warnings and added D0 wait end sync feature

Two change-sets/commits:
a) fix all compilation warnings and one clang compilation error
b) added a new parameter/option for D0 devices: "wait_sync":
It's intended for devices that start continuosly sending data. For
those devices (e.g. Hager EHZ361) the parsing of the messages at
startup fails most of the times without this option.
Currently only the mode "end" (so add "wait_sync" : "end", to the conf
file) is supported which skips data from the device until the end of a
message ("!") is found. This is only done once after startup and
includes a sanity check to skip a maximum data to avoid an endless loop.