Let LED blink a code into smart meter


I have a custom built PCB that has an IR LED on it. The purpose is to let it blink a code into a smart meter to activate further options.

Sounds insanly stupid but thats how smartmeters in the EU are designed :slight_smile:

Anyway, what could I do in order to send a pin to the device and then let it blink the code it just received?

Its like blink 2 times to signal that a pin should be entered, then blink 2 times for a 2, wait, blink 5 times for a 5 and so on.

I thought maybe let the IR led just be a simple switch and have a HA script that turns the led on and of in a fixed pattern to blink the code!?

Any better Ideas?