Custom sensor

Hii there
I would like to build my own custom made sensor and send some strings of code to Home Assistant.
And accordingally set things in my home.
I would like to use a Raspberry Pi for the system of my sensor and send the signals from there to Home Assistant.
How do I go about?

start reading