Skip to content

Commit

Permalink
feat: add outputs status and command
Browse files Browse the repository at this point in the history
  • Loading branch information
xtimmy86x committed Dec 1, 2023
1 parent 984a61f commit 13d3183
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions custom_components/econnect_metronet/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
CONF_SCAN_INTERVAL = "scan_interval"
DOMAIN = "econnect_metronet"
NOTIFICATION_MESSAGE = (
"The switch cannot be used because it is not properly configured in the alarm control panel. "
"Please contact your installer to enable it."
"The switch cannot be used because it requires two settings to be configured in the Alarm Panel: "
"'manual control' and 'activation without authentication'. "
"While these settings can be enabled by your installer, this may not always be the case. "
"Please contact your installer for further assistance"
)
NOTIFICATION_TITLE = "Unable to toggle the switch"
NOTIFICATION_IDENTIFIER = "econnect_metronet_output_fail"
Expand Down
5 changes: 5 additions & 0 deletions custom_components/econnect_metronet/devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
CONF_AREAS_ARM_HOME,
CONF_AREAS_ARM_NIGHT,
CONF_AREAS_ARM_VACATION,
NOTIFICATION_MESSAGE,
)

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -335,11 +336,13 @@ def turn_off(self, output):
_LOGGER.warning(
f"Device | Error while turning off output: {item.get('name')}, Can't be manual controlled"
)
_LOGGER.warning(NOTIFICATION_MESSAGE)
break

# If the output require authentication for control write an error il log
if not item.get("do_not_require_authentication"):
_LOGGER.warning(f"Device | Error while turning off output: {item.get('name')}, Required authentication")
_LOGGER.warning(NOTIFICATION_MESSAGE)
break

try:
Expand Down Expand Up @@ -382,11 +385,13 @@ def turn_on(self, output):
_LOGGER.warning(
f"Device | Error while turning on output: {item.get('name')}, Can't be manual controlled"
)
_LOGGER.warning(NOTIFICATION_MESSAGE)
break

# If the output require authentication for control write an error log
if not item.get("do_not_require_authentication"):
_LOGGER.warning(f"Device | Error while turning on output: {item.get('name')}, Required authentication")
_LOGGER.warning(NOTIFICATION_MESSAGE)
break

try:
Expand Down

0 comments on commit 13d3183

Please sign in to comment.