Yahoo Weather to Fahrenheit

Has anyone done this conversion? Could use a tip. Its doesn’t work like it did in OH1.8

Thanks
Oakguy

The documentation https://github.com/openhab/openhab1-addons/wiki/Weather-Binding and http://docs.openhab.org/addons/bindings/weather1/readme.html says

Number Temperature_F “Temperature [%.2f °F]” {weather=“locationId=home, type=temperature, property=current, unit=fahrenheit”}

In OH2 Yahoo weather binding provides temperature only in Clesius.
To cnvert to Fahrenheit you can use a JS transformation.

Number Temperature "Temperature [JS(celsius2fahrenheit.js):%d °F]" ....

and the coresponding celsius2fahrenheit.js:

(function(i){
	return i*1.8+32;
})(input)

Be advised that this only changes the value displayed, not the value of the item…

Thanks. I now have the script in a celsius2fahrenheit folder in the Transformations folder. I have the JaveScript transformation service in installed. However, I still see a celsius value. There may be an obvious to you but not to me configuration error.

Number Temperature “Temperature [JS(celsius2fahrenheit.js):%d °F]” { channel=“yahooweather:weather:9abaac1d:temperature” }
Number Humidity “Humidity [%.1f]” { channel=“yahooweather:weather:9abaac1d:humidity” }
Number Pressure “Pressure [%.1f]” { channel=“yahooweather:weather:9abaac1d:pressure” }

Thanks!

You are supposed to create a file named celsius2fahrenheit.js, not a folder.
Maybe it’a typo, but that is what I understand from you post…

Ok. I just went by the documentation.

It expects the transformation rule to be read from a file which is stored under the transform folder. To organize the various transformations, one should use subfolders.

Thanks
Guy