Actually there is an even better option ... But it is a little more work to implement (well, I guess if you are already talking about using diodes and transistors about the same).
Use an opto coupler (ako opto isolator), their purpose is to galvanically seperate two circuits that still need to 'talk' to one another.
Essentially (grossly oversimplified) it is a combo of a LED and Photodiode, the signalling side gets the LED and when the LED lights up the Photodiode will allow current to flow on the receiving side. Thus there needs not be a direct link between signalling and receiving side.
Typically a PC817 is used here.
Example schematic would be (this one is for connecting an inductive proximity sensor to an arduino, same idea, courtesy of a small 'local' electronics store I frequent) :
edit: should point out that there are some cheap ready made boards that are specifically designed for purposes like this that you can probably find on ebay, amazon etc.