I have a D1 mini and a relay that I am going to use to make an old lamp "smart".
The lamp has a power cable which I am going to feed into the relay to switch it off and on but is it possible to power the D1 mini from the power cable before the relay so it is always on?
It would save me having to power the d1 mini seperately.
From your question I can conclude that you are a newcomer about electricity and electronics.
ATTENTION !
if your body gets in contact with 110V / 230V you are in severe danger to die !
Your D1 mini will blow up and catch fire if you directly connect it with 110V !
With your minimal knowledge about electricity I highly recommend that you use a
The Mini AC-DC-Adapter has non isolated contacts.
I'm a bit sorry to say that: With your low knowledge keep away from all electricity higher than 12V
For switching your lamp use this ready to use safety certified switch with low-voltage-input
With this product you are safe and don't have to deal anywere with high voltage
If you think "I don't want to spend that amount of money.
Well re-think:
If you could make a contract with the devil to pay $100 to bring back a person to life that has died because of your unprofessional manufactured "smart" lamp
I am very very sure you would pay it.
Be proud of a DIY but safe to use smart lamp by using professional products that you combine.