Pump template

I was trying to start my well pump from ESP home. I inserted a start stop switch in home assistant & in hardware added two relays. One is for start & another is for stop as my well pump has a starter.

Now I need help to design a template which will have a single button which clicked will start motor & state should be shown. (ON/OFF). & clicking on same it should get turned off. A current clamp meter will be installed at one phase of pump which can be taken as input in esp wemos d1 mini.

I need a esphome program.

Why don’t you post what yaml you have done so far and show us what you have attempted?

Also have a read of this:

https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371/4

1 Like

Thanks for pointing in the right direction. I will improve it.

Here is the current program which i have wrote to achieve the turning on & off of the pump.

esphome:

name: well-pump

esp8266:

board: d1_mini

Enable logging

logger:

Enable Home Assistant API

api:

encryption:

key: "UFPT+dc+vpn0KKvjejTLQFMCRTi5KCgfJs6h4JYmlq8="

ota:

password: “bac3bd519f7ebe3125fb4710b017540f”

wifi:

ssid: !secret wifi_ssid

password: !secret wifi_password

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:

ssid: "Well-Pump Fallback Hotspot"

password: "LlSS19qJAB7E"

captive_portal:

switch:

  • platform: gpio

    name: Start Motor

    pin: D5

    id: Start

    inverted: True

    on_turn_on:

    • delay: 1s

    • switch.turn_off: Start

  • platform: gpio

    name: Stop Motor

    pin: D6

    id: Stop

    inverted: True

    on_turn_on:

    • delay: 1s

    • switch.turn_off: Stop

cover:

  • platform: time_based

    name: “Cover”

    id: my_cover

    open_action:

    • switch.turn_on: Start

    open_duration: 3s

    close_action:

    • switch.turn_on: Stop

    close_duration: 3s

    stop_action:

    • switch.turn_off: Start

    • switch.turn_off: Stop

i had tried the cover template to achieve the last state of pump. but was not quite successful.

now i have a current measuring sensor. i would like to add that sensor & take a state of pump. if current is present then the pump is on else off.

i cant decide hoe should i start is from.

You obviously missed the bit in “how to ask a good question” about formatting posts. Read point 11 and edit your post to enclose your yaml in “Preformatted text” tags. They look like </> on the posting toolbar.