We derive the capacity of the state-dependent half-duplex relay channel without source-destination link. The output of the state-dependent half-duplex relay channel depends on the randomly varying channel states of the source-relay and relay-destination links, which are known causally at all three nodes. For this channel, we prove a converse and show the achievability of the capacity based on a buffer-aided relaying protocol with adaptive link selection. This protocol chooses in each times slot one codeword to be transmitted over either the source-relay or the relay-destination channel depending on the channel states. Our proof of the converse reveals that state-dependent half-duplex relay networks offer one additional degree of freedom which has been previously overlooked. Namely, the freedom of the half-duplex relay to choose when to receive and when to transmit.