core icon indicating copy to clipboard operation
core copied to clipboard

Parsing sensor value for Forecast Solar

Open leeyuentuen opened this issue 1 year ago • 11 comments

The problem

Parsing the value like on the screenshot for today: 27,905.652 kWh became 27905.652 kWh

image image

What version of Home Assistant Core has the issue?

2022.7.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

No response

Link to integration documentation on our website

https://www.home-assistant.io/integrations/forecast_solar/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

leeyuentuen avatar Jul 28 '22 12:07 leeyuentuen

Hey there @klaasnicolaas, @frenck, mind taking a look at this issue as it has been labeled with an integration (forecast_solar) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

Duplicate of #75751 ?

klaasnicolaas avatar Jul 28 '22 12:07 klaasnicolaas

I got this exact same issue today. It’s almost like it’s pulling the data in watts/h instead of kWh.

zSprawl avatar Jul 31 '22 18:07 zSprawl

For the time being, I was able to "resolve" the issue by setting the damping factor to 0.001, which effectively appears to move the decimal over 3 spots for the estimated values for today only.

zSprawl avatar Aug 01 '22 00:08 zSprawl

But did the problem come back when you reset the damping to default? Since it is also very well possible that your adjustment only resulted in a new data request being sent.

klaasnicolaas avatar Aug 01 '22 01:08 klaasnicolaas

Yes, I toggled the damping back to 0 and it went back to some huge number, so I put it back at 0.001 for now.

I also deleted the integration entirely and reset it up without luck.

I also went to the actual API url, and can see the data in watts, but I have no idea what it was before.

https://api.forecast.solar/estimate/32.82/117.1/25/119/6380 (long/lat changed so it doesn't dox me)

zSprawl avatar Aug 01 '22 01:08 zSprawl

Today everything seemed fine so I removed the 0.001 dampening and it works again. No idea but I added and removed it multiple times yesterday with the same behavior.

Oh well… 🤷‍♂️

zSprawl avatar Aug 01 '22 15:08 zSprawl

also fixed here on my side

leeyuentuen avatar Aug 01 '22 15:08 leeyuentuen

Then it seems to be an API issue rather than having to do with the integration.

klaasnicolaas avatar Aug 01 '22 17:08 klaasnicolaas

I've had this issue as well and noticed if I take out the api key, it makes it go away.

viking2010 avatar Aug 09 '22 14:08 viking2010

I also had this couple of times before and also today. Damping workaround fixed it, but is this the way it should be?!? I use this integration with an API key btw.

florie1706 avatar Aug 10 '22 06:08 florie1706

@zSprawl I see you had a value wrong in your API request, you used a WP value but that must be KWP if you request data directly from the API: https://api.forecast.solar/estimate/32.82/117.1/25/119/6.380

For others having the same problem, could you share a diagnostics report?

Forecast.Solar also has its own Discord server, you could also raise your problem there. IF this problem is really an issue with the API and not with the HA integration (to prevent the server from being flooded with integration issues 😄)

klaasnicolaas avatar Aug 10 '22 10:08 klaasnicolaas

@klaasnicolaas Sure. Here you go. That are the values for Damping = 0 so today is wrong, tomorrow is good again. As I said. Had this behaviour a couple of times before without changing anything.

It was always a "one-day-error", next day it worked again flawlessly.

I am running the linuxserver-homeassistant image on docker.

{
  "home_assistant": {
    "installation_type": "Unsupported Third Party Container",
    "version": "2022.8.3",
    "dev": false,
    "hassio": false,
    "virtualenv": false,
    "python_version": "3.10.5",
    "docker": true,
    "arch": "x86_64",
    "timezone": "Europe/Berlin",
    "os_name": "Linux",
    "os_version": "5.15.0-46-generic",
    "run_as_root": false
  },
  "custom_components": {
    "volkswagencarnet": {
      "version": "v4.4.59-beta.7",
      "requirements": [
        "pytz",
        "volkswagencarnet==4.4.57"
      ]
    },
    "miele": {
      "version": "v2021.10.12",
      "requirements": [
        "requests_oauthlib>=1.3.0"
      ]
    },
    "frigate": {
      "version": "3.0.0-rc.3",
      "requirements": []
    },
    "huesyncbox": {
      "version": "1.20.1",
      "requirements": [
        "aiohuesyncbox==0.0.21"
      ]
    },
    "homematicip_local": {
      "version": "1.13.3",
      "requirements": [
        "hahomematic==2022.8.4"
      ]
    },
    "audiconnect": {
      "version": "2021.1.1",
      "requirements": [
        "beautifulsoup4"
      ]
    }
  },
  "integration_manifest": {
    "domain": "forecast_solar",
    "name": "Forecast.Solar",
    "config_flow": true,
    "documentation": "https://www.home-assistant.io/integrations/forecast_solar",
    "requirements": [
      "forecast_solar==2.2.0"
    ],
    "codeowners": [
      "@klaasnicolaas",
      "@frenck"
    ],
    "quality_scale": "platinum",
    "iot_class": "cloud_polling",
    "is_built_in": true
  },
  "data": {
    "entry": {
      "title": "Dahoam",
      "data": {
        "latitude": "**REDACTED**",
        "longitude": "**REDACTED**"
      },
      "options": {
        "api_key": "**REDACTED**",
        "declination": 30,
        "azimuth": 205,
        "modules power": 9880,
        "damping": 0.0,
        "inverter_size": 10000
      }
    },
    "data": {
      "energy_production_today": 94603717,
      "energy_production_tomorrow": 75880,
      "energy_current_hour": 4429,
      "power_production_now": 8793,
      "watts": {
        "2022-08-10T06:00:00+02:00": 410,
        "2022-08-10T06:30:00+02:00": 590,
        "2022-08-10T07:00:00+02:00": 751,
        "2022-08-10T07:30:00+02:00": 1335,
        "2022-08-10T08:00:00+02:00": 2138,
        "2022-08-10T08:30:00+02:00": 2976,
        "2022-08-10T09:00:00+02:00": 3844,
        "2022-08-10T09:30:00+02:00": 4640,
        "2022-08-10T10:00:00+02:00": 5405,
        "2022-08-10T10:30:00+02:00": 6081,
        "2022-08-10T11:00:00+02:00": 6703,
        "2022-08-10T11:30:00+02:00": 7202,
        "2022-08-10T12:00:00+02:00": 7627,
        "2022-08-10T12:30:00+02:00": 7874,
        "2022-08-10T13:00:00+02:00": 8186,
        "2022-08-10T13:30:00+02:00": 8662,
        "2022-08-10T14:00:00+02:00": 8924,
        "2022-08-10T14:30:00+02:00": 8793,
        "2022-08-10T15:00:00+02:00": 8379,
        "2022-08-10T15:30:00+02:00": 7831,
        "2022-08-10T16:00:00+02:00": 7148,
        "2022-08-10T16:30:00+02:00": 6314,
        "2022-08-10T17:00:00+02:00": 5283,
        "2022-08-10T17:30:00+02:00": 4343,
        "2022-08-10T18:00:00+02:00": 3372,
        "2022-08-10T18:30:00+02:00": 2441,
        "2022-08-10T19:00:00+02:00": 1548,
        "2022-08-10T19:30:00+02:00": 913,
        "2022-08-10T20:00:00+02:00": 412,
        "2022-08-10T20:30:00+02:00": 179,
        "2022-08-10T20:38:00+02:00": 0,
        "2022-08-11T06:02:00+02:00": 0,
        "2022-08-11T06:30:00+02:00": 704,
        "2022-08-11T07:00:00+02:00": 944,
        "2022-08-11T07:30:00+02:00": 1590,
        "2022-08-11T08:00:00+02:00": 2467,
        "2022-08-11T08:30:00+02:00": 3396,
        "2022-08-11T09:00:00+02:00": 4362,
        "2022-08-11T09:30:00+02:00": 5272,
        "2022-08-11T10:00:00+02:00": 6151,
        "2022-08-11T10:30:00+02:00": 6943,
        "2022-08-11T11:00:00+02:00": 7661,
        "2022-08-11T11:30:00+02:00": 8223,
        "2022-08-11T12:00:00+02:00": 8702,
        "2022-08-11T12:30:00+02:00": 8993,
        "2022-08-11T13:00:00+02:00": 9195,
        "2022-08-11T13:30:00+02:00": 9189,
        "2022-08-11T14:00:00+02:00": 9107,
        "2022-08-11T14:30:00+02:00": 8836,
        "2022-08-11T15:00:00+02:00": 8457,
        "2022-08-11T15:30:00+02:00": 7857,
        "2022-08-11T16:00:00+02:00": 7162,
        "2022-08-11T16:30:00+02:00": 6366,
        "2022-08-11T17:00:00+02:00": 5509,
        "2022-08-11T17:30:00+02:00": 4574,
        "2022-08-11T18:00:00+02:00": 3612,
        "2022-08-11T18:30:00+02:00": 2704,
        "2022-08-11T19:00:00+02:00": 1835,
        "2022-08-11T19:30:00+02:00": 1199,
        "2022-08-11T20:00:00+02:00": 609,
        "2022-08-11T20:30:00+02:00": 268,
        "2022-08-11T20:37:00+02:00": 0,
        "2022-08-12T06:03:00+02:00": 0,
        "2022-08-12T06:30:00+02:00": 673,
        "2022-08-12T07:00:00+02:00": 884,
        "2022-08-12T07:30:00+02:00": 1514,
        "2022-08-12T08:00:00+02:00": 2388,
        "2022-08-12T08:30:00+02:00": 3327,
        "2022-08-12T09:00:00+02:00": 4329,
        "2022-08-12T09:30:00+02:00": 5330,
        "2022-08-12T10:00:00+02:00": 6268,
        "2022-08-12T10:30:00+02:00": 7049,
        "2022-08-12T11:00:00+02:00": 7733,
        "2022-08-12T11:30:00+02:00": 8308,
        "2022-08-12T12:00:00+02:00": 8803,
        "2022-08-12T12:30:00+02:00": 9116,
        "2022-08-12T13:00:00+02:00": 9324,
        "2022-08-12T13:30:00+02:00": 9309,
        "2022-08-12T14:00:00+02:00": 9206,
        "2022-08-12T14:30:00+02:00": 8912,
        "2022-08-12T15:00:00+02:00": 8535,
        "2022-08-12T15:30:00+02:00": 7935,
        "2022-08-12T16:00:00+02:00": 7253,
        "2022-08-12T16:30:00+02:00": 6457,
        "2022-08-12T17:00:00+02:00": 5629,
        "2022-08-12T17:30:00+02:00": 4743,
        "2022-08-12T18:00:00+02:00": 3782,
        "2022-08-12T18:30:00+02:00": 2838,
        "2022-08-12T19:00:00+02:00": 1904,
        "2022-08-12T19:30:00+02:00": 1210,
        "2022-08-12T20:00:00+02:00": 590,
        "2022-08-12T20:30:00+02:00": 265,
        "2022-08-12T20:35:00+02:00": 0,
        "2022-08-13T06:04:00+02:00": 0,
        "2022-08-13T06:30:00+02:00": 706,
        "2022-08-13T07:00:00+02:00": 936,
        "2022-08-13T07:30:00+02:00": 1592,
        "2022-08-13T08:00:00+02:00": 2491,
        "2022-08-13T08:30:00+02:00": 3461,
        "2022-08-13T09:00:00+02:00": 4469,
        "2022-08-13T09:30:00+02:00": 5409,
        "2022-08-13T10:00:00+02:00": 6300,
        "2022-08-13T10:30:00+02:00": 7030,
        "2022-08-13T11:00:00+02:00": 7672,
        "2022-08-13T11:30:00+02:00": 8226,
        "2022-08-13T12:00:00+02:00": 8700,
        "2022-08-13T12:30:00+02:00": 9020,
        "2022-08-13T13:00:00+02:00": 9224,
        "2022-08-13T13:30:00+02:00": 9220,
        "2022-08-13T14:00:00+02:00": 9130,
        "2022-08-13T14:30:00+02:00": 8839,
        "2022-08-13T15:00:00+02:00": 8444,
        "2022-08-13T15:30:00+02:00": 7835,
        "2022-08-13T16:00:00+02:00": 7139,
        "2022-08-13T16:30:00+02:00": 6294,
        "2022-08-13T17:00:00+02:00": 5391,
        "2022-08-13T17:30:00+02:00": 4489,
        "2022-08-13T18:00:00+02:00": 3537,
        "2022-08-13T18:30:00+02:00": 2622,
        "2022-08-13T19:00:00+02:00": 1723,
        "2022-08-13T19:30:00+02:00": 1057,
        "2022-08-13T20:00:00+02:00": 492,
        "2022-08-13T20:30:00+02:00": 219,
        "2022-08-13T20:33:00+02:00": 0
      },
      "wh_days": {
        "2022-08-10T00:00:00": 94603717,
        "2022-08-11T00:00:00": 75880,
        "2022-08-12T00:00:00": 76735,
        "2022-08-13T00:00:00": 75761
      },
      "wh_hours": {
        "2022-08-10T06:00:00+02:00": 94533700,
        "2022-08-10T06:30:00+02:00": 250,
        "2022-08-10T07:00:00+02:00": 335,
        "2022-08-10T07:30:00+02:00": 522,
        "2022-08-10T08:00:00+02:00": 868,
        "2022-08-10T08:30:00+02:00": 1279,
        "2022-08-10T09:00:00+02:00": 1705,
        "2022-08-10T09:30:00+02:00": 2121,
        "2022-08-10T10:00:00+02:00": 2511,
        "2022-08-10T10:30:00+02:00": 2871,
        "2022-08-10T11:00:00+02:00": 3196,
        "2022-08-10T11:30:00+02:00": 3477,
        "2022-08-10T12:00:00+02:00": 3707,
        "2022-08-10T12:30:00+02:00": 3875,
        "2022-08-10T13:00:00+02:00": 4015,
        "2022-08-10T13:30:00+02:00": 4212,
        "2022-08-10T14:00:00+02:00": 4397,
        "2022-08-10T14:30:00+02:00": 4429,
        "2022-08-10T15:00:00+02:00": 4293,
        "2022-08-10T15:30:00+02:00": 4052,
        "2022-08-10T16:00:00+02:00": 3745,
        "2022-08-10T16:30:00+02:00": 3366,
        "2022-08-10T17:00:00+02:00": 2899,
        "2022-08-10T17:30:00+02:00": 2406,
        "2022-08-10T18:00:00+02:00": 1929,
        "2022-08-10T18:30:00+02:00": 1453,
        "2022-08-10T19:00:00+02:00": 998,
        "2022-08-10T19:30:00+02:00": 615,
        "2022-08-10T20:00:00+02:00": 331,
        "2022-08-10T20:30:00+02:00": 148,
        "2022-08-10T20:38:00+02:00": 12,
        "2022-08-11T06:02:00+02:00": 0,
        "2022-08-11T06:30:00+02:00": 164,
        "2022-08-11T07:00:00+02:00": 412,
        "2022-08-11T07:30:00+02:00": 634,
        "2022-08-11T08:00:00+02:00": 1014,
        "2022-08-11T08:30:00+02:00": 1466,
        "2022-08-11T09:00:00+02:00": 1939,
        "2022-08-11T09:30:00+02:00": 2409,
        "2022-08-11T10:00:00+02:00": 2856,
        "2022-08-11T10:30:00+02:00": 3273,
        "2022-08-11T11:00:00+02:00": 3651,
        "2022-08-11T11:30:00+02:00": 3971,
        "2022-08-11T12:00:00+02:00": 4231,
        "2022-08-11T12:30:00+02:00": 4424,
        "2022-08-11T13:00:00+02:00": 4547,
        "2022-08-11T13:30:00+02:00": 4596,
        "2022-08-11T14:00:00+02:00": 4574,
        "2022-08-11T14:30:00+02:00": 4486,
        "2022-08-11T15:00:00+02:00": 4323,
        "2022-08-11T15:30:00+02:00": 4079,
        "2022-08-11T16:00:00+02:00": 3754,
        "2022-08-11T16:30:00+02:00": 3382,
        "2022-08-11T17:00:00+02:00": 2969,
        "2022-08-11T17:30:00+02:00": 2521,
        "2022-08-11T18:00:00+02:00": 2046,
        "2022-08-11T18:30:00+02:00": 1579,
        "2022-08-11T19:00:00+02:00": 1135,
        "2022-08-11T19:30:00+02:00": 759,
        "2022-08-11T20:00:00+02:00": 452,
        "2022-08-11T20:30:00+02:00": 219,
        "2022-08-11T20:37:00+02:00": 15,
        "2022-08-12T06:03:00+02:00": 0,
        "2022-08-12T06:30:00+02:00": 151,
        "2022-08-12T07:00:00+02:00": 390,
        "2022-08-12T07:30:00+02:00": 599,
        "2022-08-12T08:00:00+02:00": 976,
        "2022-08-12T08:30:00+02:00": 1428,
        "2022-08-12T09:00:00+02:00": 1914,
        "2022-08-12T09:30:00+02:00": 2415,
        "2022-08-12T10:00:00+02:00": 2900,
        "2022-08-12T10:30:00+02:00": 3329,
        "2022-08-12T11:00:00+02:00": 3695,
        "2022-08-12T11:30:00+02:00": 4011,
        "2022-08-12T12:00:00+02:00": 4277,
        "2022-08-12T12:30:00+02:00": 4480,
        "2022-08-12T13:00:00+02:00": 4610,
        "2022-08-12T13:30:00+02:00": 4658,
        "2022-08-12T14:00:00+02:00": 4629,
        "2022-08-12T14:30:00+02:00": 4530,
        "2022-08-12T15:00:00+02:00": 4361,
        "2022-08-12T15:30:00+02:00": 4118,
        "2022-08-12T16:00:00+02:00": 3797,
        "2022-08-12T16:30:00+02:00": 3427,
        "2022-08-12T17:00:00+02:00": 3022,
        "2022-08-12T17:30:00+02:00": 2593,
        "2022-08-12T18:00:00+02:00": 2131,
        "2022-08-12T18:30:00+02:00": 1655,
        "2022-08-12T19:00:00+02:00": 1186,
        "2022-08-12T19:30:00+02:00": 778,
        "2022-08-12T20:00:00+02:00": 450,
        "2022-08-12T20:30:00+02:00": 214,
        "2022-08-12T20:35:00+02:00": 11,
        "2022-08-13T06:04:00+02:00": 0,
        "2022-08-13T06:30:00+02:00": 153,
        "2022-08-13T07:00:00+02:00": 410,
        "2022-08-13T07:30:00+02:00": 632,
        "2022-08-13T08:00:00+02:00": 1021,
        "2022-08-13T08:30:00+02:00": 1488,
        "2022-08-13T09:00:00+02:00": 1983,
        "2022-08-13T09:30:00+02:00": 2469,
        "2022-08-13T10:00:00+02:00": 2927,
        "2022-08-13T10:30:00+02:00": 3333,
        "2022-08-13T11:00:00+02:00": 3675,
        "2022-08-13T11:30:00+02:00": 3975,
        "2022-08-13T12:00:00+02:00": 4231,
        "2022-08-13T12:30:00+02:00": 4430,
        "2022-08-13T13:00:00+02:00": 4561,
        "2022-08-13T13:30:00+02:00": 4611,
        "2022-08-13T14:00:00+02:00": 4588,
        "2022-08-13T14:30:00+02:00": 4492,
        "2022-08-13T15:00:00+02:00": 4321,
        "2022-08-13T15:30:00+02:00": 4070,
        "2022-08-13T16:00:00+02:00": 3743,
        "2022-08-13T16:30:00+02:00": 3358,
        "2022-08-13T17:00:00+02:00": 2922,
        "2022-08-13T17:30:00+02:00": 2470,
        "2022-08-13T18:00:00+02:00": 2006,
        "2022-08-13T18:30:00+02:00": 1540,
        "2022-08-13T19:00:00+02:00": 1086,
        "2022-08-13T19:30:00+02:00": 695,
        "2022-08-13T20:00:00+02:00": 387,
        "2022-08-13T20:30:00+02:00": 178,
        "2022-08-13T20:33:00+02:00": 6
      }
    },
    "account": {
      "type": "personal",
      "rate_limit": 60,
      "timezone": "Europe/Berlin"
    }
  }
}

And with Damping = 0.001 I have pretty much the same values, but these high numbers like 94603717 are just around 70000 (which should be the correct value for today)

florie1706 avatar Aug 10 '22 12:08 florie1706

As far as I can judge now, this is something that really goes wrong with the API, so it's best to address it in the Discord server.

klaasnicolaas avatar Aug 10 '22 13:08 klaasnicolaas

@klaasnicolaas When I put my data in the url as stated on the forecast.solar website I get the following totals:

watt_hours_day
2022-08-10 70413
2022-08-11 75821
2022-08-12 76787
2022-08-13 76884

This looks correct to me.

Also the values @ watts look good, during the day about 6000 - 7000 watts which is normal for my plant.

watt-hours are increasing until the day value stated above.

florie1706 avatar Aug 10 '22 13:08 florie1706

What if you try it through this type of URL: https://api.forecast.solar/estimate/:lat/:lon/:dec/:az/:kwp?time=iso8601&damping=0

klaasnicolaas avatar Aug 10 '22 15:08 klaasnicolaas

Looks good to me as well:

watt_hours_day
2022-08-10 69968
2022-08-11 75807
2022-08-12 76787
2022-08-13 76884

And if I do https://api.forecast.solar/estimate/:lat/:lon/:dec/:az/:kwp its the same values ...

florie1706 avatar Aug 10 '22 15:08 florie1706

@zSprawl I see you had a value wrong in your API request, you used a WP value but that must be KWP if you request data directly from the API: https://api.forecast.solar/estimate/32.82/117.1/25/119/6.380

The API request was merely a test I tried. I didn’t go changing the code in HA…

zSprawl avatar Aug 10 '22 15:08 zSprawl

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Nov 08 '22 16:11 github-actions[bot]