Involved in the transmission of sensory signals from the chemoreceptors and photoreceptors to the flagellar motors. Autophosphorylates, probably in response to a chemo- or phototactic signal, and transfers its phosphate group to CheY. Could also transfer its phosphate group to CheB. ATP + protein L-histidine = ADP + protein N-phospho-L-histidine. Interacts with CheW1, CheY, and several transducer proteins (HTR-I, HTR-II, BasT, CosT, MpcT, Htr4, Htr6, HtrVIII, Htr16 and Htr17). Autophosphorylated. Deletion leads to the loss of both chemotactic and phototactic responses.