[SOLVED] Transforming error

Hello I used this thread to convert my angle to directions:

[Sharing a rule to calculate compass directions from degrees](http://Transforming Angle to direction

But I got this error

2019-04-21 17:01:19.598 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'current wind angle to text': Could not cast 158.0 to org.eclipse.smarthome.core.library.types.QuantityType; line 99, column 25, length 55

Here is my item

Number MQTT_number_weewx_windDir "Windrichtung [%.0f]"  {channel="mqtt:topic:weather:windDir"}


String localCurrentWindDirectionText "Wind from [%s]" <wind>

and my rule

rule "current wind angle to text"
when
	Item MQTT_number_weewx_windDir changed
then
    var Number angle = (MQTT_number_weewx_windDir.state as QuantityType<Number>).doubleValue
    localCurrentWindDirectionText.postUpdate(transform("JS", "windrose.js", angle.toString))
end

any Ideas??

Have you tried this, I am not sure you need that many type conversions:

rule "current wind angle to text"
when
	Item MQTT_number_weewx_windDir changed
then
    localCurrentWindDirectionText.postUpdate(transform("JS", "windrose.js", MQTT_number_weewx_windDir.state.toString))
end