Skip to content

Commit

Permalink
mute and unmute
Browse files Browse the repository at this point in the history
  • Loading branch information
pergolafabio committed Oct 1, 2023
1 parent 9dac920 commit 99fc605
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions hikvision-doorbell/src/doorbell.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,9 @@ def isapi_device_info() -> int:
pass

# We have run out of available endpoints to call
raise RuntimeError("Unable to get the number of coms")
logger.info("Unable to get the number of coms for the indoor station")
return 0
#raise RuntimeError("Unable to get the number of coms")

def get_device_info(self):
"""Retrieve device information (model, sw version, etc) using the ISAPI endpoint.
Expand All @@ -367,14 +369,15 @@ def get_audio_out_settings(self):
def mute_audio_output(self):
try:
current_settings = self.get_audio_out_settings()

currentTalkVolume = current_settings.find('{*}talkVolume')
logger.debug("Current talk volume is {}", currentTalkVolume)
if currentTalkVolume is None or currentTalkVolume.text is None:
talkVolume = "5"
else:
talkVolume = currentTalkVolume.text

currentVolume = current_settings.find('{*}volume')
logger.debug("Current volume is {}", currentVolume)
if currentVolume is None or currentVolume.text is None:
self._previouse_audio_out_volume = 5
else:
Expand All @@ -398,6 +401,7 @@ def unmute_audio_output(self):
try:
current_settings = self.get_audio_out_settings()
currentTalkVolume = current_settings.find('{*}talkVolume')
logger.debug("Current talk volume is {}", currentTalkVolume)
if currentTalkVolume is None or currentTalkVolume.text is None:
talkVolume = "5"
else:
Expand Down
4 changes: 2 additions & 2 deletions hikvision-doorbell/src/mqtt_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,15 +442,15 @@ def _mute_audio_output_callback(self, client, doorbell: Doorbell, message: MQTTM
try:
doorbell.mute_audio_output()
except SDKError as err:
logger.error("Error setting scene: {}", err)
logger.error("Error muting: {}", err)

def _unmute_audio_output_callback(self, client, doorbell: Doorbell, message: MQTTMessage):
logger.info("Received unmute audio output command for doorbell: {}", doorbell._config.name)

try:
doorbell.unmute_audio_output()
except SDKError as err:
logger.error("Error setting scene: {}", err)
logger.error("Error unmuting: {}", err)

def _isapi_input_callback(self, client, doorbell: Doorbell, message: MQTTMessage):
logger.debug("Received input text for doorbell: {}", doorbell._config.name)
Expand Down

0 comments on commit 99fc605

Please sign in to comment.