sanjoyg / dirigera_platform

HomeAssistant Integration for Dirigera Platform
MIT License
122 stars 16 forks source link

Configure sensor to check that attr exists before getting #92

Closed s3than closed 1 month ago

s3than commented 1 month ago

Describe your changes

Briefly describe your changes

Check that the attr exists before attempting to get

Resolves

2024-10-17 23:15:48.706 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up dirigera_platform platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 361, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/dirigera_platform/sensor.py", line 128, in async_setup_entry
    if getattr(hub_outlet.attributes,attr) is not None:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'OutletAttributes' object has no attribute 'current_amps'

Checklist before submitting a pull request

Checklist for reviewer