Skip to content

Commit

Permalink
add alert enabled attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
rsnodgrass committed Jan 20, 2021
1 parent b4eabc6 commit c5702f2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions custom_components/sensorpush/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from homeassistant.const import CONF_NAME, CONF_USERNAME, CONF_PASSWORD, CONF_SCAN_INTERVAL

from .const import (ATTR_BATTERY_VOLTAGE, ATTR_DEVICE_ID, ATTR_OBSERVED_TIME, ATTR_AGE,
ATTR_ATTRIBUTION, ATTRIBUTION, MEASURES,
ATTR_ALERT_MIN, ATTR_ALERT_MAX, CONF_UNIT_SYSTEM, CONF_MAXIMUM_AGE,
ATTR_ATTRIBUTION, ATTRIBUTION, MEASURES, CONF_UNIT_SYSTEM, CONF_MAXIMUM_AGE,
ATTR_ALERT_MIN, ATTR_ALERT_MAX, ATTR_ALERT_ENABLED,
SENSORPUSH_DOMAIN, UNIT_SYSTEM_IMPERIAL, UNIT_SYSTEM_METRIC, UNIT_SYSTEMS)

LOG = logging.getLogger(__name__)
Expand Down Expand Up @@ -172,7 +172,8 @@ def _update_callback(self):
if alerts.get("min"):
self._attrs.update({
ATTR_ALERT_MIN: alerts.get("min"),
ATTR_ALERT_MAX: alerts.get("max")
ATTR_ALERT_MAX: alerts.get("max"),
ATTR_ALERT_ENABLED: alerts.get("enabled")
})

# LOG.info(f"{self._state} ... {self._attrs} ... {sensor_data} ... {self._sensor_info}")
Expand Down
1 change: 1 addition & 0 deletions custom_components/sensorpush/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
ATTR_OBSERVED_TIME = 'observed_time'
ATTR_ALERT_MIN = 'alert_min'
ATTR_ALERT_MAX = 'alert_max'
ATTR_ALERT_ENABLED = 'alert_enabled'

CONF_UNIT_SYSTEM = 'unit_system'
CONF_MAXIMUM_AGE = 'maximum_age' # maximum age (in minutes) of observations before they expire
Expand Down

0 comments on commit c5702f2

Please sign in to comment.