core: AMCREST Camera component: Empty camera sdcard throws error
Version HASSIO 84.6
"hostname": "hassio",
"operating_system": "HassOS 1.13",
"deployment": "production",
"kernel": "4.14.81-v7"
Environment Hassio on RasPi3 B+ | Amcrest IP cameras with sdcard support
Description of problem: If a new SDCard is installed (or not present) the logic for reporting the SDCard disk usage throws an index error in storage.py and no sensor entity is created.
Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):
amcrest:
- host: 192.168.xxx.xxx
name: "xxx"
username: userid
password: !secret ipc_pw
resolution: high
stream_source: rtsp
port: 80
sensors:
- ptz_preset
- sdcard
- host: 192.168.xxx.xxx
name: "yyy"
username: userid
password: !secret ipc_pw
resolution: high
stream_source: rtsp
port: 80
sensors:
- sdcard
Traceback (if applicable):
2019-01-11 08:27:25 ERROR (MainThread) [homeassistant.components.sensor] amcrest: Error on device update!
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/sensor/amcrest.py", line 103, in update
sd_used = self._camera.storage_used
File "/usr/local/lib/python3.6/site-packages/amcrest/storage.py", line 39, in storage_used
status = [s for s in ret.split() if '.UsedBytes=' in s][0]
IndexError: list index out of range
Additional information: I’m actually now using @pnbruckner customized amcrest component which I see is in the process of being merged into the official component. I believe this error was present in the original component as well. In any case, it is a very minor issue since when data is written to the card, the error should go away.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (15 by maintainers)
Commits related to this issue
- Handle errors in storage methods Address problem noted in https://github.com/home-assistant/home-assistant/issues/19982. Fix will also require an update to HA amcrest component to bump the version re... — committed to tchellomello/python-amcrest by pnbruckner 5 years ago
- Amcrest: Add on/off support & attributes to camera entity. Bump amcrest package to 1.3.0. Add support for turn_on & turn_off services. Add implementation of is_recording method, as well as brand, mo... — committed to pnbruckner/home-assistant by pnbruckner 5 years ago
- Amcrest: Add on/off support & attributes. Bump amcrest to 1.3.0 (#22418) * Amcrest: Add on/off support & attributes to camera entity. Bump amcrest package to 1.3.0. Add support for turn_on & turn_... — committed to home-assistant/core by pnbruckner 5 years ago
- Amcrest: Add on/off support & attributes. Bump amcrest to 1.3.0 (#22418) * Amcrest: Add on/off support & attributes to camera entity. Bump amcrest package to 1.3.0. Add support for turn_on & turn_... — committed to unibeck/home-assistant by pnbruckner 5 years ago
@dshokouhi too late - seems they already fixed it (in #22338.) I no longer have the streaming issues. Starts right away, and keeps on ticking… Yay!!!
This is probably a bug in the amcrest package. I can look into fixing it. @GaryOkie, can you open an issue here if you haven’t already?