Hi,
I’ve few Sonoff S31 flashed with ESPHome around the house connected to appliances. In the initial configuration I set these devices to update electrical characteristics (current, voltage & power) every 15s but that seems inefficient as the appliances run run for a very short duration of time in a day. So started experimenting with ESPHome delta feature using following configuration:
substituions:
electrical_updates: 15s
esphome:
name: $name_of_board
platform: ESP8266
board: esp01_1m
binary_sensor:
- platform: gpio
pin:
number: GPIO0
mode: INPUT_PULLUP
inverted: True
name: ${name_of_board}
on_press:
- switch.toggle: relay
- platform: template
name: ${name_of_board} Running
device_class: running
filters:
- delayed_off: 15s
lambda: |-
if (isnan(id(power).state)) {
return {};
} else if (id(power).state > 4) {
// Running
return true;
} else {
// Not running
return false;
}
switch:
- platform: gpio
name: ${name_of_board}
pin: GPIO12
id: relay
restore_mode: ALWAYS_ON
sensor:
- platform: cse7766
#update_interval: $electrical_updates
current:
name: ${name_of_board} Current
id: current
filters:
- delta: 0.5
voltage:
name: ${name_of_board} Voltage
id: voltage
power:
name: ${name_of_board} Power
id: power
filters:
- delta: 5.0
status_led:
pin:
number: GPIO13
inverted: yes
# UART is needed for cse7766
uart:
rx_pin: RX
baud_rate: 4800
The above file is a template file that I am importing into each config file for an appliance and it is working. But the “delta feature” seems to take its own sweet time, sometimes 30s or whereas I was expecting it near real-time.
So few questions:
- What is the default trigger time for “delta” function?
- Did I use the “delta” function correctly for current and power?
- Is it better to use “update_interval” for appliances with heavy load versus “delta” feature?
Any other suggestions or omission from my code are welcome!
Thanks.