New function to decide on/off, for both thermal and generic devices, considering also direct temp option (ON/OFF)