One may begin tasks on Friday that will automatically complete on Shabbat. For example, on Friday one may place a pot with uncooked food on the plata so that it will continue to cook on Shabbat, as long as from the onset of Shabbat until the food is fully cooked one neither touches the pot nor adjusts its temperature (below, 10:16). Similarly, one may place cloth into a vat of dye so that it will absorb the color during Shabbat. This is because the prohibitions on Shabbat are only relevant to actions performed on Shabbat, and not to activities that take place automatically during Shabbat. According to Beit Shammai, just as one is commanded to rest his animals on Shabbat, so too he is commanded to rest all his tools and appliances on Shabbat. However, the halakha follows the opinion of Beit Hillel, and Shabbat prohibitions do not apply to one’s inanimate possessions. Therefore one may use a tool for a task on Friday that will complete automatically on Shabbat (SA 252:1).
Thus, one may set a timer on Friday to turn lights on and off during Shabbat as needed (below, 17:6). Similarly, one may set up irrigation and sprinklers before Shabbat, even though one may not water the lawn on Shabbat (below, 19:4); as long as the watering is set before Shabbat, it is not prohibited. This is also the case when it comes to industrial machines that work nonstop. As long as there is no concern that a Jew will need to turn them on or fix them on Shabbat, it is not necessary to turn them off before Shabbat (Heikhal Yitzĥak §19).
However, when it comes to leaving on machines that are very noisy, like grinding mills, there are differing opinions. Some are stringent and maintain that one may not leave them on during Shabbat because it is not respectful toward Shabbat. Others feel that since they were turned on before Shabbat and no melakha is being done on Shabbat, it is not prohibited. The latter opinion is followed in SA 252:5. Rema, in contrast, writes that ideally one should be stringent and not begin an activity that will produce noise during Shabbat; however, if this will lead to a loss, or if there is some other pressing need, one may be lenient in this regard (see 22:19 below about the prohibition to listen to the radio or watch television on Shabbat).