Skip to content

Commit

Permalink
denon: poll input signal information via cycle (5s hardcoded for now)
Browse files Browse the repository at this point in the history
  • Loading branch information
onkelandy committed Feb 8, 2025
1 parent 69e61aa commit 8d23c9f
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 43 deletions.
6 changes: 6 additions & 0 deletions denon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ def _process_additional_data(self, command: str, data: Any, value: Any, custom:
self.send_command(f'zone{zone}.control.volume')
self.send_command(f'zone{zone}.control.listeningmode')

if command == 'general.inputrate' and value != 0:
self.send_command(f'general.inputsignal')
self.send_command(f'general.inputformat')
self.send_command(f'general.inputresolution')
self.send_command(f'general.outputresolution')


if __name__ == '__main__':
s = Standalone(denon, sys.argv[0])
21 changes: 18 additions & 3 deletions denon/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@
},
'general': {
'custom_inputnames': {'read': True, 'write': False, 'read_cmd': 'SSFUN ?', 'item_type': 'dict', 'dev_datatype': 'DenonCustominput', 'reply_pattern': r'^SSFUN(.*)', 'item_attrs': {'enforce': True, 'item_template': 'custom_inputnames', 'read_groups': [{'name': 'custom_inputnames', 'trigger': 'update'}], 'initial': True, 'attributes': {'denon_lookup@instance': 'INPUT#fwd'}}},
'power': {'read': True, 'write': True, 'read_cmd': 'PW?', 'write_cmd': 'PW{VALUE}', 'item_type': 'bool', 'dev_datatype': 'str', 'reply_pattern': r'^PW{LOOKUP}', 'lookup': 'POWER'},
'power': {'read': True, 'write': True, 'read_cmd': 'PW?', 'write_cmd': 'PW{VALUE}', 'item_type': 'bool', 'dev_datatype': 'str', 'reply_pattern': r'^PW{LOOKUP}', 'lookup': 'POWER', 'item_attrs': {'initial': True}},
'setupmenu': {'read': True, 'write': True, 'read_cmd': 'MNMEN?', 'write_cmd': 'MNMEN {VALUE}', 'item_type': 'bool', 'dev_datatype': 'onoff', 'reply_pattern': r'^MNMEN (ON|OFF)'},
'display': {'read': True, 'write': False, 'read_cmd': 'NSE', 'item_type': 'str', 'dev_datatype': 'DenonDisplay', 'reply_pattern': r'^NSE(.*)'},
'soundmode': {'read': True, 'write': False, 'read_cmd': 'SSSMG ?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^SSSMG {LOOKUP}', 'lookup': 'SOUNDMODE', 'item_attrs': {'initial': True, 'lookup_item': True}},
'allzonestereo': {'read': True, 'write': False, 'read_cmd': 'MNZST?', 'write_cmd': 'MNZST {VALUE}', 'item_type': 'bool', 'dev_datatype': 'onoff', 'reply_pattern': r'^MNZST {ON|OFF}', 'item_attrs': {'initial': True}},
'inputsignal': {'read': True, 'write': False, 'read_cmd': 'SSINFAISSIG ?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^SSINFAISSIG {LOOKUP}', 'lookup': 'INPUTSIGNAL', 'item_attrs': {'initial': True, 'lookup_item': True}},
'inputrate': {'read': True, 'write': False, 'read_cmd': 'SSINFAISFSV ?', 'item_type': 'num', 'dev_datatype': 'convert0', 'reply_pattern': r'^SSINFAISFSV (\d{2,3}|NON)', 'item_attrs': {'initial': True}},
'inputsignal': {'read': True, 'write': False, 'read_cmd': 'SSINFAISSIG ?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^SSINFAISSIG {LOOKUP}', 'lookup': 'INPUTSIGNAL'},
'inputrate': {'read': True, 'write': False, 'read_cmd': 'SSINFAISFSV ?', 'item_type': 'num', 'dev_datatype': 'convert0', 'reply_pattern': r'^SSINFAISFSV (\d{2,3}|NON)', 'item_attrs': {'initial': True, 'item_template': 'input_poll', 'read_groups': [{'name': 'general.inputrate.input_poll', 'trigger': 'poll'}]}},
'inputformat': {'read': True, 'write': False, 'read_cmd': 'SSINFAISFOR ?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^SSINFAISFOR (.*)', 'item_attrs': {'initial': True}},
'inputresolution': {'read': True, 'write': False, 'read_cmd': 'SSINFSIGRES ?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^SSINFSIGRES I(.*)', 'item_attrs': {'initial': True}},
'outputresolution': {'read': True, 'write': False, 'read_cmd': 'SSINFSIGRES ?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^SSINFSIGRES O(.*)', 'item_attrs': {'read_group_levels': 0}},
Expand Down Expand Up @@ -474,4 +474,19 @@
'denon_lookup@instance': 'INPUT3#fwd'
}
},
'input_poll': {
'poll': {
'type': 'bool',
'eval': 'True if sh....power() is True else None',
'enforce_updates': True,
'cycle': '5',
'denon_read_group_trigger': 'general.inputrate.input_poll',
'interval':
{
'type': 'num',
'initial_value': 5,
'cache': True
}
},
},
}
152 changes: 112 additions & 40 deletions denon/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ item_structs:
denon_write@instance: true
denon_read_group@instance:
- general
denon_read_initial@instance: true

setupmenu:
type: bool
Expand Down Expand Up @@ -587,11 +588,6 @@ item_structs:
denon_write@instance: false
denon_read_group@instance:
- general
denon_read_initial@instance: true

lookup:
type: list
denon_lookup@instance: INPUTSIGNAL#list

inputrate:
type: num
Expand All @@ -600,8 +596,21 @@ item_structs:
denon_write@instance: false
denon_read_group@instance:
- general
- general.inputrate.input_poll
denon_read_initial@instance: true

poll:
type: bool
eval: True if sh....power() is True else None
enforce_updates: 'true'
cycle: '5'
denon_read_group_trigger: general.inputrate.input_poll

interval:
type: num
initial_value: 5
cache: true

inputformat:
type: str
denon_command@instance: general.inputformat
Expand Down Expand Up @@ -1899,6 +1908,7 @@ item_structs:
denon_read_group@instance:
- ALL
- ALL.general
denon_read_initial@instance: true

setupmenu:
type: bool
Expand Down Expand Up @@ -1931,11 +1941,6 @@ item_structs:
denon_read_group@instance:
- ALL
- ALL.general
denon_read_initial@instance: true

lookup:
type: list
denon_lookup@instance: INPUTSIGNAL#list

inputrate:
type: num
Expand All @@ -1945,8 +1950,21 @@ item_structs:
denon_read_group@instance:
- ALL
- ALL.general
- general.inputrate.input_poll
denon_read_initial@instance: true

poll:
type: bool
eval: True if sh....power() is True else None
enforce_updates: 'true'
cycle: '5'
denon_read_group_trigger: general.inputrate.input_poll

interval:
type: num
initial_value: 5
cache: true

inputformat:
type: str
denon_command@instance: general.inputformat
Expand Down Expand Up @@ -2783,6 +2801,7 @@ item_structs:
denon_read_group@instance:
- AVR-X6300H
- AVR-X6300H.general
denon_read_initial@instance: true

setupmenu:
type: bool
Expand Down Expand Up @@ -2815,11 +2834,6 @@ item_structs:
denon_read_group@instance:
- AVR-X6300H
- AVR-X6300H.general
denon_read_initial@instance: true

lookup:
type: list
denon_lookup@instance: INPUTSIGNAL#list

inputrate:
type: num
Expand All @@ -2829,8 +2843,21 @@ item_structs:
denon_read_group@instance:
- AVR-X6300H
- AVR-X6300H.general
- general.inputrate.input_poll
denon_read_initial@instance: true

poll:
type: bool
eval: True if sh....power() is True else None
enforce_updates: 'true'
cycle: '5'
denon_read_group_trigger: general.inputrate.input_poll

interval:
type: num
initial_value: 5
cache: true

inputformat:
type: str
denon_command@instance: general.inputformat
Expand Down Expand Up @@ -4196,6 +4223,7 @@ item_structs:
denon_read_group@instance:
- AVR-X6300H-NA
- AVR-X6300H-NA.general
denon_read_initial@instance: true

setupmenu:
type: bool
Expand Down Expand Up @@ -4228,11 +4256,6 @@ item_structs:
denon_read_group@instance:
- AVR-X6300H-NA
- AVR-X6300H-NA.general
denon_read_initial@instance: true

lookup:
type: list
denon_lookup@instance: INPUTSIGNAL#list

inputrate:
type: num
Expand All @@ -4242,8 +4265,21 @@ item_structs:
denon_read_group@instance:
- AVR-X6300H-NA
- AVR-X6300H-NA.general
- general.inputrate.input_poll
denon_read_initial@instance: true

poll:
type: bool
eval: True if sh....power() is True else None
enforce_updates: 'true'
cycle: '5'
denon_read_group_trigger: general.inputrate.input_poll

interval:
type: num
initial_value: 5
cache: true

inputformat:
type: str
denon_command@instance: general.inputformat
Expand Down Expand Up @@ -5436,6 +5472,7 @@ item_structs:
denon_read_group@instance:
- AVR-X4300H
- AVR-X4300H.general
denon_read_initial@instance: true

setupmenu:
type: bool
Expand Down Expand Up @@ -5468,11 +5505,6 @@ item_structs:
denon_read_group@instance:
- AVR-X4300H
- AVR-X4300H.general
denon_read_initial@instance: true

lookup:
type: list
denon_lookup@instance: INPUTSIGNAL#list

inputrate:
type: num
Expand All @@ -5482,8 +5514,21 @@ item_structs:
denon_read_group@instance:
- AVR-X4300H
- AVR-X4300H.general
- general.inputrate.input_poll
denon_read_initial@instance: true

poll:
type: bool
eval: True if sh....power() is True else None
enforce_updates: 'true'
cycle: '5'
denon_read_group_trigger: general.inputrate.input_poll

interval:
type: num
initial_value: 5
cache: true

inputformat:
type: str
denon_command@instance: general.inputformat
Expand Down Expand Up @@ -6704,6 +6749,7 @@ item_structs:
denon_read_group@instance:
- AVR-X3300W
- AVR-X3300W.general
denon_read_initial@instance: true

setupmenu:
type: bool
Expand Down Expand Up @@ -6745,11 +6791,6 @@ item_structs:
denon_read_group@instance:
- AVR-X3300W
- AVR-X3300W.general
denon_read_initial@instance: true

lookup:
type: list
denon_lookup@instance: INPUTSIGNAL#list

inputrate:
type: num
Expand All @@ -6759,8 +6800,21 @@ item_structs:
denon_read_group@instance:
- AVR-X3300W
- AVR-X3300W.general
- general.inputrate.input_poll
denon_read_initial@instance: true

poll:
type: bool
eval: True if sh....power() is True else None
enforce_updates: 'true'
cycle: '5'
denon_read_group_trigger: general.inputrate.input_poll

interval:
type: num
initial_value: 5
cache: true

inputformat:
type: str
denon_command@instance: general.inputformat
Expand Down Expand Up @@ -7771,6 +7825,7 @@ item_structs:
denon_read_group@instance:
- AVR-X2300W
- AVR-X2300W.general
denon_read_initial@instance: true

setupmenu:
type: bool
Expand Down Expand Up @@ -7812,11 +7867,6 @@ item_structs:
denon_read_group@instance:
- AVR-X2300W
- AVR-X2300W.general
denon_read_initial@instance: true

lookup:
type: list
denon_lookup@instance: INPUTSIGNAL#list

inputrate:
type: num
Expand All @@ -7826,8 +7876,21 @@ item_structs:
denon_read_group@instance:
- AVR-X2300W
- AVR-X2300W.general
- general.inputrate.input_poll
denon_read_initial@instance: true

poll:
type: bool
eval: True if sh....power() is True else None
enforce_updates: 'true'
cycle: '5'
denon_read_group_trigger: general.inputrate.input_poll

interval:
type: num
initial_value: 5
cache: true

inputformat:
type: str
denon_command@instance: general.inputformat
Expand Down Expand Up @@ -8770,6 +8833,7 @@ item_structs:
denon_read_group@instance:
- AVR-X1300W
- AVR-X1300W.general
denon_read_initial@instance: true

setupmenu:
type: bool
Expand Down Expand Up @@ -8811,11 +8875,6 @@ item_structs:
denon_read_group@instance:
- AVR-X1300W
- AVR-X1300W.general
denon_read_initial@instance: true

lookup:
type: list
denon_lookup@instance: INPUTSIGNAL#list

inputrate:
type: num
Expand All @@ -8825,8 +8884,21 @@ item_structs:
denon_read_group@instance:
- AVR-X1300W
- AVR-X1300W.general
- general.inputrate.input_poll
denon_read_initial@instance: true

poll:
type: bool
eval: True if sh....power() is True else None
enforce_updates: 'true'
cycle: '5'
denon_read_group_trigger: general.inputrate.input_poll

interval:
type: num
initial_value: 5
cache: true

inputformat:
type: str
denon_command@instance: general.inputformat
Expand Down

0 comments on commit 8d23c9f

Please sign in to comment.