No, not directly. You have to update the sketch to use 2.0 API, according to eg this guide:
https://forum.mysensors.org/topic/4276/converting-a-sketch-from-1-5-x-to-2-0-x
Also take note of how initial values have to be sent as mentioned here:
https://home-assistant.io/components/mysensors/#presentation
If you update the example for 2.0, please repost it here, and I can update the docs, or even better make a PR directly to the docs at homeassistant.io.