I would like to measure energy with Home Assistant Glow. I have bought the components and I have printed the cases.
I have mounted all component as described in the short description in the link for two HA Glow.
I run HA 2021.9.7 with ESPhome 2021.9.2.
I have successfully installed ESPhome on the first HA Glow according to instruction in the link and it measures energy for me. Now I try to install the second HA Glow. I copied the yaml file and changed the names. When I install the second HA Glow it just failes. The only difference between the two yaml files are the device_name and the friendly_name.
When I validate the config file there are no problems. When I try to install the second HA Glow it builds the software an starts installing but failes after 20 seconds with the following message:
I see no other eroor message.
Anyone who knows what can be the problem?
Here is the config file for the second HA Glow:
# Home Assistant Glow
#
# Read your electricity meter by means of the pulse LED on your
# meter, useful if you do not have a serial port (P1).
#
substitutions:
device_name: ha-glow-uterum
friendly_name: uterum
device_description: "Measure your energy consumption with the pulse LED on your smart meter"
pulse_pin: GPIO12
status_led: GPIO5
# imp/kWh rate ⬇ #
pulse_rate: '10000'
esphome:
name: '${device_name}'
comment: '${device_description}'
project:
name: "klaasnicolaas.home_assistant_glow"
version: "2.0.1"
platform: ESP32
board: nodemcu-32s
wifi:
ssid: !secret wifi_ssid_dlink
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: '${device_name}'
password: !secret wifi_password
captive_portal:
# Enable logging
logger:
# Enable Home Assistant API
api:
password: !secret esphome_api_password
ota:
safe_mode: true
reboot_timeout: 10min
num_attempts: 5
web_server:
port: 80
auth:
username: !secret esphome_web_username
password: !secret esphome_web_password
output:
# - platform: gpio
# pin: GPIO5
# id: output_blue
- platform: gpio
pin: GPIO2
id: output_red
- platform: gpio
pin: GPIO4
id: output_green
light:
- platform: binary
internal: true
id: led_red
name: Red
output: output_red
# Status LED for connection
status_led:
pin:
# Blue LED
number: ${status_led}
# Sensors for ESP version and WIFI information
text_sensor:
- platform: version
hide_timestamp: true
name: "${friendly_name} - ESPHome Version"
- platform: wifi_info
ip_address:
name: "${friendly_name} - IP Address"
icon: mdi:wifi
ssid:
name: "${friendly_name} - Connected SSID"
icon: mdi:wifi-strength-2
sensor:
- platform: pulse_meter
name: '${friendly_name} - Power consumption'
unit_of_measurement: 'W'
state_class: measurement
device_class: power
icon: mdi:flash-outline
accuracy_decimals: 0
pin: ${pulse_pin}
# internal_filter: 100ms
on_value:
then:
- light.turn_on:
id: led_red
- delay: 0.5s
- light.turn_off:
id: led_red
filters:
# multiply value = (60 / imp value) * 1000
# - multiply: 60
- lambda: return x * ((60.0 / ${pulse_rate}) * 1000.0);
total:
name: '${friendly_name} - Total energy'
unit_of_measurement: 'kWh'
icon: mdi:circle-slice-3
state_class: total_increasing
device_class: energy
accuracy_decimals: 3
filters:
# multiply value = 1 / imp value
# - multiply: 0.001
- lambda: return x * (1.0 / ${pulse_rate});
Have you tried to just compile the sketch(manual download option)
It compiles on my system, Are you placing the board in boot mode? Hold the button down on the esp not reset/en the other button for a few seconds. Otherwise try the stand alone flasher.
It does compile for me as well. I have put the board in boot mode by pushing the boot button on the board before I chose the serial device.
I downloaded the esphomeflasher and tried with the compiles ha-glow.bin that I compile via esphome. I get the following error message:
Using 'COM5' as serial port.
Unexpected error: could not open port 'COM5': PermissionError(13, 'Ă…tkomst nekad.', None, 5)
I started esphomeflasher as Administrator on my windows machine…
Edit:
The console says this:
Using 'COM5' as serial port.
Connecting....
Detecting chip type... ESP32
Connecting....
Chip Info:
- Chip Family: ESP32
- Chip Model: ESP32D0WDQ6 (revision 1)
- Number of Cores: 2
- Max CPU Frequency: 240MHz
- Has Bluetooth: YES
- Has Embedded Flash: NO
- Has Factory-Calibrated ADC: YES
- MAC Address: 08:3A:F2:59:AC:AC
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
- Flash Size: 4MB
- Flash Mode: dio
- Flash Frequency: 40MHz
Erasing flash (this may take a while)...
Unexpected error: Error while erasing flash: Timed out waiting for packet content
It looks like it’s still not in flash mode. You could try hold the reset down, then press and hold flash, release the reset and hit the flash command, hold flash button for a few more seconds.
Hold down en. While holding en, press and hold boot down. Release en, continue to hold boot. Start the flash process from esphome. Watch the log output when it connects release to boot button. It’s a timing thing you may have to try a few times before it flashes.
You can also try unplugging the esp, then holding down boot connect the usb and while still holding boot, start the flash process from esphome.
Well, I have mounted the HA Glow at the meter with double sided tape. It delivers values to HA Energy. I need to remount it which I can do ofcourse.
My other HA Glow has dynamic IP and that one is ONLINE in ESPHome dashboard. I can’t understand why there is a problem with this one.
Is there another way to make the connection?
In the router I can see that my second glow has received an IP. Can it be enough to set a static IP in the router and restart the HA Glow? Then it will have a static IP even if the wifi config as you describe above is not updated.
It’s like winking at someone in the dark, you know what you’re doing but no one else does. In this case the router knows that its a static address but as far as home assistant and esphome, they have no idea.
They are still going through the process as if it was dynamic. That is known to cause some connection problems with esphome.
My setup is now broken again. I have two Home Assistant Glow and after upgrading one of them to have a dedicated IP address I then tried to do the same thing for the other HA Glow. That failed and now I can’t flash it at all…
This is what I now try to do:
In ESPHome web gui I add a new entity where I put a configuration for HA Glow and the IP address thing added above.
Now I have tried two ways to flash my board:
Via Home Assistant ESPHome gui. I have connected my board via USB to my Windows computer and chose “Plug into this computer”.
I hold the boot button on the board, chose the correct serial port and press “Connect”. I can see that ESPHome connects (it says “Connecting” and then “Preparing installation”). Then it says “Installing… it can take two minutes”. It stops after ~15 s and says “Installation failed”.
Via esphome-flasher 1.3.0 for Windows x64.
I start by in Home Assistant ESPHome gui chose install and chose “Manual download” to get a .bin file.
I connect my board to the windows computer, start esphome-flasher. I chose the serial port and the .bin file compiled above and press “Flash ESP”. It connects and I can see the following screen in the console:
My interpretation from the esphome-flasher printout is that esphome-flasher connects to the board but then fails for some reason. I have tried the proposed solutions in earlier posts to put the board in flash mode:
Hold the “boot” button when pressing Flash
Hold buttons "en"and “boot”, release “en”, press boot and release “boot” when connected.
When I search for similair problems I see proposals to look at which cable used. Since it seems to understand which board I have I think I do have the right cable. It has worked earlier to flash other boards.