Protect sensitive information for Amcrest cameras (#10569)
* Creates a AmcresHub object to protect some private attributes on the logs * Uses hass.data to pass AmcrestHub to components * Prefer constants * Removed serializer since it's using hass.data and simplified camera entity constructor * small cleanup
This commit is contained in:
parent
3ef9c99003
commit
3dd49b2b95
3 changed files with 38 additions and 35 deletions
|
@ -8,9 +8,9 @@ import asyncio
|
|||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from homeassistant.components.amcrest import SENSORS
|
||||
from homeassistant.components.amcrest import DATA_AMCREST, SENSORS
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.const import STATE_UNKNOWN
|
||||
from homeassistant.const import CONF_NAME, CONF_SENSORS, STATE_UNKNOWN
|
||||
|
||||
DEPENDENCIES = ['amcrest']
|
||||
|
||||
|
@ -25,13 +25,14 @@ def async_setup_platform(hass, config, async_add_devices, discovery_info=None):
|
|||
if discovery_info is None:
|
||||
return
|
||||
|
||||
device = discovery_info['device']
|
||||
name = discovery_info['name']
|
||||
sensors = discovery_info['sensors']
|
||||
device_name = discovery_info[CONF_NAME]
|
||||
sensors = discovery_info[CONF_SENSORS]
|
||||
amcrest = hass.data[DATA_AMCREST][device_name]
|
||||
|
||||
amcrest_sensors = []
|
||||
for sensor_type in sensors:
|
||||
amcrest_sensors.append(AmcrestSensor(name, device, sensor_type))
|
||||
amcrest_sensors.append(
|
||||
AmcrestSensor(amcrest.name, amcrest.device, sensor_type))
|
||||
|
||||
async_add_devices(amcrest_sensors, True)
|
||||
return True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue