# Esp32 turn on led

**URL:** <https://community.homey.app/t/esp32-turn-on-led/100544>\
**Category:** Questions & Help\
**Tags:** homey-pro\
**Created:** [January 9, 2024, 10:11am UTC](https://community.homey.app/t/esp32-turn-on-led/100544 "2024-01-09T10:11:24Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![niels\_van\_ruijven](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/niels_van_ruijven/32/81020_2.png) [@niels\_van\_ruijven](https://community.homey.app/u/niels_van_ruijven)\
**Post date:** [January 9, 2024, 10:11am UTC](https://community.homey.app/t/esp32-turn-on-led/100544/1 "2024-01-09T10:11:24Z")

</div>

Hello,  
I’m trying to turn on a led with a esp32 on the new homey pro 2023. i now have my esp32 connected to my Homey with Homeyduino. But now i am searching for a script to turn on and turn off the led but i cant find it and everything i found is not working. is their maybe something wrong with te connection to the Homey.

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [January 9, 2024, 10:32am UTC](https://community.homey.app/t/esp32-turn-on-led/100544/2 "2024-01-09T10:32:36Z")

</div>

To me, the [ESPhome app](https://community.homey.app/t/app-pro-esphome/87271) is easier to use. You might want to check it out.

---

<div class="post-metadata">

**Author:** ![niels\_van\_ruijven](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/niels_van_ruijven/32/81020_2.png) [@niels\_van\_ruijven](https://community.homey.app/u/niels_van_ruijven)\
**Post date:** [January 9, 2024, 11:23am UTC](https://community.homey.app/t/esp32-turn-on-led/100544/3 "2024-01-09T11:23:55Z")

</div>

alright do you have a script for that?

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [January 9, 2024, 11:30am UTC](https://community.homey.app/t/esp32-turn-on-led/100544/4 "2024-01-09T11:30:02Z")

</div>

Did you read [the fine manual](https://esphome.io/#light-components)?

---

<div class="post-metadata">

**Author:** ![niels\_van\_ruijven](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/niels_van_ruijven/32/81020_2.png) [@niels\_van\_ruijven](https://community.homey.app/u/niels_van_ruijven)\
**Post date:** [January 9, 2024, 2:05pm UTC](https://community.homey.app/t/esp32-turn-on-led/100544/5 "2024-01-09T14:05:56Z")

</div>

I am looking at that now but i dont know how to connect it to my homey

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [January 9, 2024, 2:24pm UTC](https://community.homey.app/t/esp32-turn-on-led/100544/6 "2024-01-09T14:24:24Z")

</div>

The ESPHome app for Homey was already linked to.

---

<div class="post-metadata">

**Author:** ![niels\_van\_ruijven](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/niels_van_ruijven/32/81020_2.png) [@niels\_van\_ruijven](https://community.homey.app/u/niels_van_ruijven)\
**Post date:** [January 9, 2024, 2:38pm UTC](https://community.homey.app/t/esp32-turn-on-led/100544/7 "2024-01-09T14:38:31Z")

</div>

I have that app already but i cant get it connected to my homey

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [January 9, 2024, 2:50pm UTC](https://community.homey.app/t/esp32-turn-on-led/100544/8 "2024-01-09T14:50:30Z")

</div>

You have to be a bit more forthcoming if you want help, nobody here has any idea why you can’t get it working if you don’t provide more information, like the YAML file that you’re using for your ESPHome project, if you’re getting any errors, etc.

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [January 9, 2024, 2:57pm UTC](https://community.homey.app/t/esp32-turn-on-led/100544/9 "2024-01-09T14:57:47Z")

</div>

Most app have its own app topic here, often with manuals, howto, FAQ.  
These links can be found at the app page at homey.app store

While I checked it already,  
[here you go](https://community.homey.app/t/app-pro-esphome/87271)

This app developer wrote an outstanding fine manual, but take your time to read it I’d like to say.

---

<div class="post-metadata">

**Author:** ![niels\_van\_ruijven](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/niels_van_ruijven/32/81020_2.png) [@niels\_van\_ruijven](https://community.homey.app/u/niels_van_ruijven)\
**Post date:** [January 10, 2024, 7:27am UTC](https://community.homey.app/t/esp32-turn-on-led/100544/10 "2024-01-10T07:27:58Z")

</div>

peter thank you i took a look at it now but i dont have the software i think to get the esp connected. what sofware should i get?

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [January 10, 2024, 7:56am UTC](https://community.homey.app/t/esp32-turn-on-led/100544/11 "2024-01-10T07:56:31Z")

</div>

You’re welcome, Niels.

Robert linked to it already, but here you go

> [@\[HOW-TO\]\[Pro\] Using ESPhome devices - no additional hardware](https://community.homey.app/t/how-to-pro-using-esphome-devices-no-additional-hardware/90258/1):
>
> ### install and run ESPhome itself on your laptop/pc:
> 
> [Getting Started with ESPHome - ESPHome - Smart Home Made Simple](https://esphome.io/guides/getting_started_command_line)
> 
> Here’s my local ESPhome page:
> 
> > ![Screenshot from 2023-09-26 02-58-48](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/1/01b0036f4087110751045d36113832302fca2b81.png)
> 
> ### When it’s up and running:
> 
> - On Homey, to _ **add or edit** _ a ESPhome device, always start with the “add new device” and select ‘ESPhome’ to start the _ **wizard** _
> - Pick what you’d like to do:
> - 
> - Configure a new physical device
> 
> - 
> - Update an existing physical device
> 
> ### Now go check out the ESPhome manual / wiki

---

<div class="post-metadata">

**Author:** ![niels\_van\_ruijven](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/niels_van_ruijven/32/81020_2.png) [@niels\_van\_ruijven](https://community.homey.app/u/niels_van_ruijven)\
**Post date:** [January 10, 2024, 8:58am UTC](https://community.homey.app/t/esp32-turn-on-led/100544/12 "2024-01-10T08:58:37Z")

</div>

i have downloaded the python and installed the esphome but do you need the home assistant app and is it possible to connect a canbus this way or not.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [January 10, 2024, 9:48am UTC](https://community.homey.app/t/esp32-turn-on-led/100544/13 "2024-01-10T09:48:37Z")

</div>

> [@niels\_van\_ruijven](#):
>
> i have downloaded the python and installed the esphome but do you need the home assistant app

No, you need the ESPHome app for Homey.

> [@](#):
>
> and is it possible to connect a canbus this way or not.

I feel that most of your questions can easily be answered by just doing a basic search with Google or [on the ESPHome website](https://esphome.io/components/canbus.html).

---

<div class="post-metadata">

**Author:** ![niels\_van\_ruijven](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/niels_van_ruijven/32/81020_2.png) [@niels\_van\_ruijven](https://community.homey.app/u/niels_van_ruijven)\
**Post date:** [January 10, 2024, 11:04am UTC](https://community.homey.app/t/esp32-turn-on-led/100544/14 "2024-01-10T11:04:04Z")

</div>

sorry but i am still new and i trie to figure it out. I have never heard of a yaml file and a command promt and i have no idea how to get a code on a esp32 using that. I have configured the esphome wizard and got it connected to the wifi. and found it on the esphome app but when i leave the esphome wizard on homey it is gone.

---

<div class="post-metadata">

**Author:** ![niels\_van\_ruijven](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/niels_van_ruijven/32/81020_2.png) [@niels\_van\_ruijven](https://community.homey.app/u/niels_van_ruijven)\
**Post date:** [January 10, 2024, 11:04am UTC](https://community.homey.app/t/esp32-turn-on-led/100544/15 "2024-01-10T11:04:30Z")

</div>

try\*

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [January 10, 2024, 11:10am UTC](https://community.homey.app/t/esp32-turn-on-led/100544/16 "2024-01-10T11:10:24Z")

</div>

Perhaps ask a specific question in the [ESPHome app thread](https://community.homey.app/t/app-pro-esphome/87271).

---

<div class="post-metadata">

**Author:** ![niels\_van\_ruijven](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/niels_van_ruijven/32/81020_2.png) [@niels\_van\_ruijven](https://community.homey.app/u/niels_van_ruijven)\
**Post date:** [January 12, 2024, 12:24pm UTC](https://community.homey.app/t/esp32-turn-on-led/100544/17 "2024-01-12T12:24:22Z")

</div>

Hello again,

i now have dowloaded esphome and it all works with my homey. I now try to turn on a led with a canbus signal i have search on the esphome site and i can read a massage and send one. but i cant figure out how to read a massage and then toggle the led everytime i read the massage this is my yaml script

```auto
esphome:
  name: led

esp32:
  board: nodemcu-32s
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "0641312666"

ota:
  password: "0641312666"

wifi:
  ssid: "SewerRobotics"
  password: "0641312666"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Led Fallback Hotspot"
    password: "UHa6BfRFXMQy"

captive_portal:
    

canbus:
  - platform: esp32_can
    tx_pin: GPIO23
    rx_pin: GPIO22
    can_id: 4
    bit_rate: 125kbps
    on_frame:
    - can_id: 43 # the received can_id
      then:    
        - if:
            condition:
              lambda: 'return (x.size() > 0) ? x[0] == 0x11 : false;'
            then:
              light.toggle: led1

i2c:
  sda: GPIO26
  scl: GPIO27

# Example configuration entry
sensor:
  - platform: ultrasonic
    trigger_pin: GPIO5 # Verbind met de Trig-pin van de HC-SR04
    echo_pin: GPIO4  
    name: "Ultrasonic Sensor"
    update_interval: 2s

  - platform: dht
    pin: GPIO25
    temperature:
      name: "Living Room Temperature"
    humidity:
      name: "Living Room Humidity"
    update_interval: 60s

output:
  - platform: gpio
    pin: GPIO12
    id: my_output
  - platform: gpio
    pin: GPIO14
    id: my_output1

light:
  - platform: binary
    name: "My Monochromatic Light"
    output: my_output
    id: led1
  
  
  - platform: binary
    name: "My Monochromatic Light1"
    output: my_output1

```

do anyone see what i am doing wrong?

---

<div class="post-metadata">

**Author:** ![niels\_van\_ruijven](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/niels_van_ruijven/32/81020_2.png) [@niels\_van\_ruijven](https://community.homey.app/u/niels_van_ruijven)\
**Post date:** [January 12, 2024, 12:35pm UTC](https://community.homey.app/t/esp32-turn-on-led/100544/18 "2024-01-12T12:35:16Z")

</div>

i have find it i was sending the wrong id with the canbus signal
