Closes https://github.com/esphome/esphome/pull/706
Fixes https://github.com/esphome/esphome/pull/698#discussion_r318212018