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.75k stars 30k forks source link

division by zero on Freebox Integration #49307

Closed Poneyy closed 3 years ago

Poneyy commented 3 years ago

The problem

This integration work, but provide error on Log, maybe for partitions sensors? Hassio create 2 of them (Volume 256Go Free space) but both are Not Available.

I think it's a calculation problem. If a disk is in a RAID, free_bytes and total_bytes are equal to Zero. Maybe add a condition if raid or something like that?

What is version of Home Assistant Core has the issue?

System Health version | core-2021.4.5 -- | -- installation_type | Home Assistant OS dev | false hassio | true docker | true virtualenv | false python_version | 3.8.7 os_name | Linux os_version | 5.4.109 arch | x86_64 timezone | Europe/Paris
Home Assistant Community Store GitHub API | ok -- | -- Github API Calls Remaining | 5000 Installed Version | 1.11.3 Stage | running Available Repositories | 846 Installed Repositories | 28
Home Assistant Supervisor host_os | Home Assistant OS 5.13 -- | -- update_channel | stable supervisor_version | supervisor-2021.04.0 docker_version | 19.03.15 disk_total | 30.8 GB disk_used | 26.7 GB healthy | true supported | true board | ova supervisor_api | ok version_api | ok installed_addons | Samba share (9.3.1), Mosquitto broker (5.1.1), deCONZ (6.8.0), AppDaemon 4 (0.5.2), TasmoAdmin (0.14.1), AdGuard Home (4.0.0), Check Home Assistant configuration (3.6.0), Let's Encrypt (4.11.0), Portainer (1.4.0), Terminal & SSH (9.1.0), chrony (2.0.2), Log Viewer (0.10.2), Visual Studio Code (3.3.0), ESPHome (1.16.2), MariaDB (2.3.0), Network UPS Tools (0.6.2)
Lovelace dashboards | 2 -- | -- resources | 20 views | 11 mode | storage

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

freebox

Link to integration documentation on our website

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

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.components.sensor
Source: components/freebox/sensor.py:228
Integration: Capteur (documentation, issues)
First occurred: 18:09:11 (2 occurrences)
Last logged: 18:09:11

Error adding entities for domain sensor with platform freebox
Error while setting up freebox platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 322, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 514, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 546, in add_to_platform_finish
    await self.async_added_to_hass()
  File "/usr/src/homeassistant/homeassistant/components/freebox/sensor.py", line 150, in async_added_to_hass
    self.async_update_state()
  File "/usr/src/homeassistant/homeassistant/components/freebox/sensor.py", line 228, in async_update_state
    self._partition["free_bytes"] * 100 / self._partition["total_bytes"], 2
ZeroDivisionError: division by zero

Additional information

Freebox Delta S (Freebox v7 r1, OS 4.2.10) with a RAID1 of 2 identical SSDs.

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

freebox documentation freebox source (message by IssueLinks)

github-actions[bot] commented 3 years 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.