# Switch and light(s) using one ESP8266

**URL:** <https://diyhue.discourse.group/t/switch-and-light-s-using-one-esp8266/67>\
**Category:** Hardware\
**Created:** [January 29, 2020, 4:27pm UTC](https://diyhue.discourse.group/t/switch-and-light-s-using-one-esp8266/67 "2020-01-29T16:27:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Loos](https://avatars.discourse-cdn.com/v4/letter/l/e36b37/32.png) [@Loos](https://diyhue.discourse.group/u/Loos)\
**Post date:** [January 29, 2020, 4:27pm UTC](https://diyhue.discourse.group/t/switch-and-light-s-using-one-esp8266/67/1 "2020-01-29T16:27:38Z")

</div>

I have a wall spot light with button. I would like to use the button as a control button and the light as a controlled (RGBW) light. Can I do that with just one esp8266 (ESP-12 in this case)?

If so, an example of the code would be appreciated.

---

<div class="post-metadata">

**Author:** ![alex](https://yyz2.discourse-cdn.com/free1/user_avatar/diyhue.discourse.group/alex/32/14_2.png) [@alex](https://diyhue.discourse.group/u/alex)\
**Post date:** [January 30, 2020, 4:01pm UTC](https://diyhue.discourse.group/t/switch-and-light-s-using-one-esp8266/67/2 "2020-01-30T16:01:19Z")

</div>

If the button is attached to the same esp8266 you could be able to pull that off with ESPhome and diyhue integration.
