mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Avoid traceback for Amcrest cameras/firmware that does not have the software_information API call (#5865)
* Avoid traceback for Amcrest cameras/firmware that does not have the software_information API call * Make lint happy
This commit is contained in:
parent
e877d572f5
commit
75887e6069
@ -122,10 +122,18 @@ class AmcrestSensor(Entity):
|
||||
|
||||
def update(self):
|
||||
"""Get the latest data and updates the state."""
|
||||
version, build_date = self._camera.software_information
|
||||
self._attrs['Build Date'] = build_date.split('=')[-1]
|
||||
self._attrs['Serial Number'] = self._camera.serial_number
|
||||
self._attrs['Version'] = version.split('=')[-1]
|
||||
try:
|
||||
version, build_date = self._camera.software_information
|
||||
self._attrs['Build Date'] = build_date.split('=')[-1]
|
||||
self._attrs['Version'] = version.split('=')[-1]
|
||||
except ValueError:
|
||||
self._attrs['Build Date'] = 'Not Available'
|
||||
self._attrs['Version'] = 'Not Available'
|
||||
|
||||
try:
|
||||
self._attrs['Serial Number'] = self._camera.serial_number
|
||||
except ValueError:
|
||||
self._attrs['Serial Number'] = 'Not Available'
|
||||
|
||||
if self._sensor_type == 'motion_detector':
|
||||
self._state = self._camera.is_motion_detected
|
||||
|
Loading…
x
Reference in New Issue
Block a user