RF433 door switch example

Could you guys please give me some examples of how I would use a RF433 TX and RX to send the state of a door.

Right now with my testing im using a binary_sensor, which just sends the state ON and then immediately sends the state OFF.

Could you please give me some examples of how to send a ON when open and only send a OFF when closed again.

Throwing in a deep sleep wake when open would be a bonus.

I could find bits and peices here and there but could not find a matching transmitter and receiver code to work with.

Im basicly trying to achieve

ESP Wemos Battery Shield Sleeps in deep sleep
When GPIOx is triggered (door is opened) wake from deep sleep.
Send RF code to say door is open.
Return to deep sleep.

Im not sure if I should bother with a restore, or how the best way to integrate this with deep sleep would be, either wait for the door to be closed again, or sleep again, then wake again when the door is closed and then sleep again.

The door should not be open for long, its a letterbox.

Happy to hear your thoughts.

Thanks

If you are using an ESP device, then why bother with RF codes?
ESP devices should be able to connect directly to WiFi and integrate that way with HA.

Regarding your detection of both open and closed, then you need a sensor that can do both states or your need a separate sensor for each state.

because of distance, there is no wifi where the device is going.