Closed milanissimo1989 closed 2 years ago
The Node-RED node just passes thru the values from the TWC api call. It doesn't modify the value or add decimal places. Which node are you using in your flow?
hey i using this one "pws observations"
Hi - Glad that you find the TWC PWS Node-RED nodes helpful.
Here is the TWC API Documentation Link : https://ibm.co/v2PWSCC
The Node-RED PWS Observations
node calls this API.
If you want to add a decimal to a whole number, use .toFixed(1)
var formatted_temp = msg.payload.observations[0].metric.temp.toFixed(1);
@milanissimo1989 - Did the above suggestion work? I'd like to close this issue.
Where do I enter the line? In a function node? Unfortunately, I am only a beginner.
Update: added numericPrecision API feature in Pull Request.
In the TWC API Documentation:
I've confirmed that by appending my URL to include "&numericPrecision=decimal", several values are returned with a fixed tenths place instead of just integers. The affected values are as follows:
All other values remain unchanged.
Adding this as an Numeric Precision dropdown with options of Integer or Decimal to the API call should suffice. If Integer is selected, leave the API request as is. If Decimal is selected, append the request with "&numericPrecision=decimal".
Hope this helps!
Created pull requests for the changes to pws-current.js and pws-current.html (sorry for the separate requests).
Excellent - Thanks @jimison - Closing this issue. Fixed by #10 I will bundle a node-red-contrib-twc-weather 0.5.0 and push to npmjs.
Hello, is there a possibility that the temperature value is read out with one decimal place after the decimal point? Sorry for my bad english.
metric: object temp: 3 -----> e.g. 3,1 ? heatIndex: 3 dewpt: 2 windChill: 3 windSpeed: 3 windGust: 5 pressure: 994.14 precipRate: 0 precipTotal: 1.6 elev: 423