r/Esphome 5h ago

INA228 doesn’t connect

2 Upvotes

Hello! I am stuck with a problem of an INA228 sensor. Here a script which is working:

``` esphome: name: ina228reader

esp32: board: esp32dev framework: type: arduino

logger: level: DEBUG

Enable OTA updates

ota: platform: esphome

Enable API (optional, for Home Assistant)

api:

wifi: ssid: « xxx » password: « xxx »

i2c: sda: GPIO21 scl: GPIO22 scan: true # Will print all devices found on bus frequency: 100000

INA228 sensor configuration

sensor: - platform: ina2xx_i2c model: INA228 address: 0x40 shunt_resistance: 0.02 ohm max_current: 10 A update_interval: 2s

bus_voltage:
  name: "INA228 Bus Voltage"

current:
  name: "INA228 Current"

power:
  name: "INA228 Power"

```

This outputs successfully:

``` 14:43:55.984 -> [0;36m[D][sensor:103]: 'INA228 Bus Voltage': Sending state 3.31562 V with 5 decimals of accuracy[0m

```

Then I wanted to integrate this into my bigger device but doing so without success: ```esphome: name: voltage-sensor on_boot: priority: -100 then: - light.turn_on: board_led - delay: 10s # Give time to get measurements #- component.update: solar_voltage_bus_voltage - component.update: battery_voltage - component.update: battery_status - component.update: solar_status - component.update: timestamp - component.update: outside_temperature - component.update: inside_temperature

- wait_until:

condition:

lambda: return !isnan(id(solar_voltage).state) && !isnan(id(battery_voltage).state);

timeout: 10s

  - mqtt.publish:
      topic: voltage-sensor/solar_voltage
      payload: !lambda 'return to_string(id(solar_voltage_bus_voltage).state);'
  - mqtt.publish:
      topic: voltage-sensor/battery_voltage
      payload: !lambda 'return to_string(id(battery_voltage).state);'
  - mqtt.publish:
      topic: voltage-sensor/battery_status
      payload: !lambda 'return id(battery_status).state;'
  - mqtt.publish:
      topic: voltage-sensor/solar_status
      payload: !lambda 'return id(solar_status).state;'
  - mqtt.publish:
      topic: voltage-sensor/outside_temperature
      payload: !lambda 'return to_string(id(outside_temperature).state);'
  - mqtt.publish:
      topic: voltage-sensor/inside_temperature
      payload: !lambda 'return to_string(id(inside_temperature).state);'
  - wait_until:
      condition:
        lambda: return id(sntp_time).now().is_valid();
      timeout: 15s
  - component.update: timestamp
  - mqtt.publish:
      topic: voltage-sensor/timestamp
      payload: !lambda 'return id(timestamp).state;'
  - delay: 10s  # Give MQTT time to publish
  - light.turn_off: board_led
  - deep_sleep.enter: deep_sleep_1

esp32: board: esp32dev framework: type: esp-idf

Enable logging

logger:

Enable Home Assistant API

api:

encryption:

key: "xxx"

ota: - platform: esphome password: « xxx »

mqtt: broker: xxx.s1.eu.hivemq.cloud port: 8883 username: xxx password: xxx discovery: false certificate_authority: | -----BEGIN CERTIFICATE----- xxx -----END CERTIFICATE-----

wifi: ssid: !secret wifi_ssid password: !secret wifi_password

# Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "Voltage-Sensor Fallback Hotspot" password: « xxx »

captive_portal:

time: - platform: sntp id: sntp_time timezone: Pacific/Tahiti

one_wire: - platform: gpio pin: GPIO4 id: bus_ds18b20

i2c: sda: GPIO21 scl: GPIO22 scan: true # Will print all devices found on bus frequency: 100000

sensor: - platform: ina2xx_i2c model: INA228 address: 0x40 shunt_resistance: 0.02 ohm max_current: 10 A update_interval: 2s bus_voltage: name: "Solar Voltage" id: solar_voltage_bus_voltage

  • platform: adc pin: GPIO35

    name: "Battery Voltage"

    id: battery_voltage update_interval: 10min attenuation: 11db filters:

    • multiply: 5 unit_of_measurement: "V" accuracy_decimals: 3
  • platform: dallas_temp one_wire_id: bus_ds18b20 address: 0x7a3ce1045753f828

    name: "Outside Temperature"

    id: outside_temperature resolution: 12 update_interval: 60s

  • platform: dallas_temp one_wire_id: bus_ds18b20 address: 0x593ce10457150728

    name: "Inside Temperature"

    id: inside_temperature resolution: 12 update_interval: 60s

text_sensor: - platform: template #name: "Battery Status" id: battery_status icon: "mdi:battery" lambda: |- if (id(battery_voltage).state > 12.7) { return std::string("Full"); } else if (id(battery_voltage).state > 12.4) { return std::string("Charging"); } else if (id(battery_voltage).state > 12.0) { return std::string("Medium"); } else if (id(battery_voltage).state > 11.5) { return std::string("Low"); } else { return std::string("Critical"); }

  • platform: template id: solar_status icon: "mdi:white-balance-sunny" lambda: |- auto voltage = id(solar_voltage_bus_voltage).state; if (voltage > 20.0) { return std::string("Full Sun"); } else if (voltage > 10.0) { return std::string("Partial Sun"); } else if (voltage > 1.0) { return std::string("Weak Sun"); } else { return std::string("Night"); }

  • platform: template id: timestamp lambda: |- auto t = id(sntp_time).now(); if (!t.is_valid()) return std::string("invalid");

    const char* months[] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };

    char buffer[48]; snprintf(buffer, sizeof(buffer), "%02d %s %d, %02d:%02d:%02d %s", t.day_of_month, months[t.month - 1], t.year, t.hour, t.minute, t.second, "TAHT");

    return std::string(buffer); update_interval: 60s

output: - platform: gpio pin: GPIO2 id: led_builtin

light: - platform: binary name: "Board LED" output: led_builtin id: board_led

deep_sleep: id: deep_sleep_1 sleep_duration: 10min

```

Here I get:

``` 14:49:38.290 -> [0;35m[C][ina2xx:196]: INA2xx:[0m 14:49:38.322 -> [0;35m[C][ina2xx:197]: Device model = INA228[0m 14:49:38.322 -> [1;31m[E][ina2xx:200]: Device model mismatch. Found device with ID = 0. Please check your configuration.[0m 14:49:38.322 -> [1;31m[E][ina2xx:204]: Communication failed[0m 14:49:38.322 -> [0;35m[C][ina2xx:206]: Update Interval: 2.0s[0m 14:49:38.322 -> [0;35m[C][ina2xx:207]: Shunt resistance = 0.020000 Ohm 14:49:38.322 -> Max current = 10.000000 A 14:49:38.322 -> Shunt temp coeff = 0 ppm/°C 14:49:38.354 -> ADCRANGE = 0 (±163.84 mV) 14:49:38.354 -> CURRENT_LSB = 0.000000 14:49:38.354 -> SHUNT_CAL = 0[0m 14:49:38.354 -> [0;35m[C][ina2xx:218]: ADC Samples = 128; ADC times: Bus = 4120 μs, Shunt = 4120 μs, Temp = 4120 μs[0m 14:49:38.354 -> [0;35m[C][ina2xx:224]: Device is INA228[0m 14:49:38.354 -> [0;35m[C][ina2xx:227]: Bus Voltage 'Solar Voltage' 14:49:38.354 -> State Class: 'measurement' 14:49:38.354 -> Unit of Measurement: 'V' 14:49:38.354 -> Accuracy Decimals: 5[0m 14:49:38.354 -> [0;35m[C][ina2xx:227]: Device Class: 'voltage'[0m 14:49:38.387 -> [0;35m[C][ina2xx_i2c:020]: Address: 0x40[0m 14:49:38.387 -> [1;31m[E][component:145]: ina2xx_base is marked FAILED: unspecified[0m 14:49:38.387 -> [0;35m[C][adc.esp32:121]: ADC Sensor 'battery_voltage' 14:49:38.387 -> State Class: 'measurement' 14:49:38.387 -> Unit of Measurement: 'V' 14:49:38.387 -> Accuracy Decimals: 3[0m

```

Someone has as idea why this isn’t working?


r/Esphome 1d ago

I've Made A Smart Air Freshener Using ESPHome

Thumbnail
gallery
87 Upvotes

Hey All,

My wife bought multiple of the Glade Air Spray thingys, and put them all around the house, and it seems like every time I walk next to one of them, they just spray me in the face.

Sooo, I designed a PCB and made them all smart, now I can use automations and only make them spray when I actually need them.

All the files are available for free for you guys to try on my GitHub Link

I also made a step-by-step video about it. Here.

What do you guys think?


r/Esphome 1d ago

**[Release] ESPFlasher Web — Visual ESPHome Editor & Flasher (Home Assistant Add-on)**

20 Upvotes

**TL;DR:** Visual editor + flasher for ESP32/ESP8266 inside Home Assistant. Live YAML, OTA, device history, presets, pinout overlay. Multilingual (EN/DE/FR). Hobby project — feedback and PRs welcome! 🚀

---

### ✨ Features

- 🔌 **OTA** — Build and flash ESPHome firmware (OTA)

- 🧩 **Visual config editor** — Basics, buses (I²C/SPI/UART/OneWire), components, with **live YAML preview**

- 📦 **Device history** — View/restore/download YAML from previous flashes

- 💾 **Saved components (presets)** — Reuse your favorite sensor/display configs

- 🗺️ **ESP pinout overlay** — See used pins at a glance

- 🎨 **Theme & i18n** — Light/Dark/System · **English / Deutsch / Français**

- ⚙️ **Configurable backend** — Set API base URL/port, verify with **Test Connection** (`/ping`)

---

### 🖼️ Screenshots

Main UI
Bus Configuration
Components Selection
Pinout Overlay

---

### 🚀 Installation (Home Assistant)

1) **Add repository**

`https://github.com/AIRGAMERx/ESPFlasherHAAddOn\`

2) Install the add-on **ESPFlasher Web**

3) Start it and click **Open Web UI**

> **Running standalone?** In **Settings → API Connection**, set Base URL/Port and use **Test Connection**.

---

### 🏁 Quick Start

- **Basic Settings**: device name, platform/board, Wi-Fi, core services (API/OTA/Web)

- **Buses**: enable/configure I²C, SPI, UART, OneWire

- **Components**: browse components & recipes, add and configure

- **YAML Preview**: inspect generated YAML, copy or download

- **Compile & Flash**: build firmware and flash via OTA

- **Devices**: see previous flashes, restore config to editor, download YAML

- **Saved Components**: manage reusable presets (export/import JSON)

---

### 🧰 Troubleshooting

- **API test fails**: Use *Settings → API Connection → Test Connection*. Check base URL, port, and reachability. `/ping` must return **200** with body **pong**.

- **Compile errors**: Inspect YAML, verify board/platform IDs, check component options.

- **OTA issues**: Ensure the device is online and reachable; verify API/OTA passwords.

---

### 🔒 Security Notes

The add-on may request elevated capabilities (access to serial devices, local API). Only install from trusted sources. If exposing outside your LAN, put it behind proper authentication and TLS.

---

### 🗺️ Roadmap (Ideas)

- 🧙‍♂️ First-run wizard

- 🧩 More components, smarter presets & recipe suggestions

- 🔄 Import from raw YAML → pre-fill the editor

- 🧪 Hardware sanity checks (boot-strap pins, conflicts)

- 📶 Wi-Fi provisioning helpers

- 🧭 Guided flashing for complete beginners

Got ideas? Please open an issue!

---

### 🤝 Contributing

PRs welcome! For bugs, include repro steps, logs, and versions.

Repo: https://github.com/AIRGAMERx/ESPFlasherHAAddOn

---

### ☕ Support

Buy Me a Coffee: https://buymeacoffee.com/airgamer

---

### ⚠️ Disclaimer & Support Policy

This is a hobby project: no warranty/SLA guaranteed. I’m happy to receive constructive feedback — please be kind and patient. 🙏


r/Esphome 1d ago

Project BLE “man in the middle” virtual controller

5 Upvotes

I recently purchased a Nestl adjustable bed frame, and asked the company if I could purchase a second remote. I was told their system supports only one remote. Their instructions describe a pairing operation if the remote <> frame control connection needs to be restored.

That tells me the remote interface is possibly BLE / Bluetooth, and thus it might be possible to configure an ESP32 to step in between the remote and frame controller. That would allow the creation of a virtual remote in Home Assistant.

Has anyone attempted something like this? It would obviously entail sniffing Bluetooth traffic to reverse engineer the comm packets.


r/Esphome 1d ago

Project Wii Balance Board

Thumbnail github.com
21 Upvotes

r/Esphome 1d ago

Validating my project idea (dimmable LEDs on staircase with PIR sensor)

4 Upvotes

This is my first electronics project and since I have limited time and budget I would like to ask if anyone can tell me whether I'm on the right track before I start ordering stuff. I have a lot of programming experience and a bit of theoretical understanding of electronics.

EDIT: I've noticed that a standard response in this subreddit seems to be "use WLED". To be clear: I don't need effects or colours, or a UI. This should be installed once, and just work. I'm a programmer and enjoy writing code. So that's not a problem. What I need is someone who can tell me whether this electronics setup will work.

The idea is to put led lights on my staircase. There will be PIR motion sensors for detecting motion on the top and bottom of the staircase. I would like to use esphome for handling the logic of reading the sensor signal and then starting the LED lights on the stairs.

I'm thinking of using a Mean Well LED driver with built-in dimmer. The schematic is shown for a single pir sensor, but there will be multiple sensors and staircases.

My questions are:

  • I think the PIR sensor (it reads BM612B) has an signal output that will be high when motion is detected. Can I just connect it to a GPIO on my esp8622? Should there be anything in between like a relay or other?
  • I'm thinking that the ESP8622 should be able to run everything on its own. Later I want to connect home assistant to monitor and maybe configure things like dimming percentage. Does this make sense? If I need to program anything myself I can probably figure that out.
  • The dimmer signal can be PWM or a voltage between 0 and 10V, which is preferred when using GPIO on ESP8266?
  • I think the dimmer cannot dim below 10%, so that's why i added another GPIO pin that will use a relay to turn the leds on/off. Not sure whether that is the correct way to do this.
  • Do you have any other general remarks/tips?

r/Esphome 2d ago

ESPHOME with ESP8266 (nodemcu) automation for water submersible pump Arduino code works, but ESPHome yalm code doesn't

5 Upvotes

Subject: Arduino code works, but ESPHome code doesn't - can anyone help?

Hey everyone,

I've hit a wall with my ESP8266 project and I'm hoping someone here might have a solution. I've successfully controlled a relay using a standard Arduino sketch, but when I try to replicate the same functionality with ESPHome, it doesn't work.

I'm pretty new to ESPHome, so I'm sure I'm missing something simple.

Here are the code snippets:

pin14 is my water high level feedback, when water reaches at maximum 3v conduct to pin14 & make it high, and the motor stops. also, if pin14 is high, then the start command didn't taken & it work as an interlock to prevent overflow. i set 10min timer if water level not reach at high level in 10min then motor will stop by timer & water level reach high less then 10min then interlock stop motor. motor w start command given using push button.

My Working Arduino Code:

    // Check the interlock pin (Pin 14)
  bool interlockActive = (digitalRead(SwitchPin2) == HIGH); // Using SwitchPin2 (Pin 14) as interlock

  // Control Relay 1 (Motor) with Push Button 1
  if (digitalRead(SwitchPin1) == LOW && previousSwitchState1 == HIGH) {
    if (currentMillis - lastDebounceTime1 >= debounceDelay) {
      previousSwitchState1 = LOW; // Button is currently pressed
      if (!interlockActive) { // Only start if interlock is not active
        toggleState_1 = 1; // Force ON state when button is pressed
        digitalWrite(RelayPin1, HIGH); // Turn motor ON (assuming active-HIGH)
        switch1 = 1;             // Update cloud property
        relay1StartTime = currentMillis;
        relay1TimerRunning = true;
        Serial.println("Motor started (manual)");
      } else {
        Serial.println("Motor start blocked by interlock (Pin 14 HIGH)");
        // Optionally provide feedback here (e.g., blink an LED)
      }
      lastDebounceTime1 = currentMillis;
    }
  } else if (digitalRead(SwitchPin1) == HIGH) {
    previousSwitchState1 = HIGH; // Button is released
  }

  // --- Relay 1 Auto Turn Off Logic ---
  if (relay1TimerRunning && (currentMillis - relay1StartTime >= relay1Delay)) {
    digitalWrite(RelayPin1, LOW);
    Serial.println("Motor turned OFF automatically TIMER limit");
    switch1 = 0; // Update local state
    toggleState_1 = 0;
    relay1TimerRunning = false;
  }

  // --- Interlock Check while Motor is Running ---
  if (relay1TimerRunning && interlockActive) {
    digitalWrite(RelayPin1, LOW);
    Serial.println("Motor stopped due to interlock (Pin 14 HIGH)");
    switch1 = 0; // Update local state
    toggleState_1 = 0;
    relay1TimerRunning = false;
  }

My Non-Working ESPHome YAML:

captive_portal:
# Binary sensor for interlock (GPIO14)
binary_sensor:
  - platform: gpio
    pin: gpio14
      inverted: true
    on_press:
      then:
        - switch.turn_off: motor_relay
    id: interlock
    name: "Interlock Sensor"
    internal: true

  # Push Button (GPIO12)
  - platform: gpio
    pin:
      number: GPIO12
      mode: INPUT_PULLUP
    id: start_button
    name: "Start Button"
    internal: true
    on_press:
      then:
        - if:
            condition:
              binary_sensor.is_on: interlock
            then:
              - logger.log: "Motor start blocked by interlock (Pin 14 HIGH)"
            else:
              - logger.log: "Motor started (manual)"
              - switch.turn_on: motor
              - script.execute: motor_auto_off

# Relay to control motor (GPIO13)
switch:
  - platform: gpio
    pin: GPIO13
    id: motor_relay
    restore_mode: ALWAYS_OFF
    internal: true

  # Exposed motor switch (HA + automation)
  - platform: template
    name: "Motor"
    id: motor
    optimistic: true
    turn_on_action:
      - logger.log: "Motor ON"
      - switch.turn_on: motor_relay
      - script.execute: motor_auto_off
    turn_off_action:
      - logger.log: "Motor OFF"
      - switch.turn_off: motor_relay
      - script.stop: motor_auto_off

# Number to configure auto-off timer (optional)
number:
  - platform: template
    name: "Motor Auto-Off Time"
    id: motor_off_time
    min_value: 1
    max_value: 15
    step: 1
    unit_of_measurement: "min"
    initial_value: 10
    restore_value: true
    optimistic: true

# Auto-off logic script
script:
  - id: motor_auto_off
    mode: restart
    then:
      - logger.log:
          format: "Motor auto-off timer started: %f min"
          args: ['id(motor_off_time).state']
      - delay: !lambda "return id(motor_off_time).state * 60 * 1000;"
      - logger.log: "Motor auto-off timer expired"
      - switch.turn_off: motor

# Interval check for interlock while motor is running
interval:
  - interval: 1s
    then:
      - if:
          condition:
              - binary_sensor.is_on: interlock
          then:
            - if:
                condition:
                  - switch.is_on: motor
                then:
                  - logger.log: "Motor start attempt blocked by interlock"
                  - switch.turn_off: motor

in my arduno project pushbutton & interlock working with 3v but in esphome i didnt set pulldown internal resistor .

i'm hoping someone with more experience with ESPHome can point out what I'm doing wrong. Could it be a pinout issue, a power problem, or something in the YAML configuration that I'm misunderstanding?

Any help would be greatly appreciated! 🙏


r/Esphome 2d ago

Check if canbus device is connected

3 Upvotes

Is it possible to verify whether a canbus device is online? I want to measure electricity being exported to the grid. If there is current flowing towards the grid, I want to increase a DMX value so more current is consumed in the house.

If I'm consuming electricity from the net, I want to decrease the DMX dimming value, so the opposite.

I think I know how to do this.

Here's my question:

But in case the device measuring the current does not give a value, I want the DMX value to jump to 0 at once, as some kind of fail safe mechanism.

Is such a thing possible and how do you do that?


r/Esphome 3d ago

Project Integrating a Seeed Studio XIAO ESP32C3 as a Hidden Bluetooth Proxy in Flush-Mounted Socket Box

Thumbnail
gallery
12 Upvotes

Hey everyone,

I’m looking for some advice and sanity checks on a project idea. I want to integrate a Seeed Studio XIAO ESP32C3 into the flush-mounted box of a wall socket to serve as a Bluetooth proxy for ESPHome.

Reasoning:
I currently have unstable Bluetooth coverage in my bathroom, which leads to flaky responsiveness of my bathroom thermostat. Right now, I have an ESP32C3 dangling from the socket via a USB adapter, which works but obviously isn’t a long-term solution (looks weird, not safe). Since I don’t have any hidden sockets behind cabinets, my thought was to hide the Bluetooth proxy inside the socket box itself, where it would have constant power.

Planned Setup:

  • Use the currently unused L3 wire for live power input.
  • Add a Mean Well RS-15-5 AC/DC converter inside the flush-mounted box.
  • Split N and PE with 3-port WAGO connectors: one branch for the socket, one for the converter.
  • Feed the 5V DC from the converter directly into the XIAO ESP32C3.
  • Place the ESP32C3’s wired antenna as close to the plastic socket cover as possible for better signal strength.

Safety Consideration:
I know the AC/DC converter will generate some heat, and being inside a closed box could be risky. To mitigate this, I plan to add a temperature sensor to the ESP32C3 so I can monitor the flush box’s temperature. If there’s abnormal heat buildup, I could manually cut power at the breaker.
If strongly recommended, I could even add a relay for auto-shutoff via Home Assistnat, but I’m concerned about space limitations in the flush box.

Attached:

  • Current socket wiring (from electrician).
  • My planned wiring diagram.

Questions:

  1. Is this setup generally feasible, or am I overlooking something critical?
  2. Do you see any improvements or safer approaches?

I’d really appreciate any feedback before I commit to this, since I want to avoid doing something unsafe or short-sighted.

Thanks!


r/Esphome 3d ago

Help ESPN(ow or ever?) Gateway on WiFi + Ethernet

6 Upvotes

From https://esphome.io/components/ethernet/, I understand that ESPHome doesn't (currently) support a device running both ethernet + WiFi. Without digging into source code, why aren't they simultaneously supported? Is it due to an ESPHome, espressif, or otherwise constraint?


r/Esphome 3d ago

Help Lambda C++ script broken after 2025.8

3 Upvotes

I don't have enough C++ knowledge to pull it off, but I have this code

binary_sensor:
  - platform: gpio
    name: "Left Button"
    pin:
      number: GPIO04
      mode: INPUT_PULLUP
      inverted: true
    on_multi_click:
      # single click
      - timing:
          - ON for at most 1s
          - OFF for at least 0.3s
        then:
          lambda: |-
            // if relay OFF or not connected to HASS, toggle relay
            if (!id(${eid}_left_relay).state || !global_api_server->is_connected())
            {
              id(${eid}_left_relay).toggle();
            }
            else
            {
              HomeassistantServiceResponse svc;
              svc.service = "pyscript.switch_single_click";

              HomeassistantServiceMap ent;
              ent.key = "ls_eid";
              ent.value = "binary_sensor.${eid}_left_button";
              svc.data.push_back(ent);
              global_api_server->send_homeassistant_service_call(svc);
            }
      # double click
      - timing:
          - ON for at most 1s
          - OFF for at most 1s
          - ON for at most 1s
          - OFF for at least 0.1s
        then:
          lambda: |-
         ..............  

All of this part is broken and no longer compile (but it works on 2025.6.2)

                  HomeassistantServiceMap ent;
                  ent.key = "ls_eid";
                  ent.value = "binary_sensor.${eid}_left_button";
                  svc.data.push_back(ent);
                  global_api_server->send_homeassistant_service_call(svc);  

Giving error message

/config/esphome/common/sonoff-m5/m5-3c-86/binary_sensor.yaml: In lambda function:
/config/esphome/common/sonoff-m5/m5-3c-86/binary_sensor.yaml:22:9: error: 'HomeassistantServiceResponse' was not declared in this scope
   22 |               HomeassistantServiceResponse svc;
      |         ^     ~~~~~~~~~~~~~~~~~~~~~~
/config/esphome/common/sonoff-m5/m5-3c-86/binary_sensor.yaml:23:9: error: 'svc' was not declared in this scope
   23 |               svc.service = "pyscript.switch_single_click";
      |         ^  
/config/esphome/common/sonoff-m5/m5-3c-86/binary_sensor.yaml:25:9: error: 'HomeassistantServiceMap' was not declared in this scope
   25 |               HomeassistantServiceMap ent;
      |         ^     ~~~~~~~~~~~~~~~~~
/config/esphome/common/sonoff-m5/m5-3c-86/binary_sensor.yaml:26:9: error: 'ent' was not declared in this scope; did you mean 'int'?
   26 |               ent.key = "ls_eid";
      |         ^  
      |         int
/config/esphome/common/sonoff-m5/m5-3c-86/binary_sensor.yaml:29:28: error: 'class esphome::api::APIServer' has no member named 'send_homeassistant_service_call'
   29 |               global_api_server->send_homeassistant_service_call(svc);
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  

Based on these pages

https://api-docs.esphome.io/classesphome_1_1api_1_1_homeassistant_service_response.html
https://api-docs.esphome.io/classesphome_1_1api_1_1_homeassistant_service_map
https://api-docs.esphome.io/classesphome_1_1api_1_1_a_p_i_server

Am I supposed to change it to this?

esphome::api::HomeassistantServiceResponse svc;
svc.set_service("pyscript.switch_single_click");

esphome::api::HomeassistantServiceMap ent;
ent.set_key("ls_eid");
ent.value = "binary_sensor.${eid}_left_button";
svc.data.push_back(ent);
global_api_server->send_homeassistant_service_call(svc);

r/Esphome 4d ago

Project Bin reminder

16 Upvotes

After seeing the wheelie bin someone else made, I decided to do something similar with hardware I had lying around. I couldn't find a white/semi transparent wheelie bin and dont have a 3D printer so had to make do with what I have.

We only have general waste and recycling being collected alternating weeks and food waste every week.

https://github.com/peggleg/esp-public/tree/main/esp32-bin-reminder

Hardware used:

  • ESP32-C6 Super Mini
  • ST7789 1.54" display

Firmware has been done in ESPHome:

  • Updates as soon as device starts up and then again every 6 hours
  • PNG for bin (general waste & recycling)
    • I couldnt get Noto Color Emoji font to work for some reason
  • Images are being resized to 80x80
  • Background color changes according to which bin is being collected that week
    • Brown for general waste
    • Green for recycling

I am planning to mount the hardware in a small electrical box, not sure how that will come out 😹😹

I also need to remove and resolder the display pins. I stupidly soldered it the wrong way around 😢😢


r/Esphome 4d ago

Smart Electric WaterHeater control

1 Upvotes

Does anybody know if a water heater control to make a dumb electric 40gal smart? I am looking for ways to reduce my power consumption so that my solar is capable of not only powering my house, but providing enough for an electric vehicle. I have 2x 40gal electric water heats and would think that would have a decent size impact.


r/Esphome 4d ago

Boba Demoscene on esp32 S3. Very fast

1 Upvotes

Soon I show you a 3d demo of a real 3d cube shaded or textured


r/Esphome 5d ago

Best way to manage multiple ESPHome sensors with unique IDs and OTA updates?

7 Upvotes

I’m working on a deployment of around 100 ESPHome-based sensor units that will all publish via MQTT. The setup is simple:

  • Each device will publish to topics like sensors/<sensor_id>/<metric>.
  • The base config is the same for all devices.
  • Each device needs a unique sensor_id (which is used both for MQTT topics and to identify the node itself).

I’ve been looking at using ESPHome substitutions so I can pass in a different sensor_id value at compile/upload time. That works fine for one-off flashing, but I’m not sure what the best long-term workflow is when you scale to 100 devices:

  1. Initial provisioning:
    • Do I really need to run esphome run common_sensor.yaml --substitution sensor_id=sensorx manually for every node?
    • Is there a way to automate this (e.g., a script, dashboard trick, or auto-ID from MAC address)?
  2. OTA updates after deployment:
    • If I only set the sensor_id during the first flash, how do I make sure the device keeps its ID for future OTA updates?
    • Should I generate per-device YAML files (like sensor01.yaml → includes the common base config + sets the ID)?
    • Or is there a smarter way to handle this at scale?

Basically I want to avoid maintaining 100 almost-identical configs, but I also don’t want to lose IDs or break topics when pushing OTA updates later.

So what’s the best practice for this kind of deployment?

  • How do you manage large fleets of ESPHome devices?
  • Any tooling/scripts/templates you recommend?
  • Am I overcomplicating it, or is there a clean workflow I’m missing?

Thanks in advance 🙏


r/Esphome 4d ago

WIP yaml backup add-on for HAOS

0 Upvotes

I have created a small add-on that creates a backup of a yaml file once you click on save. Use case, I code like a moron and needed something to go back in time.

FAQ

Q: Why nog use git?

A: to lazy to learn

Q: Could you make this into a HACS add-on so I can skip the copy paste

A: NO

Q: How to I install this thing

A: create the files (using ssh or whatever), go to add-ons -> add-on store and it should be available

Q: will this solve world hunger

A: might

file: /root/addons/esphome_watch/Dockerfile

FROM alpine:3.22.1
ENV LANG=en_US.utf8
RUN set -eu && apk add --no-cache inotify-tools date
COPY esphome_watch /usr/local/bin
RUN chmod +x /usr/local/bin/esphome_watch
ENTRYPOINT ["/usr/local/bin/esphome_watch"]

file: /root/addons/esphome_watch/config.yaml

name: "Esphome watcher"
description: "Watch for esphome yaml changes, and then copies them to a backup file"
version: "1.0.8"
slug: "esphome_watch"
init: false
arch:
  - aarch64
  - amd64
  - armhf
  - armv7
  - i386

map:
  - type: homeassistant_config
    read_only: False
    path: /ha_config

privileged:
  - SYS_RESOURCE

file: /root/addons/esphome_watch/esphome_watch

#!/bin/sh
echo "Starting ESPHOME watch"

set -eu

## check is a moved to has occured. esphome writes a temp file and moves (or copies) that to the yaml when save is clicked
inotifywait -r -m -e moved_to @/ha_config/esphome/esphome_watch_backup /ha_config/esphome |
   while read file_path file_event file_name; do
        echo ${file_path}${file_name} event: ${file_event}
        echo "Creating backup directory"; mkdir -p ${file_path}/esphome_watch_backup/${file_name}
        echo "Copying new version to backup"; cp ${file_path}${file_name} ${file_path}/esphome_watch_backup/${file_name}/${file_name}-`date +%Y%m%dT%H%M%S)`
   done

wait

r/Esphome 6d ago

Ideas for bt proxy that is minimal?

6 Upvotes

Currently using esp c3 with wall charger, I 3D printed it a case I made so it looks like a nice Bluetooth brick, but it still has big profile I heard of smart plugs that has esp32 but sadly couldn't find one for my country outlet, any other ideas on how to accomplish this?


r/Esphome 6d ago

Project Control House heat with ESP32 Relay board and eliminate thermostats.

10 Upvotes

I thought I had seen a similar project here before but I cannot find it again!

This is the project idea: I have a 4 zone forced hot water heating system Each zone has its own circulating pump that is controlled by a zone controller board on the heater. The zone controller board is wiered to 4 NEST thermostats in the house. I want to disconnect the NEST thermostats and replace them with an ESP32 8 channel relay board. I should then be able to use all the temperature sensors that I have around the houe and Home Assistant automation to switch the relas on/off to trigger the Zone Control board as if a thermostat turned it on.

Does anybody know of an existing project or a recomendatrrion on the rESP32 relay board that will work for this scenario? I welcome any other thoughts/suggestions Thx


r/Esphome 6d ago

Project Bin reminder

Thumbnail
6 Upvotes

r/Esphome 6d ago

Help Template Datetime Not Restoring Value After ESP32 Reboot

2 Upvotes

I'm having an issue with a template datetime entity in ESPHome. Despite setting restore_value: true, the time resets to 00:00:00 after a reboot instead of keeping the last used value.

Here's my code:

datetime: - platform: template id: ${device_internal_name}_time_open name: "Time Open" icon: mdi:sort-clock-descending type: time optimistic: yes initial_value: "09:00:00" restore_value: true

Expected behavior: After rebooting the ESP32, it should retain the last set time value (e.g., "14:30:00").

Actual behavior: It always reverts to 00:00:00 (not even the initial_value).


r/Esphome 7d ago

Project Wemos D1 mini with PCF8575 IO expander ( 8 channel relay + 8 channel switch) , MPR121( 12 channel Touch inputs), APDS9960 gesture sensor with reverse polarity protection and resettable pptc fuse at voltage inputs and outputs for over current protection.

17 Upvotes

r/Esphome 6d ago

Measuring internet speed in ESPHome?

2 Upvotes

Is there a way to measure the internet speed on an ESPHome device?

I'd like to create a device with a round display, which can measure and show me the current internet speed (as the provider speed fluctuates a lot). I found that I can measure the wifi signal strength, but the speed to an external server?


r/Esphome 7d ago

Project Can this be modded to work in ESP Home

Post image
24 Upvotes

Picked up this AQI Tech air quality monitor at a flea market for cheap thinking I might be able to flash it with ESP Home. I’m no electronics engineer but the squiggly on the PCB printing sure looks like where the WiFi module would go if there was one. Has anyone successfully modded one of these to work with ESP Home, or have any ideas how to? The pads for the missing module appeared to be maybe an 8266 at first, but the number of pads is wrong. If I can’t figure it out, I may just harvest everything and start from scratch.


r/Esphome 7d ago

DC motor ceiling fan controller

Thumbnail
gallery
13 Upvotes

I recently purchased a new ceiling fan for one of my bedrooms. The fan comes with a remote and does have some app I can download to control it. I opened the controller hoping it used some type of ESP or pin compatible device, no luck. It does have exposed pins that I could soilder something to, but I am lost on how to figure out what pins do what.

I'm hoping someone has attempted to control one of these with ESPHome and might be able to share or at least point me in the right direction to attempt this myself.


r/Esphome 8d ago

Help Is this possible with only ESPHome? (Standalone control of one light)

6 Upvotes

tldr: Is it possible to use ESP home to program a single ESP-32 controller and have it operational (with web-based configuration) without going down the whole Home Assistant route?

I have been working on a project to put some LED strip lighting in my window to replicate sunlight on dark and gloomy winter days. I was working on custom code through IDE when a friend told me that ESPHome could already do everything I wanted.

Yesterday I did a deep dive into how to accomplish that and it seems while yes I was able to flash ESPHome to my device, the set-up/configuration requires either an instance of HomeAssistant or command-line skills that I do not possess.

Eventually I want a home server that would run HA among other things but at this point I'm just trying to get my project up and running. Can anyone provide guidance? I can connect to the device now via browser but it has no yml config file so it's just on and off control.