What is this attached to the main switch?

See picture of two electrical devices mounted on top of the service panel. They are wired the main breaker. Are they some sort of energy saving device? Are they wired correctly and is this an issue?

I would say lightning or surge arrestors.

Ditto

It is a lightning arrestor that uses a type of diode that is commonly called a Zener (note the capitalization). Zeners work on the principal of an avalanche (or eutectic) breakdown. In layman’s terms, they work much like an MOV in that MOVs and Zeners can both be used to clamp Voltage but a Zener has a much steeper slope than an MOV (in other words, it is more eutectic than an MOV). Electricians sometimes call them “money makers”. They afford some protection but very little. They mainly provide a false sense of security. I installed hundreds of them before going off on my own. As an electrical contractor, on the rare occasion that a customer would ask for one, I’d sell it at cost and install it free. It takes less than five minutes to install one.

I see a few potential problems, one the double lugging under the main CB and two the fact that those devices enter the panel above live parts and don’t appear to have sealing locknuts or hubs.