core icon indicating copy to clipboard operation
core copied to clipboard

Sonarr Sensor - division by zero error

Open mynameisdaniel32 opened this issue 9 years ago • 1 comments

Make sure you are running the latest version of Home Assistant before reporting an issue.

You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:

Home Assistant release (hass --version): 0.53.0

Python release (python3 --version): 3.5.3

Component/platform: Sensor/Sonarr

I'm getting the following error when I start Home Assistant. Was happening on 0.52.1 also (hadn't used Sonarr before then).

2017-09-09 23:00:12 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 381, in async_process_entity
    new_entity, self, update_before_add=update_before_add
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity_component.py", line 238, in async_add_entity
    yield from entity.async_update_ha_state()
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 247, in async_update_ha_state
    device_attr = self.device_state_attributes
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/sensor/sonarr.py", line 138, in device_state_attributes
    )] = '{:.2f}%'.format(100*(1-(show['sizeleft']/show['size'])))
ZeroDivisionError: float division by zero

My configuration.yaml has the following for sonarr/radarr:

sensor:
  - platform: sonarr
    api_key: d48d00bd86b4429b9ce27e3b7cdc9a07
    host: server.home
    monitored_conditions:
      - series
      - upcoming
      - queue
      - diskspace
      - status
    days: 3
    urlbase: /sonarr
    include_paths:
      - M:\
    
  - platform: radarr
    api_key: 7227ae724fe24abd97e91d63af2cfe41
    host: server.home
    monitored_conditions:
      - movies
      - upcoming
      - diskspace
      - status
    days: 3
    urlbase: /radarr
    include_paths:
      - C:\

I suspect the problem is the the queue monitored condition as that's the only one not working - but is in the documentation.

I also noticed the queue condition isn't available in the Radarr component (according to the docs). And the status condition isn't in the Sonarr sensor docs (but works fine in 0.53.0).

mynameisdaniel32 avatar Sep 09 '17 13:09 mynameisdaniel32

I am having the same issue as of version 0.54.0. Would be nice to not have this always spamming my error logs.

MarioHA avatar Sep 26 '17 12:09 MarioHA