I’ve been working on setting up an automation for a pump connected to a Sonoff S31, and I wanted to share my experience and some insights in case others are facing similar challenges. The goal was to have the pump turn on every 10 minutes for 2 minutes, and then turn off if the current drops below 0.2A within 10 seconds. While the basic automation works, the trigger for turning off based on the current hasn’t been firing as expected.
After some research and trial and error, I realized that the delay in current reporting from the Sonoff S31 might be the culprit. It takes about 90 seconds for the device to report the actual current, which could explain why the trigger isn’t firing promptly. To address this, I adjusted the automation to account for the delay and added some additional logging to monitor the current more closely.
Here’s a breakdown of the automation setup I’m using:
yaml
trigger:
- platform: time_pattern
time: /10 - platform: numeric_state
entity_id: sensor.sonoff_s31_current
below: 0.2
for: 10 seconds
action:
- choose:
- conditions:
sequence:- service: switch.turn_on
entity_id: switch.pump - delay: 2 minutes
- service: switch.turn_off
entity_id: switch.pump
- service: switch.turn_on
- conditions:
- condition: trigger
id: sensor.sonoff_s31_current
sequence: - service: switch.turn_off
entity_id: switch.pump
- condition: trigger
- conditions:
If anyone has encountered similar issues or has suggestions on how to improve the responsiveness of the trigger, I’d love to hear your thoughts! It’s been a great learning experience, and I’m hopeful that with some fine-tuning, the automation will run smoothly. Happy tinkering! ![]()