This system will introduce an additional weight of 7 grams (about 6 grams for the battery with the switch and 1 gram for the 2 LEDs and their wiring) .
All the parts will be arranged considering/improving the balance of the wheel to limit inertial forces for the smoothest ride and for the best lightening and visibility effect.
Step 1: Balance the wheel
The rim has often reinforcements in its junction area and a hole for the inner tube stem on the other side. The weight of this stem is most of the time not enough to compensate what is on the other side so the wheel is not perfectly balanced.
For this reason I prefer to use inner tubes with long stems even with low profile wheels to have a better compensation.
Before installing the battery near the hub check the current balance of the wheel to see where its additional weight could give some benefit.
Put the wheel on a stand, otherwise turn the bicycle upside down, disengage the chain from the sprockets so it can freely rotate with the minimum effort required. The tyre should be inflated at the operating pressure.
Spin the wheel a little an let it swing until it stops. The bottom of the wheel shows where the heavier point is, so the battery should be installed on the opposite side of the hub and close to it (see picture). The closer to the hub the less inertial contribution it will give to the wheel without requiring any strong fixing.