* Bump skybellpy to 0.4.0 * Bump skybellpy to 0.4.0 in requirements_all.txt * Added extra states for STATE_ALARM_TRIGGERED to allow users to know if it is a burglar or fire or carbon monoxide so automations can take appropriate actions. Updated TotalConnect component to handle these new states. * Fix const import * Fix const import * Fix const imports * Bump total-connect-client to 0.26. * Catch details of alarm trigger in state attributes. Also bumps total_connect_client to 0.27. * Change state_attributes() to device_state_attributes() * Move totalconnect component toward being a multi-platform integration. Bump total_connect_client to 0.28. * add missing total-connect alarm state mappings * Made recommended changes of MartinHjelmare at https://github.com/home-assistant/home-assistant/pull/24427 * Update __init__.py * Updates per MartinHjelmare comments * flake8/pydocstyle fixes * removed . at end of log message * added blank line between logging and voluptuous * more fixes * Adding totalconnect zones as HA binary_sensors * fix manifest.json * flake8/pydocstyle fixes. Added codeowner. * Update formatting per @springstan guidance. * Fixed pylint * Add zone ID to log message for easier troubleshooting * Account for bypassed zones in update() * More status handling fixes. * Fixed flake8 error * Another attempt at black/isort fixes. * Bump total-connect-client to 0.50. Simplify code using new functions in total-connect-client package instead of importing constants. Run black and isort. * Fix manifest file * Another manifest fix * one more manifest fix * more manifest changes. * sync up * fix indent * one more pylint fix * Hopefully the last pylint fix * make variable names understandable * create and fill dict in one step * Fix name and attributes * rename to logical variable in alarm_control_panel * Remove location_name from alarm_control_panel attributes since it is already the name of the alarm. * Multiple fixes to improve code per @springstan suggestions * Update homeassistant/components/totalconnect/binary_sensor.py Co-Authored-By: springstan <46536646+springstan@users.noreply.github.com> * Multiple changes per @MartinHjelmare review * simplify alarm adding * Fix binary_sensor.py is_on Co-authored-by: springstan <46536646+springstan@users.noreply.github.com>
58 lines
1.4 KiB
Python
58 lines
1.4 KiB
Python
"""The totalconnect component."""
|
|
import logging
|
|
|
|
from total_connect_client import TotalConnectClient
|
|
import voluptuous as vol
|
|
|
|
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
|
|
from homeassistant.helpers import discovery
|
|
import homeassistant.helpers.config_validation as cv
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
DOMAIN = "totalconnect"
|
|
|
|
CONFIG_SCHEMA = vol.Schema(
|
|
{
|
|
DOMAIN: vol.Schema(
|
|
{
|
|
vol.Required(CONF_USERNAME): cv.string,
|
|
vol.Required(CONF_PASSWORD): cv.string,
|
|
}
|
|
)
|
|
},
|
|
extra=vol.ALLOW_EXTRA,
|
|
)
|
|
|
|
TOTALCONNECT_PLATFORMS = ["alarm_control_panel", "binary_sensor"]
|
|
|
|
|
|
def setup(hass, config):
|
|
"""Set up TotalConnect component."""
|
|
conf = config[DOMAIN]
|
|
|
|
username = conf[CONF_USERNAME]
|
|
password = conf[CONF_PASSWORD]
|
|
|
|
client = TotalConnectClient.TotalConnectClient(username, password)
|
|
|
|
if client.token is False:
|
|
_LOGGER.error("TotalConnect authentication failed")
|
|
return False
|
|
|
|
hass.data[DOMAIN] = TotalConnectSystem(username, password, client)
|
|
|
|
for platform in TOTALCONNECT_PLATFORMS:
|
|
discovery.load_platform(hass, platform, DOMAIN, {}, config)
|
|
|
|
return True
|
|
|
|
|
|
class TotalConnectSystem:
|
|
"""TotalConnect System class."""
|
|
|
|
def __init__(self, username, password, client):
|
|
"""Initialize the TotalConnect system."""
|
|
self._username = username
|
|
self._password = password
|
|
self.client = client
|