You need to configure your digital potentiometer as a rheostat. If you connect the wiper with one of the terminals A or B, you will get a variable resistor between the two terminals A and B.
According to the datasheet, the wiper is at B when the digital potentiometer is set to 0, and A at full scale. This means you can choose whether the resistor will be near 0\$\ \Omega\$ or 10 k\$ \Omega\$ when you set the min/max value in software depending if you connect A or B to the wiper. This may make your software routine more convenient.
It looks like your WeMos embeds a voltage regulator, do you use it? Or put it another way, which pin do you use to power the WeMos, the "3V3" one or the "5V" one? The voltage regulator input is connected to the 5V pin, and its output is connected to the 3V3 pin and the ESP8266.
In any case, the ESP8266 input voltage must be between 2.5V and 3.6V according to the datasheet (table 5-1 p18). You should use the 5V pin because your battery voltage can be as high as 4.2V and you will probably kill the ESP8266 if you power it directly without the voltage regulator. However, a voltage regulator can only lower the voltage, not raise it, and will always have a small dropout voltage usually around 300mV. This means that when your battery voltage falls below 2.8V, the ESP8266 input voltage falls below 2.5V, outside of its specs, and its behavior becomes undefined. I've had the case in the past with microcontrollers "freezing" or acting strangly with bad input voltage because it caused execution errors that the CPU couldn't recover from, so I'm not surprised that you need a manual reset. If the ESP8266 freezes into a state where it draws lots of current, this can also prevent your battery from charging.
In any case, it is usually not recommended to drop a LiPo below 3V. I guess the best answer to your problem is an UVLO (under-voltage lockout circuit) which will disconnect the battery when its voltage falls below 3V. I usually go for a LMS33460 3V voltage detector together with a MIC94083 power switch for this purpose. You could also try to find another battery with a PCM (Protection Circuit Module, the small board hidden in the orange tape on the end of the battery) that cuts at about 3V, such as this one from Adafruit (look at the batteries datasheets).
Also, keep in mind that if you directly charge the battery while the WiMos is still powered on it, the current consumption of the WiMos might interfere with the charging algorithms of the TP4056. Usually, some kind of power multiplexing circuit is required. This can be as simple as adding a wire and a diode, see how Adafruit does it on their HUZZAH board (top left corner) : the battery is connected to the regulator through a diode, and the +5V coming from the USB is connected both to the charger input and the regulator input. When a USB charger is plugged in, the diode will be blocked by a reverse voltage (5V > 4.2V), effectively disconnecting it and allowing the regulator to charge it cleanly. The downside is that you substract the diode's drop voltage to your useful battery voltage. By the way, if you want to make your circuit simpler, you might consider replacing your WeMos with a HUZZAH which has everything builtin.
Best Answer
Ok, the solution is quite simple (in my first schema I forget to add a resistor between A0 and GND) but I decided to replace 10k resistor with 20k trim pot so I can adjust to exact value). I hope this will help someone.