Bump amcrest to 1.4.0 and use new storage_all method (#23446)
Improve sdcard sensor so it only sends one command to camera per update as opposed to the four it used to send to reduce network traffic and make data consistent. Also better handle returned values of 'unknown'.pull/23478/head
parent
96fb311f6b
commit
1dbfa8f3be
|
@ -3,7 +3,7 @@
|
||||||
"name": "Amcrest",
|
"name": "Amcrest",
|
||||||
"documentation": "https://www.home-assistant.io/components/amcrest",
|
"documentation": "https://www.home-assistant.io/components/amcrest",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"amcrest==1.3.0"
|
"amcrest==1.4.0"
|
||||||
],
|
],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"ffmpeg"
|
"ffmpeg"
|
||||||
|
|
|
@ -84,8 +84,16 @@ class AmcrestSensor(Entity):
|
||||||
self._state = self._api.ptz_presets_count
|
self._state = self._api.ptz_presets_count
|
||||||
|
|
||||||
elif self._sensor_type == 'sdcard':
|
elif self._sensor_type == 'sdcard':
|
||||||
sd_used = self._api.storage_used
|
storage = self._api.storage_all
|
||||||
sd_total = self._api.storage_total
|
try:
|
||||||
self._attrs['Total'] = '{0} {1}'.format(*sd_total)
|
self._attrs['Total'] = '{:.2f} {}'.format(*storage['total'])
|
||||||
self._attrs['Used'] = '{0} {1}'.format(*sd_used)
|
except ValueError:
|
||||||
self._state = self._api.storage_used_percent
|
self._attrs['Total'] = '{} {}'.format(*storage['total'])
|
||||||
|
try:
|
||||||
|
self._attrs['Used'] = '{:.2f} {}'.format(*storage['used'])
|
||||||
|
except ValueError:
|
||||||
|
self._attrs['Used'] = '{} {}'.format(*storage['used'])
|
||||||
|
try:
|
||||||
|
self._state = '{:.2f}'.format(storage['used_percent'])
|
||||||
|
except ValueError:
|
||||||
|
self._state = storage['used_percent']
|
||||||
|
|
|
@ -161,7 +161,7 @@ alarmdecoder==1.13.2
|
||||||
alpha_vantage==2.1.0
|
alpha_vantage==2.1.0
|
||||||
|
|
||||||
# homeassistant.components.amcrest
|
# homeassistant.components.amcrest
|
||||||
amcrest==1.3.0
|
amcrest==1.4.0
|
||||||
|
|
||||||
# homeassistant.components.androidtv
|
# homeassistant.components.androidtv
|
||||||
androidtv==0.0.15
|
androidtv==0.0.15
|
||||||
|
|
Loading…
Reference in New Issue