Your Item has UoM, Units of Measurement. So it’s effectively 15 °C not just 15, and comparing with just 12 is apples-and-oranges.
This is one of the clumsier parts of UoM.
You can either extract just-the-number or compare with a temperature.
if( (localHourlyForecast12Temperature.state as QuantityType<Number>).intValue <= 12 )
if( localHourlyForecast12Temperature.state <= 12 | "°C" )