Is there any guide to flash esphome on Shelly 1 plus? I am searching but can’t find a step by step guide. In the past I flashed other Shelly devices (I3) via OTA, but for plus versions I can’t find direct OTA update.
You know this page here?
It has a picture with pin out for the serial adapter.
yes I saw, but I dont know how to do. Is there any place where is explained how to flash? Have I to give power only to the adapter or have I to give power also using 220V AC?
Sorry if It seems basic questions, but I dont want to fry items and I would like to understand what I am doing.
Thank you
Please never do something like that if you aren’t in search of some electric shocks or magic smoke.
I expect the internet to be full of such guides.
Typically you need a serial-usb adapter and then hook up to esp like this:
- Ground with GND
- Voltage (3.3V) with VDD
- RX with TX
- TX with RX
- Ground with GPIO0 (typically to active the flash mode in esp’s)
This images shows the pin-out of the header:
Thank you, I will get a converter and try.
Easiest way to do it is to get something like the VoltLink usb programmer with the additional shelly pin adapter.
Can anyone confirm if OTA updates are working with esp32_ble_tracker
enabled on the Shelly Plus 1? I seem to be able to compile and upload via UART, but I keep getting an error, Error receiving acknowledge binary size: timed out
, when attempting to OTA.
Looking at various threads, it seems to be a common issue with the esp-idf
framework required for single-core ESP32 boards (which the shelly plus 1 is). The various recommendations for sdkconfig_options
do not appear to ease things. Any help would be appreciated.
This sounds very similar to an issue on GIthub with the ESP32-C3. Have you tried increasing CONFIG_ESP_TASK_WDT_TIMEOUT_S
from the default of 5 seconds?
esp32:
board: esp32doit-devkit-v1
framework:
type: esp-idf
sdkconfig_options:
# ... other options from working config
CONFIG_ESP_TASK_WDT_TIMEOUT_S: "10"
Official documentation for this setting
Yep, that was the exact thread I was using. No luck unfortunately. I could get the device to flash over USB, but not OTA.
I managed OTA and BLE to work with below parameters… update with uart first, after that ota works for me for tuning the divider.
esp32:
board: esp32doit-devkit-v1
framework:
type: esp-idf
sdkconfig_options:
CONFIG_FREERTOS_UNICORE: y
CONFIG_ESP32_DEFAULT_CPU_FREQ_160: y
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ: "160"
CONFIG_ESP_TASK_WDT_TIMEOUT_S: "20"
CONFIG_BT_BLE_50_FEATURES_SUPPORTED: n
CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y
Confirmed. Mine work with CONFIG_ESP_TASK_WDT_TIMEOUT_S: "10"
, though increasing this number doesn’t seem problematic.
I’d be intrigued if anyone has experienced odd OTA behaviour in this context. Sometimes mine successful flash, but then appear unresponsive remotely for a few minutes (no log output and registered as offline) while working for any automations relying on the physical switch etc.
I don’t know if something about the BLE stack is causing OTA to come up slowly?
I tried almost this exact config, but had both ble 42/50 settings enabled. I wonder if this was the key issue?
@davidtm, In general ESPHome has some issues with OTA on devices with esp32_ble_tracker enabled. This was a response I’d gotten at the beginning of the 2022 in the ESPHome discord:
It is a known issue. WiFi and BLE are sharing the same radio, thus it needs to switch back and forth. Unfortunately, OTA will not stop BLE, it takes over the radio and OTA dies
Can be easily mitigated when just (re)booting into the safe mode before initiating the ota:
Very interesting. I will definitely give this a try! Thanks.
This gives me some idea’s. I assume from this is may be possible to configure shelly with the new bluetooth proxy. I currently use esp32, but it would be nice to piggyback on existing other devices.
When esphome-flasher reads the cpu in my shelly plus 1,
Chip Info:
- Chip Family: ESP32
- Chip Model: unknown ESP32 (revision 3)
- Number of Cores: 1
- Max CPU Frequency: 80MHz
- Has Bluetooth: YES
- Has Embedded Flash: YES
- Has Factory-Calibrated ADC: YES
80MHz not 160MHz, I assume I need to change cpu freq in the setup, or leave default?
For what it may help this works for me:
#https://github.com/esphome-devices/esphome-devices/issues/299
#https://www.esphome-devices.com/devices/Shelly-Plus-1PM
substitutions:
device_name: "shelly-plus-1pm-01"
# Higher value gives lower watt readout
current_res: "0.001"
# Lower value gives lower voltage readout
voltage_div: "2050"
#was 1925
esphome:
name: shelly-plus-1pm-01
platformio_options:
board_build.f_cpu: 160000000L
esp32:
board: esp32dev
framework:
type: esp-idf
version: latest
sdkconfig_options:
CONFIG_FREERTOS_UNICORE: y
CONFIG_ESP32_DEFAULT_CPU_FREQ_160: y
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ: "160"
CONFIG_ESP_TASK_WDT_TIMEOUT_S: "20"
CONFIG_BT_BLE_50_FEATURES_SUPPORTED: n
CONFIG_BT_BLE_42_FEATURES_SUPPORTED: y
wifi:
ssid: "IOTDOM"
password: !secret wifi_key
domain: !secret domain
#use_address: 192.168.6.77
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${device_name} Fallb Hotspot"
password: !secret Fallback_Hotspot
logger:
api:
ota:
esp32_ble_tracker:
scan_parameters:
active: false
bluetooth_proxy:
button:
- platform: safe_mode
name: "(Safe Mode)"
time:
- platform: homeassistant
id: homeassistant_time
output:
- platform: gpio
id: "relay_output"
pin: GPIO26
switch:
- platform: output
id: "relay"
name: "${device_name} Relay"
output: "relay_output"
binary_sensor:
- platform: gpio
name: "${device_name} Switch"
pin: GPIO4
on_press:
then:
- switch.toggle: "relay"
filters:
- delayed_on_off: 50ms
- platform: gpio
name: "${device_name} Button"
pin:
number: GPIO25
inverted: yes
mode:
input: true
pullup: true
on_press:
then:
- switch.toggle: "relay"
filters:
- delayed_on_off: 5ms
sensor:
- platform: ntc
sensor: temp_resistance_reading
name: "${device_name} Temperature"
unit_of_measurement: "°C"
accuracy_decimals: 1
icon: "mdi:thermometer"
calibration:
b_constant: 3350
reference_resistance: 10kOhm
reference_temperature: 298.15K
on_value_range:
- above: "80.0"
then:
- switch.turn_off: "relay"
- platform: resistance
id: temp_resistance_reading
sensor: temp_analog_reading
configuration: DOWNSTREAM
resistor: 10kOhm
- platform: adc
id: temp_analog_reading
pin: GPIO32
attenuation: 11db
- platform: adc
name: "${device_name} Relay Supply Voltage"
pin: GPIO33
attenuation: 11db
filters:
- multiply: 8
- platform: hlw8012
model: BL0937
sel_pin:
number: GPIO23
inverted: true
cf_pin: GPIO5
cf1_pin: GPIO18
current_resistor: ${current_res}
voltage_divider: ${voltage_div}
current:
name: "${device_name} Current"
unit_of_measurement: A
accuracy_decimals: 3
icon: mdi:flash-outline
voltage:
name: "${device_name} Voltage"
unit_of_measurement: V
accuracy_decimals: 1
icon: mdi:flash-outline
power:
name: "${device_name} Power"
unit_of_measurement: W
id: power
icon: mdi:flash-outline
on_value_range:
- above: "3600"
then:
- switch.turn_off: "relay"
change_mode_every: 2
update_interval: 10s
- platform: total_daily_energy
name: "${device_name} Daily energy consumed"
power_id: power
filters:
- multiply: 0.001
unit_of_measurement: kWh
icon: mdi:clock-alert
status_led:
pin:
number: GPIO0
inverted: true
Hi there, is there any one having luck with flashing a Shelly plus i4 with esphome?
I have done:
and this pin layout:
similar to this:
Where I have connected pin3 to 4 and 2 to 1.
This gives me output on the serial (so it must be connected ok and in flash mode) but I am not able to successfully flash.
the error:
Using 'COM6' as serial port.
Connecting........_
Detecting chip type... ESP32
Connecting...
Chip Info:
- Chip Family: ESP32
- Chip Model: unknown ESP32 (revision 3)
- Number of Cores: 1
- Max CPU Frequency: 80MHz
- Has Bluetooth: YES
- Has Embedded Flash: YES
- Has Factory-Calibrated ADC: YES
- MAC Address: 08:3A:F2:00:AA:68
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
I have to get back… it works for a little while.
After placing it in the wall, booting it up the wifi wprks for a limited amount of time.
Locally it keeps working a while…
Then after a while also no local control possible anymore.
Practically impossible to track the serial logging…
Bummer.
Has anyone been successful in getting active Bluetooth connections?
Is it even possible?