squashed and merged from https://github.com/swamius/Smartmeters f106410c36 .. 127dfcea8c