home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.82k stars 30.08k forks source link

Many items from tomorrow.io integration being listed as "unknown" #72739

Closed 7uAip6 closed 1 year ago

7uAip6 commented 2 years ago

The problem

Many items from tomorrow.io integration being listed as "unknown". Below is a partial list.

image

What version of Home Assistant Core has the issue?

2022.5.0

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

tomorrow.io

Link to integration documentation on our website

No response

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

probot-home-assistant[bot] commented 2 years ago

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


tomorrowio documentation tomorrowio source (message by IssueLinks)

lymanepp commented 2 years ago

Not all values are available in all regions from tomorrow.io. You can disable the sensors for values that aren't available in your region.

7uAip6 commented 2 years ago

Really? I live in the US. Are you saying the EPA properties aren't available in my region? That seems very odd.

lymanepp commented 2 years ago

These fields are requested from the tomorrow.io API: 'temperature', 'temperatureApparent', 'dewPoint', 'humidity', 'windSpeed', 'windDirection', 'windGust', 'pressureSurfaceLevel', 'pressureSeaLevel', 'precipitationIntensity', 'precipitationProbability', 'precipitationType', 'hailBinary', 'solarGHI', 'solarDNI', 'solarDHI', 'visibility', 'cloudCover', 'cloudBase', 'cloudCeiling', 'weatherCode', 'particulateMatter25', 'particulateMatter10', 'pollutantO3', 'pollutantNO2', 'pollutantCO', 'pollutantSO2', 'mepIndex', 'mepPrimaryPollutant', 'mepHealthConcern', 'epaIndex', 'epaPrimaryPollutant', 'epaHealthConcern', 'treeIndex', 'grassIndex', 'grassGrassIndex', 'weedIndex', 'weedRagweedIndex', 'fireIndex'

But only these values are returned by the API. This might also be dependent on the API key (free vs paid). But since I only have a free key, I can't say for certain. Other values are displayed on their web site, which supports the API key theory.

{
  "data": {
    "timelines": [
      {
        "timestep": "current",
        "endTime": "2022-05-31T23:08:00Z",
        "startTime": "2022-05-31T23:08:00Z",
        "intervals": [
          {
            "startTime": "2022-05-31T23:08:00Z",
            "values": {
              "cloudBase": 0.75,
              "cloudCeiling": 0.75,
              "cloudCover": 86,
              "dewPoint": 67.44,
              "fireIndex": 13,
              "grassGrassIndex": 1,
              "grassIndex": 1,
              "hailBinary": 0,
              "humidity": 57,
              "precipitationIntensity": 0,
              "precipitationProbability": 0,
              "precipitationType": 0,
              "pressureSeaLevel": 30.01,
              "pressureSurfaceLevel": 29.9,
              "temperature": 84.43,
              "temperatureApparent": 87.46,
              "treeIndex": 0,
              "visibility": 9.94,
              "weatherCode": 1001,
              "weedIndex": 0,
              "weedRagweedIndex": 0,
              "windDirection": 79,
              "windGust": 14.26,
              "windSpeed": 8.11
            }
          }
        ]
      }
    ]
  }
}
raman325 commented 2 years ago

I think something was broken, I am seeing the same. Will do some testing.

raman325 commented 2 years ago

hmm never mind, I am getting all the data for my location. And I am also using a free key, so I don't think the API key is the issue. It's possible that your location just doesn't have this data at the moment.

lymanepp commented 2 years ago

@raman325 can you share the JSON response for your location/API key so I can compare?

raman325 commented 2 years ago

You can validate this by running the following: https://api.tomorrow.io/v4/timelines?location=<YOUR_LATITUDE>,<YOUR_LONGITUDE>&fields=epaIndex&timesteps=1h&units=metric&apikey=<YOUR_API_KEY>

This should return the current EPA Index. If it's None, then that means it's an upstream problem

raman325 commented 2 years ago

here's what I get:

{
    "cloudBase": 1.39,
    "cloudCeiling": null,
    "cloudCover": 46,
    "dewPoint": 20.5,
    "epaHealthConcern": 1,
    "epaIndex": 65,
    "epaPrimaryPollutant": 0,
    "fireIndex": 3,
    "grassIndex": 0,
    "humidity": 53,
    "mepHealthConcern": 0,
    "mepIndex": 32,
    "mepPrimaryPollutant": 4,
    "particulateMatter10": 18.81,
    "particulateMatter25": 18.81,
    "pollutantCO": 3.31,
    "pollutantNO2": 17.69,
    "pollutantO3": 32.19,
    "pollutantSO2": 4.63,
    "precipitationType": 0,
    "pressureSeaLevel": 1013.88,
    "pressureSurfaceLevel": 1010.56,
    "solarGHI": 10.45,
    "temperature": 31.31,
    "temperatureApparent": 33.69,
    "treeIndex": 4,
    "visibility": 16,
    "weatherCode": 1101,
    "weedIndex": 0,
    "windDirection": 255.13,
    "windGust": 2.5,
    "windSpeed": 0.81
}
lymanepp commented 2 years ago

This should return the current EPA Index. If it's None, then that means it's an upstream problem

curl "https://api.tomorrow.io/v4/timelines?location=<LAT>,<LONG>&fields=epaIndex&timesteps=1h&units=metric&apikey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
{"code":403003,"type":"Forbidden Action","message":"The plan is restricted and cannot perform this action. Adjust action and try again: All requested fields are not allowed."}
raman325 commented 2 years ago

interesting. Maybe I was grandfathered in to a more permissive free plan?

lymanepp commented 2 years ago

That could be. I signed up recently (April 8).

7uAip6 commented 2 years ago

&fields=epaIndex&timesteps=1h&units=metric

Yeah I also get the "Forbidden action" line...unfortunately it seems the free API keys being given out now are much less functional :-(

benblb commented 2 years ago

EDIT: Server side issue from Tomorrow most likely, fixed itself overnight.

My integration has a ton of things unknown right now. Not usual and I've been using it for a long time. Any ideas? I see there's a temperature keyerror.

Log:

Logger: homeassistant.components.weather
Source: components/weather/__init__.py:255
Integration: Weather (documentation, issues)
First occurred: 11:14:08 PM (2 occurrences)
Last logged: 11:14:08 PM

Error adding entities for domain weather with platform tomorrowio
Error while setting up tomorrowio platform for weather
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 382, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 619, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 810, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 533, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 573, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/weather/__init__.py", line 255, in state_attributes
    forecast_entry[ATTR_FORECAST_TEMP],
KeyError: 'temperature'
LewisSpring commented 2 years ago

Just wanted to +1. I signed up on the 17th (of June) and am getting the same API error via cURL and lack of (some) sensors. It's a shame, especially since the https://www.tomorrow.io/weather site does give the information (AQI) I was looking for.

lymanepp commented 2 years ago

When did you sign up for your API keys? Recently acquired free keys don't have access to many values. My free key was acquired in early April and I don't have access to many values.

zacs commented 2 years ago

I signed up for a key today and only 1 of the 28 sensors is available (the weather.tomorrow_io_home_daily one). My dev portal is pretty clear that my key is only entitled to Core data layers, so that makes sense.

lymanepp commented 2 years ago

Have you enabled any sensors besides the default ONE sensor? I signed up in April and also get just Core data layer. See the full list of Core data layer values at https://docs.tomorrow.io/reference/data-layers-core

zacs commented 2 years ago

Yah, I enabled them all but they all just show as unknown like below. Trying to access things like EPA data using a CURL request gives me the same forbidden response as you get.

image
lymanepp commented 2 years ago

Something doesn't look right. It should show a human readable name and "Unknown" for those values. Here's what it looks like for me. Have you tried restarting HA?

image

zacs commented 2 years ago

Ah good call, I did a hard refresh of the page and now they show like yours. Nice, at least a few other sensors appear to work! Glad to have cloud cover and fire index in particular!

I've never had a component make me go in and force-enable the sensors, so it's probably something that should be added to the documentation. Is there a reason they aren't just enabled by default?

lymanepp commented 2 years ago

I've never had a component make me go in and force-enable the sensors, so it's probably something that should be added to the documentation. Is there a reason they aren't just enabled by default?

That's a design decision that predates my involvement, so I'll let @raman325 respond to that. 😄

raman325 commented 2 years ago

it's a fairly common pattern in many integrations, maybe not all of them. The idea is that every enabled entity records a state which increases the amount of data being stored, processed, etc. We disable by default entities that will be less commonly used while making them accessible to users that need them.

Regarding the comments about what data your API keys have access to, can you share a screenshot of where you see that? It would be great if we could query that information so that we don't create entities that aren't relevant to you - if that's not possible today maybe it's something we can request

lymanepp commented 2 years ago

I found it by logging in at xxx and clicking on the icon with my initials in the lower left corner. Then click Account Management | Settings. It looks like this for me.

image

lymanepp commented 2 years ago

I sent the following support request to tomorrow.io

Some API tokens might only have access to the Core data layer while others might have more. The Account Management UI provides a way to find available layers (see attachment), but is there an API call to get list of available layers for an API token?

raman325 commented 2 years ago

ha, I also submitted a request, let's see what they say

robin-vandaele commented 2 years ago

Since today, I'm having the same issue. All my entities have gone unavailable & my API key has worked up until now.. Now I get: {"code":403003,"type":"Forbidden Action","message":"The plan is restricted and cannot perform this action. Adjust action and try again: All requested fields are not allowed"}

benblb commented 2 years ago

I just submitted to support due to frequent outages. My Tomorrow.io API calls frequently fail. It happens for small blocks of time at minimum once per week with plenty of calls remaining.

github-actions[bot] commented 1 year ago

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.