It sounds like the two black wire with the pigtail are the incoming hot and a branch hot to another location, such as the outlet. The other black attached to the switch is probably the switched hot that goes to the fixture being controlled.
You can verify this by turning the switch to off, making sure all the wires and terminals are clear and not touching anything else metal, and then turning on the breaker. Using the non-contact tester, carefully check the wires. The paired blacks should read hot, but the switched black should not.
If this is what you have, wiring the new switch is pretty straightforward. Turn the breaker off again. Confirm no wires are now hot. The new switch is basically connected the same way as the old, but with a neutral wire and ground wire added.
- The hot pigtail is connected to the line terminal.
- The switched black wire is connected to the load terminal.
- A pigtail (white) is added to the bundle of neutral wires and connected to the neutral terminal
- A pigtail (bare) is added to the bundle of ground wires and connected to the ground terminal.
The traveler terminal is not used (and it looks like it is covered anyway).
Use wire nuts, and if you like, tape over them for extra safety. You also could put a wrap of tape around the z-switch covering the terminals. Carefully insert the wires back in the box. Screw the switch into the box. Turn the power back on.
While most dumb switches do not need a neutral connection, many smart switches, such as the z-switch, do. Now all switches have a separate ground connection, although many in the past did not.
Your problem is actually very easy to fix based on the information you've given -- simply replace the outlet with a new one without breaking the tab off the hot side, connect the black wire to the hot screw on the outlet, and cap off the red wire at the outlet with a wirenut instead of connecting it to the new outlet.
Best Answer
Connect
COM to L
A1 to L1
B1 to L2
You'll also need to connect the white wire in the box to the N terminal.
There should be a ground wire in the box as well, connect to the GND terminal
(There will be two white neutral wires in the box, connected to each other. They have to stay connected so you'll add a pigtail (a separate short wire) to that connection to provide the wire to the N terminal. Same thing for the bare copper ground wire.)