12 days later and after a family free weekend, my solution is build and running! @ReneTode Thanks again for the NodeMCU idea.
So here it is, my battery powered and HA integrated lamp:
The solution consist of - Hardware:
- A NodeMcu
- A breadborad
- A FQP30N06L Fairchild MOSFED
- A LED USB chain of lights
- Some cables and adapters
- And a powerbank - this is tricky, since you don’t know who much power has to be consumed to stop the powerbank from turning off. I had luck with the one I had already at home, since its even not turning of even if only the NodeMCU is running with the lights turned off.
Software:
- A NodeMCU firmware
- Some lines lua Script inspired by this post Fully working MQTT examples temperature, buttons, RGB, etc. - Everything ESP8266
- HA and its MQTT component and build in broker
The wiring is quiet easy. The powerbank has two outputs, so one powers the nodeMCU and the other one is for the light. The USB VBUS IN is directly connected the the USB VBUS OUT to the light. GND IN is connected to the Source of the MOSFET and and MOSFET Drain in connected to GND OUT. The MOSFET Gate is triggered by the GPIO D0 of the NodeMCU. That’s it. No setp-up/setp down or anything needed!
TODO:
- Find a bigger powerbank which does not turn off on low power consumption
- Build more cool stuff based on a NodeMCU