DUALR3 (Sonoff) Current Based Cover Control - Sensor Timing question

Hello everyone, this is my firts post here but I’ve read a lot while configuring lots of devices in HA. Sorry for my bad english.

I’m trying to use some Sonoff DUALR3 powering motor-blinds with mechanical endstops.

Following some guides on the web (GPIO pinout, BL0939 integration, switch input integration, lambda controls for testing with on-board button and interlock function) I managed to make it work, but with some questions about how it does:

To have the sensor reading fast enough to detect endstops i have to set it to 500ms.

This is causing 4 entries per seconds on the logs which doesn’t sound really efficient.

I see that also wiki example (Current Based Cover - ESPHome) is using this method.

As I don’t need the current to be measured when relays are not triggered, is there a way to force the sensor update at 500ms (or less) when at least 1 relay is on and disable readings when both relays are off?

Here part of the config:

Sensor set-up:

sensor:
  - platform: bl0939
    update_interval: 500ms
    current_1:
      id: open_current
    current_2:
      id: close_current

Cover set-up:

cover:
  - platform: current_based
    name: "$ldn"
    device_class: blind
    id: "$coverid"

    open_sensor: open_current
    open_moving_current_threshold: 2.1
    open_obstacle_current_threshold: 2.5
    open_duration: 35s
    open_action:
      - switch.turn_on: open_cover

    close_sensor: close_current
    close_moving_current_threshold: 2.1
    close_obstacle_current_threshold: 2.5
    close_duration: 35s
    close_action:
      - switch.turn_on: close_cover

    stop_action:
      - switch.turn_off: close_cover
      - switch.turn_off: open_cover

    obstacle_rollback: 2%
    start_sensing_delay: 1.0s
    max_duration: 37s

Current measurement is “internal” so value doesn’t transfer to HA and occupy history space, if that’s what you mean. But in any case measurement are recorded into history only when changed, not at every measurement. So when cover current is zero that value is recorded only once, not every 0.5 s. - until it changes, of course.

Thank you for your reply,
I know that as I disabled sensor names on purpose to remove them from Home Assistant.
I was thinking about resource waste due to continuos sensor monitorin, am I wrong? Is this the best way to make it work?

No, in esphome yaml you set current sensors as “internal: true”. That way they won’t show in HA:
sensor. In below example all sensors are internal - i think that “name” is not needed either… names are just “leftovers” from my testing, when i temporarily created voltage and current sensors available in HA for monitoring…

  - platform: ade7953
    irq_pin: GPIO16
    voltage:
      name: Shelly 2.5 Mains Voltage
      internal: true
      filters:
        - throttle: 5s
    current_a:
      name: Shelly 2.5 Open Current
      id: open_current
      internal: true
    current_b:
      name: Shelly 2.5 Close Current
      id: close_current
      internal: true
    update_interval: 0.5s

I didn’t know about the internal: true option. That’s useful!

But, my question was about the ESP32 device, not the HA instance (which is on a server and doesn’t have performance issues).

Also, is there a way to log button press, but not sensor readings? Do I have to specify platforms?

You said for both current sensor that " This is causing 4 entries per seconds on the logs which doesn’t sound really efficient." internal is the solution for this.

Regarding log: there are a couple of options, see logger component.
This example sets all logs to “verbose”, only switch components to “info”:

logger:
  level: verbose
  logs:
    switch: info

I guess that you could try:

logger:
  logs:
    sensor: none

This way sensors won’t be logged.
But i’m not sure what you’ll gain with it… it’s just an internal esphome’s logger, which is constantly overwritten.

Could you please pass me the code for esphome with which you managed to get the current and voltage measurements?