Solution for (cheap) sensors changing their ID while changing the batteries

Several sensors change their ID while changing the batteries
to solve that here a working solution for 3V powered sensors (for others change to needed values of batteries):
buy a battery holder for two standard batteries
for example like shown in the image

put in the two batteries,
add an electronic clip (i prefer “crocodile clips”) to the MINUS wire, add a resistor of ~22 Ohm (250mW type) to the PLUS wire and the add another electronic clip to the other end of the resistor.

if you want to change the batteries of a sensor, open the case, attach the MINUS clip to the MINUS input and the PLUS clip to the PLUS input of the sensor .
now the sensor is powered while changing the batteries and doesn’t change it’s ID.
replace the batteries disconnect the clips, ready.