r-renato / ha-climacell-weather

Climacell weather provider integration is a custom component for Home Assistant. The climacell platform uses the Climacell API as a source for meteorological data for your location.
MIT License
45 stars 10 forks source link

Pollen index KeyError #58

Open fettlaus opened 3 years ago

fettlaus commented 3 years ago

My integration started reporting errors while handling pollen values for my area. It seems there is some kind of unit conversion error with the pollen index going on.

Logger: homeassistant.helpers.entity
Source: custom_components/climacell/sensor.py:411
First occurred: 26. März 2021, 22:50:19 (3158 occurrences)
Last logged: 10:50:03

Update for sensor.cc_climacell_pollen_tree fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 277, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 473, in async_device_update
    raise exc
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/climacell/sensor.py", line 411, in update
    self._state = self.__valuemap[str(self._state)]
KeyError: '0.83'

This is my configuration:

- platform: climacell
  api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  name: climacell
  units: metric
  timelines:
    - name: "" #Realtime
      timestep: "1m"
      forecast_observations: 1
      fields:
        - temperatureMax
        - feels_like
        - humidity
        - wind_speed
        - wind_direction
        - wind_gust
        - pressure
        - precipitationIntensity
        - precipitation_type
        - visibility
        - cloud_cover
        - weather_condition
        - pm25
        - pm10
        - o3
        - no2
        - co
        - so2
        - epa_aqi
        - epa_health_concern
        - pollen_tree
        - pollen_weed
        - pollen_grass
        - fire_index
      update: auto
      scan_interval:
        # At least one of these must be specified:
        days: 0
        hours: 1
        minutes: 0
        seconds: 0
        milliseconds: 0
      exclude_interval:
        1:
          - "00:00"
          - "07:00"
    - name: "" #Daily
      timestep: "1d"
      forecast_observations: 5
      fields:
        - temperature
        - temperatureMin
        - temperatureMax
        - precipitationIntensityMin
        - precipitationIntensityMax
        - precipitation_probability
        - weather_condition
      scan_interval:
        # At least one of these must be specified:
        days: 0
        hours: 4
        minutes: 0
        seconds: 0
        milliseconds: 0
      exclude_interval:
        1:
          - "23:00"
          - "06:30"
Krojack commented 3 years ago

I'm getting similar

Logger: homeassistant.components.sensor
Source: custom_components/climacell/sensor.py:411
Integration: Sensor (documentation, issues)
First occurred: 3:02:53 PM (1 occurrences)
Last logged: 3:02:53 PM

climacell: Error on device update!
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 360, in _async_add_entity
    await entity.async_device_update(warning=False)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 465, in async_device_update
    await task
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/climacell/sensor.py", line 411, in update
    self._state = self.__valuemap[str(self._state)]
KeyError: '1.95'

Everything seems to be working but the daily pollen_tree.

Krojack commented 3 years ago

Update: The error went away for me today after a restart and the pollen_tree sensor is working again. Maybe this was a problem on Climacell's side.

damousys commented 3 years ago

I Have the same issue

mbrihed commented 3 years ago

I seem to have the same issue. It seems it is only pollen_tree the other seems ok.

mbrihed commented 3 years ago

Update: Just did an upgrade to core-2021.4.4 and then it worked fine again. SO now I have the sensor working.