How to build custom device in esphome

how can I use the code from here to esphome?

thanks

Or: How to shower and don’t get wet? :shower:

You probably can’t directly make use of the code but just use it as a blueprint when coding the functionalities (again) for esphome.

You can check the custom components available on esphome.io for a start