Involved in the transmission of sensory signals from the chemoreceptors to the flagellar motors. In its active (phosphorylated or acetylated) form, CheY exhibits enhanced binding to a switch component, FliM, at the flagellar motor which induces a change from counterclockwise to clockwise flagellar rotation (By similarity). Binds 1 Mg(2+) ion per subunit. Phosphorylated by CheA or acetylated by acetyl-CoA synthetase, depending on which acetate metabolism pathway is available.