Pirate-Weather / pirate-weather-ha

Replacement for the default Dark Sky Home Assistant integration using Pirate Weather
https://pirateweather.net/
Apache License 2.0
369 stars 26 forks source link

Precip Accumulation decimal place error #347

Closed mammbo3 closed 1 week ago

mammbo3 commented 1 week ago

Describe the bug

Hello, TL;DR: Precip Accumulation in HA appears to be off by a factor of 10 compared to the API. I am using US units (Inches).

In the API, I am seeing this:

"daily": {
        "summary": "Cloudy",
        "icon": "cloudy",
        "data": [
            {
                "time": 1731906000,
                "icon": "rain",
                "summary": "Rain",
                "sunriseTime": 1731933535,
                "sunsetTime": 1731968486,
                "moonPhase": 0.6,
                "precipIntensity": 0.0062,
                "precipIntensityMax": 0.05,
                "precipIntensityMaxTime": 1731906000,
                "precipProbability": 0.95,
                "precipAccumulation": 0.15,
                "precipType": "rain",
                "temperatureHigh": 57.38,
                "temperatureHighTime": 1731956400,
                "temperatureLow": 55.47,
                "temperatureLowTime": 1731974400,
                "apparentTemperatureHigh": 53.25,
                "apparentTemperatureHighTime": 1731956400,
                "apparentTemperatureLow": 46.85,
                "apparentTemperatureLowTime": 1732006800,
                "dewPoint": 51.29,
                "humidity": 0.95,
                "pressure": 1012.35,
                "windSpeed": 6.33,
                "windGust": 12.76,
                "windGustTime": 1731988800,
                "windBearing": 147.08,
                "cloudCover": 0.8,
                "uvIndex": 1.37,
                "uvIndexTime": 1731945600,
                "visibility": 3.19,
                "temperatureMin": 47.37,
                "temperatureMinTime": 1731931200,
                "temperatureMax": 57.38,
                "temperatureMaxTime": 1731956400,
                "apparentTemperatureMin": 46.64,
                "apparentTemperatureMinTime": 1731931200,
                "apparentTemperatureMax": 53.25,
                "apparentTemperatureMaxTime": 1731956400
            },
            {
                "time": 1731992400,
                "icon": "rain",
                "summary": "Rain",
                "sunriseTime": 1732020006,
                "sunsetTime": 1732054843,
                "moonPhase": 0.63,
                "precipIntensity": 0.0167,
                "precipIntensityMax": 0.1401,
                "precipIntensityMaxTime": 1731992400,
                "precipProbability": 0.75,
                "precipAccumulation": 0.4003,
                "precipType": "rain",
                "temperatureHigh": 60.76,
                "temperatureHighTime": 1732035600,
                "temperatureLow": 44.45,
                "temperatureLowTime": 1732100400,
                "apparentTemperatureHigh": 53.62,
                "apparentTemperatureHighTime": 1732032000,
                "apparentTemperatureLow": 39.59,
                "apparentTemperatureLowTime": 1732100400,
                "dewPoint": 53.42,
                "humidity": 0.89,
                "pressure": 1002.72,
                "windSpeed": 14.11,
                "windGust": 24.59,
                "windGustTime": 1732006800,
                "windBearing": 193.63,
                "cloudCover": 0.74,
                "uvIndex": 2.63,
                "uvIndexTime": 1732035600,
                "visibility": 7.62,
                "temperatureMin": 50.42,
                "temperatureMinTime": 1732075200,
                "temperatureMax": 60.76,
                "temperatureMaxTime": 1732035600,
                "apparentTemperatureMin": 46.84,
                "apparentTemperatureMinTime": 1732075200,
                "apparentTemperatureMax": 53.62,
                "apparentTemperatureMaxTime": 1732032000

However, In Home Assistant, I am seeing this: image image

Expected behavior

Precip Accumulation 0d should be 0.15 in Precip Accumulation 1d should be 0.4003 in

Actual behavior

Precip Accumulation 0d is 0.0150 in Precip Accumulation 1d is 0.0400 in

Home Assistant version

2024.11.2

Integration version

v1.6.1.1

Other details

No response

Troubleshooting steps

mammbo3 commented 1 week ago

According to this post here, the API comes in cm not mm. So when the conversion is done to inches, that would explain why it is off by a factor of 10.

mammbo3 commented 1 week ago

As a follow-up, I have created the PR here to fix the issue