SecKatie / ha-wyzeapi

Home Assistant Integration for Wyze devices.
733 stars 112 forks source link

[Bug] Camera' object has no attribute 'motion' #523

Closed paulcusick3 closed 9 months ago

paulcusick3 commented 10 months ago

Describe the bug Do not see issue, but filling up logs, reported over 3k times in 24hours. Guessing it is either door bell or floodlight pro that I recently installed.

To Reproduce N/A

Expected behavior N/A

System configuration System: Home Assistant Blue / Hardkernel ODROID-N2/N2+ HA Version: Home Assistant 2023.10.1 WyzeApi Version:

home-assistant.log

2023-10-12 10:49:22.796 ERROR (MainThread) [homeassistant.util.logging] Exception in handle_camera_update when dispatching 'wyzeapi.camera_updated-LD_CFP_D03F276D3948': (<Device: DeviceTypes.CAMERA, LD_CFP_D03F276D3948>,)
Traceback (most recent call last):
  File "/config/custom_components/wyzeapi/switch.py", line 455, in handle_camera_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 779, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 879, in _async_write_ha_state
    state, attr = self._async_generate_attributes()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 820, in _async_generate_attributes
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 785, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1307, in state
    if (is_on := self.is_on) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/wyzeapi/switch.py", line 444, in is_on
    return self._device.motion
           ^^^^^^^^^^^^^^^^^^^
AttributeError: 'Camera' object has no attribute 'motion'
brg468 commented 10 months ago

Can you post the model numbers for the doorbell and floodlight pro (from the device page in HA for each) and I’ll add it to the list of cams that don’t support motion.

paulcusick3 commented 10 months ago

Flood light pro = LD_CFP Doorbell Pro = GW_BE1 Lock Bolt = unknown - just pulling battery status as unknown

also from log; so it is the Flood Light Pro Exception in handle_camera_update when dispatching 'wyzeapi.camera_updated-LD_CFP_D03F276D3948': (<Device: DeviceTypes.CAMERA, LD_CFP_D03F276D3948>

brg468 commented 10 months ago

Oh yea I just noticed the doorbell is already excluded. I’ll submit a PR but there’s been no activity on this repo in a while so I wouldn’t hold your breath on getting it merged anytime soon. You can add the model number here and that should exclude it.

https://github.com/SecKatie/ha-wyzeapi/blob/5ccebafe3266ceb26bceadfd73f0ce4e2124477e/custom_components/wyzeapi/switch.py#L27

paulcusick3 commented 10 months ago

Oh yea I just noticed the doorbell is already excluded. I’ll submit a PR but there’s been no activity on this repo in a while so I wouldn’t hold your breath on getting it merged anytime soon. You can add the model number here and that should exclude it.

https://github.com/SecKatie/ha-wyzeapi/blob/5ccebafe3266ceb26bceadfd73f0ce4e2124477e/custom_components/wyzeapi/switch.py#L27

Thanks - Updated locally to exclude

github-actions[bot] commented 9 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 9 months ago

This issue was closed because it has been stalled for 5 days with no activity.

SecKatie commented 6 months ago

Fixed in #524