Skip to content

Commit

Permalink
Merge branch 'master' of github.com:rsnodgrass/pyxantech
Browse files Browse the repository at this point in the history
  • Loading branch information
rsnodgrass committed Jan 24, 2025
2 parents 936ee92 + a179d0c commit 168d9ef
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# DO NOT ENABLE while brunette is setup in .pre-commit-config.yml

name: Lint

on: [push, pull_request]
Expand Down
7 changes: 4 additions & 3 deletions pyxantech/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,13 +396,14 @@ def all_off(self):
def restore_zone(self, status: dict):
zone = status['zone']
amp_type = self._amp_type
success = get_protocol_config(amp_type, 'restore_success')
# LOG.debug(f"Restoring amp {amp_type} zone {zone} from {status}")
extras = get_protocol_config(amp_type, 'extras')
success = extras.get('restore_success')
LOG.debug(f'Restoring amp {amp_type} zone {zone} from {status}')

# FIXME: fetch current status first and only call those that changed

# send all the commands necessary to restore the various status settings to the amp
restore_commands = get_protocol_config(amp_type, 'restore_zone')
restore_commands = extras.get('restore_zone')
for command in restore_commands:
result = self._send_request(command(amp_type, zone, status))
if result != success:
Expand Down
2 changes: 1 addition & 1 deletion pyxantech/protocols/dayton.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@
responses:
zone_status: '>(?P<zone>\d\d)(?P<unknown>\d\d)(?P<power>[01]{2})(?P<mute>[01]{2})(?P<do_not_disturb>[01]{2})(?P<volume>\d\d)(?P<treble>\d\d)(?P<bass>\d\d)(?P<balance>\d\d)(?P<source>\d\d)(?P<keypad>\d\d)'

extra:
extras:
restore_zone: [ 'set_power', 'set_source', 'set_volume', 'set_mute', 'set_bass', 'set_balance', 'set_treble' ]
restore_success: "OK\r"
2 changes: 1 addition & 1 deletion pyxantech/protocols/monoprice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@
responses:
zone_status: '#>(?P<zone>\d\d)(?P<power>[01]{2})(?P<source>\d\d)(?P<mute>[01]{2})(?P<do_not_disturb>[01])(?P<volume>\d\d)(?P<treble>\d\d)(?P<bass>\d\d)(?P<balance>\d\d)(?P<unknown>\d\d)(?P<keypad>\d\d)'

extra:
extras:
restore_zone: [ 'set_power', 'set_source', 'set_volume', 'set_mute', 'set_bass', 'set_balance', 'set_treble' ]
restore_success: "OK\r"
9 changes: 4 additions & 5 deletions pyxantech/protocols/sonance.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@


- protocol: sonance6
- protocol: sonance
name: "Sonance 6-Zone Amp Protocol"

connection:
Expand Down Expand Up @@ -46,8 +44,8 @@

mute_status: ':M{zone}?'
set_mute: ':M{zone}{mute}'
mute_on: ':M{zone}M1'
mute_off: ':M{zone}M0'
mute_on: ':M{zone}1'
mute_off: ':M{zone}0'

volume_status: ':V{zone}?'
set_volume: ':V{zone}{volume:02}'
Expand Down Expand Up @@ -80,6 +78,7 @@

responses:
power_status: '\+Z(?P<zone>\d+)(?P<power>[01])'
zone_status: '\+Z(?P<zone>\d+)(?P<power>[01])'
source_status: '\+S(?P<zone>\d+)(?P<source>[1-4])'
volume_status: '\+V(?P<zone>\d+)(?P<volume>\d+)'
mute_status: '\+M(?P<zone>\d+)(?P<mute>[01])'
Expand Down
5 changes: 4 additions & 1 deletion pyxantech/series/sonance6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,11 @@
max_treble: 8
max_volume: 60

protocol: sonance6
protocol: sonance
protocol_definitions:
- sonance
min_time_between_commands: 0.05
zone_status_skip: 0

rs232:
baudrate: 19200
Expand Down

0 comments on commit 168d9ef

Please sign in to comment.