Error: mapping values not allowed with on_value: statement

Hello friends! I’m very new to using ESPHome and trying to convert a cloud-controlled smart-plug.
I have the US version of the Elekcity ESW01 plug. I have been working from this example for an EU plug and the GOIP mapping is identical (according to the Tasmota devices website) except for the US version listing a GPIO15 mapping to HLWBL SEL.

When I try to download the compiled firmware I immediately receive this error:

INFO Reading configuration /config/esphome/esph-plug-01.yaml...
ERROR Error while reading config: Invalid YAML syntax:

mapping values are not allowed here
  in "/config/esphome/esph-plug-01.yaml", line 70, column 17:
            on_value:
                    ^

I have tried looking for additional examples of using on_value: on the ESPHome Devices website but have been unsuccessful.

Here is the full code
esphome:
  name: esph-plug-01

esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "redacted"

ota:
  password: "redacted"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esph-Plug-01 Fallback Hotspot"
    password: "redacted"

captive_portal:
    
status_led:
  pin:
    number: GPIO5

output:
- platform: gpio
  id: led1
  pin: GPIO16

switch:
- platform: gpio
  name: "Relay"
  id: switch1
  pin: GPIO4
  restore_mode: RESTORE_DEFAULT_ON
  on_turn_on:
    - output.turn_on: led1
  on_turn_off:
    - output.turn_off: led1

binary_sensor:
  - platform: gpio
    id: button1
    pin:
      number: GPIO14
      mode: INPUT_PULLUP
      inverted: true 
    on_press:
      - switch.toggle: switch1

sensor:
  - platform: hlw8012
    sel_pin: 0
    cf_pin: GPIO13
    cf1_pin: GPIO12
    voltage:
      id: voltage
      name: Voltage
    power:
      id: wattage
      name: Wattage
        on_value:  #<-- Error indicated here...
          - sensor.template.publish:
              id: hlw8012_current_calculated
              state: !lambda 'return id(hlw8012_power).state / id(hlw8012_voltage).state;'
    update_interval: 60s
    initial_mode: VOLTAGE
    change_mode_every: 4294967295 # basically never
  - platform: template
    id: hlw8012_current_calculated
    name: "Current (calculated)"

I have tried changing the indent sequence and copy/paste the code directly from the example with no change in the results.

If anyone has a suggestion or a pointer to what I’m doing wrong it would be appreciated.
Many Thanks!

Looks as if you simply used it in the wrong place. See the on_raw_value example.

Compare your indentation to that shown here: https://esphome.io/components/sensor/index.html#sensor-automation

Thank you, both! That was exactly what I needed. One down and seven to go. Gotta love yard sales, a box a eight of these plugs for $5.