Skip to content

Commit

Permalink
Merge pull request #364 from maxyvon/UNMONITORED_DEVICES
Browse files Browse the repository at this point in the history
Ne pas créé de sensors de power pour les unmonitored devices
  • Loading branch information
ic-dev21 authored Feb 5, 2024
2 parents 64c71f2 + 818b6f2 commit 502ca25
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions custom_components/hilo/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from homeassistant.helpers.restore_state import RestoreEntity
from homeassistant.util import Throttle, slugify
import homeassistant.util.dt as dt_util
from pyhilo.const import UNMONITORED_DEVICES
from pyhilo.device import HiloDevice
from pyhilo.event import Event
from pyhilo.util import from_utc_timestamp
Expand Down Expand Up @@ -104,7 +105,7 @@ def generate_entities_from_device(device, hilo, scan_interval):
entities.append(DeviceSensor(hilo, device))
if device.has_attribute("noise"):
entities.append(NoiseSensor(hilo, device))
if device.has_attribute("power"):
if device.has_attribute("power") and device.model not in UNMONITORED_DEVICES:
entities.append(PowerSensor(hilo, device))
if device.has_attribute("target_temperature"):
entities.append(TargetTemperatureSensor(hilo, device))
Expand Down Expand Up @@ -160,7 +161,7 @@ def create_energy_entity(hilo, device):
for d in hilo.devices.all:
LOG.debug(f"Adding device {d}")
new_entities.extend(generate_entities_from_device(d, hilo, scan_interval))
if d.has_attribute("power"):
if d.has_attribute("power") and d.model not in UNMONITORED_DEVICES:
# If we opt out the geneneration of meters we just create the power sensors
if generate_energy_meters:
create_energy_entity(hilo, d)
Expand Down

0 comments on commit 502ca25

Please sign in to comment.