Media_player.turn_on and media_player.select_source

I found the problem… It was in the first part where it checks if both TVs are off and if yes it turns on one… When One it was already turned on it was trying to run the turn on command without an entity_id so i change it a bit and actually it runs the turn on command even if the TV is already turned on… If someone knows how to optimize it tell me!!