Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Candle - the privacy friendly smart home authored Mar 7, 2022
1 parent bc652e4 commit ddc959f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 26 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
}
},
"short_name": "Voco",
"version": "2.8.9",
"version": "2.8.10",
"web_accessible_resources": [
"css/*.css",
"images/*.svg",
Expand Down
43 changes: 18 additions & 25 deletions pkg/voco_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,41 +177,35 @@ def __init__(self, verbose=True):
print("Error fixing audio_output in persistent data. Falling back to headphone jack.")
self.persistent_data['audio_output'] = 'Built-in headphone jack'


try:
if 'action_times' not in self.persistent_data:
print("action_times was not in persistent data, adding it now.")
self.persistent_data['action_times'] = []
except:
print("Error fixing audio_output in persistent data")

try:

if 'is_satellite' not in self.persistent_data:
print("action_times was not in persistent data, adding it now.")
self.persistent_data['is_satellite'] = False
except:
print("Error fixing audio_output in persistent data")

try:
if 'bluetooth_device_mac' not in self.persistent_data:
self.persistent_data['bluetooth_device_mac'] = None
if 'mqtt_server' not in self.persistent_data:
print("action_times was not in persistent data, adding it now.")
self.persistent_data['mqtt_server'] = 'localhost'
except:
print("Error fixing audio_output in persistent data")

try:

if 'site_id' not in self.persistent_data:
print("site_id was not in persistent data, generating a random one now.")
self.persistent_data['site_id'] = generate_random_string(8)
except:
print("Error fixing audio_output in persistent data")

try:

if 'main_site_id' not in self.persistent_data: # to remember what the main voco server is, for satellites.
print("main_site_id was not in persistent data, adding it now.")
self.persistent_data['main_site_id'] = self.persistent_data['site_id']
except:
print("Error fixing main_site_id in persistent data")

except Exception as ex:
print("Error adding variables to persistent data: " + str(ex))




self.opposites = {
"on":"off",
Expand Down Expand Up @@ -265,7 +259,6 @@ def __init__(self, verbose=True):

# Bluetooth
self.bluealsa = False
self.persistent_data['bluetooth_device_mac'] = None


# Snips settings
Expand Down Expand Up @@ -542,23 +535,23 @@ def __init__(self, verbose=True):
try:
# Force the audio input.
if self.microphone == "Built-in microphone (0,0)":
print("Setting audio input to built-in")
print("Setting audio input to built-in (0,0)")
self.capture_card_id = 0
self.capture_device_id = 0
elif self.microphone == "Attached device (1,0)":
print("Setting audio input to attached device")
print("Setting audio input to attached device (1,0)")
self.capture_card_id = 1
self.capture_device_id = 0
elif self.microphone == "Attached device, channel 2 (1,1)":
print("Setting audio input to attached device, channel 2")
print("Setting audio input to attached device, channel 2 (1,1)")
self.capture_card_id = 1
self.capture_device_id = 1
elif self.microphone == "Second attached device (2,0)":
print("Setting audio input to second attached device")
print("Setting audio input to second attached device (2,0)")
self.capture_card_id = 2
self.capture_device_id = 0
elif self.microphone == "Second attached device, channel 2 (2,1)":
print("Setting audio input to second attached device, channel 2")
print("Setting audio input to second attached device, channel 2 (2,1)")
self.capture_card_id = 2
self.capture_device_id = 1

Expand Down

0 comments on commit ddc959f

Please sign in to comment.