Skip to content

Commit

Permalink
denon: caching some command values
Browse files Browse the repository at this point in the history
  • Loading branch information
onkelandy committed Feb 11, 2025
1 parent 65fd099 commit 8a98006
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
20 changes: 10 additions & 10 deletions denon/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@

commands = {
'info': {
'fullmodel': {'read': True, 'write': False, 'read_cmd': 'NSFRN ?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^NSFRN\s(.*)', 'item_attrs': {'initial': True}},
'model': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^VIALL(AVR.*)', 'item_attrs': {'initial': True}},
'serialnumber': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'num', 'dev_datatype': 'raw', 'reply_pattern': r'^VIALLS/N\.(.*)', 'item_attrs': {'read_group_levels': 0}},
'fullmodel': {'read': True, 'write': False, 'read_cmd': 'NSFRN ?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^NSFRN\s(.*)', 'item_attrs': {'initial': True, 'attributes': {'cache': True}}},
'model': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^VIALL(AVR.*)', 'item_attrs': {'initial': True, 'attributes': {'cache': True}}},
'serialnumber': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'num', 'dev_datatype': 'raw', 'reply_pattern': r'^VIALLS/N\.(.*)', 'item_attrs': {'read_group_levels': 0, 'attributes': {'cache': True}}},
'main': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^VIALLMAIN:(.*)', 'item_attrs': {'read_group_levels': 0}},
'mainfbl': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'num', 'dev_datatype': 'raw', 'reply_pattern': r'^VIALLMAINFBL:(.*)', 'item_attrs': {'read_group_levels': 0}},
'dsp1': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'num', 'dev_datatype': 'raw', 'reply_pattern': r'^VIALLDSP1:(.*)', 'item_attrs': {'read_group_levels': 0}},
Expand All @@ -59,14 +59,14 @@
'heosmod': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'num', 'dev_datatype': 'raw', 'reply_pattern': r'^VIALLHEOSMOD:(.*)', 'item_attrs': {'read_group_levels': 0}},
'heoscnf': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^VIALLHEOSCNF:(.*)', 'item_attrs': {'read_group_levels': 0}},
'heoslanguage': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^VIALLHEOSLCL:(.*)', 'item_attrs': {'read_group_levels': 0}},
'mac': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^VIALLMAC:(.*)', 'item_attrs': {'read_group_levels': 0}},
'wifimac': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^VIALLWIFIMAC:(.*)', 'item_attrs': {'read_group_levels': 0}},
'btmac': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^VIALLBTMAC:(.*)', 'item_attrs': {'read_group_levels': 0}},
'mac': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^VIALLMAC:(.*)', 'item_attrs': {'read_group_levels': 0, 'attributes': {'cache': True}}},
'wifimac': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^VIALLWIFIMAC:(.*)', 'item_attrs': {'read_group_levels': 0, 'attributes': {'cache': True}}},
'btmac': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^VIALLBTMAC:(.*)', 'item_attrs': {'read_group_levels': 0, 'attributes': {'cache': True}}},
'audyif': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'num', 'dev_datatype': 'raw', 'reply_pattern': r'^VIALLAUDYIF:(.*)', 'item_attrs': {'read_group_levels': 0}},
'productid': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'num', 'dev_datatype': 'raw', 'reply_pattern': r'^VIALLPRODUCTID:(.*)', 'item_attrs': {'read_group_levels': 0}},
'productid': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'num', 'dev_datatype': 'raw', 'reply_pattern': r'^VIALLPRODUCTID:(.*)', 'item_attrs': {'read_group_levels': 0, 'attributes': {'cache': True}}},
'packageid': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'num', 'dev_datatype': 'raw', 'reply_pattern': r'^VIALLPACKAGEID:(.*)', 'item_attrs': {'read_group_levels': 0}},
'cmp': {'read': True, 'write': False, 'read_cmd': 'VIALL?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^VIALLCMP:(.*)', 'item_attrs': {'read_group_levels': 0}},
'region': {'read': True, 'write': False, 'read_cmd': 'SYMODTUN ?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^SYMODTUN\s(.*)', 'item_attrs': {'initial': True}},
'region': {'read': True, 'write': False, 'read_cmd': 'SYMODTUN ?', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': r'^SYMODTUN\s(.*)', 'item_attrs': {'initial': True, 'attributes': {'cache': True}}},
},
'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'}}},
Expand Down Expand Up @@ -339,7 +339,7 @@
'SAT/CBL': 'SAT/CBL',
'MPLAY': 'MPLAY',
'GAME': 'GAME',
'NET': 'NET',
'NET': 'HEOS',
'AUX1': 'AUX1',
'BT': 'BT'
},
Expand All @@ -353,7 +353,7 @@
'SAT/CBL': 'SAT/CBL',
'MPLAY': 'MPLAY',
'GAME': 'GAME',
'NET': 'NET',
'NET': 'HEOS',
'AUX1': 'AUX1',
'AUX2': 'AUX2',
'BT': 'Bluetooth',
Expand Down
24 changes: 24 additions & 0 deletions denon/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ item_structs:
denon_read_group@instance:
- info
denon_read_initial@instance: true
cache: true

model:
type: str
Expand All @@ -359,12 +360,14 @@ item_structs:
denon_read_group@instance:
- info
denon_read_initial@instance: true
cache: true

serialnumber:
type: num
denon_command@instance: info.serialnumber
denon_read@instance: true
denon_write@instance: false
cache: true

main:
type: str
Expand Down Expand Up @@ -455,18 +458,21 @@ item_structs:
denon_command@instance: info.mac
denon_read@instance: true
denon_write@instance: false
cache: true

wifimac:
type: str
denon_command@instance: info.wifimac
denon_read@instance: true
denon_write@instance: false
cache: true

btmac:
type: str
denon_command@instance: info.btmac
denon_read@instance: true
denon_write@instance: false
cache: true

audyif:
type: num
Expand All @@ -479,6 +485,7 @@ item_structs:
denon_command@instance: info.productid
denon_read@instance: true
denon_write@instance: false
cache: true

packageid:
type: num
Expand All @@ -500,6 +507,7 @@ item_structs:
denon_read_group@instance:
- info
denon_read_initial@instance: true
cache: true

general:

Expand Down Expand Up @@ -2606,6 +2614,7 @@ item_structs:
- AVR-X6300H
- AVR-X6300H.info
denon_read_initial@instance: true
cache: true

model:
type: str
Expand All @@ -2616,12 +2625,14 @@ item_structs:
- AVR-X6300H
- AVR-X6300H.info
denon_read_initial@instance: true
cache: true

serialnumber:
type: num
denon_command@instance: info.serialnumber
denon_read@instance: true
denon_write@instance: false
cache: true

main:
type: str
Expand Down Expand Up @@ -2712,18 +2723,21 @@ item_structs:
denon_command@instance: info.mac
denon_read@instance: true
denon_write@instance: false
cache: true

wifimac:
type: str
denon_command@instance: info.wifimac
denon_read@instance: true
denon_write@instance: false
cache: true

btmac:
type: str
denon_command@instance: info.btmac
denon_read@instance: true
denon_write@instance: false
cache: true

audyif:
type: num
Expand All @@ -2736,6 +2750,7 @@ item_structs:
denon_command@instance: info.productid
denon_read@instance: true
denon_write@instance: false
cache: true

packageid:
type: num
Expand All @@ -2758,6 +2773,7 @@ item_structs:
- AVR-X6300H
- AVR-X6300H.info
denon_read_initial@instance: true
cache: true

general:

Expand Down Expand Up @@ -4028,6 +4044,7 @@ item_structs:
- AVR-X6300H-NA
- AVR-X6300H-NA.info
denon_read_initial@instance: true
cache: true

model:
type: str
Expand All @@ -4038,12 +4055,14 @@ item_structs:
- AVR-X6300H-NA
- AVR-X6300H-NA.info
denon_read_initial@instance: true
cache: true

serialnumber:
type: num
denon_command@instance: info.serialnumber
denon_read@instance: true
denon_write@instance: false
cache: true

main:
type: str
Expand Down Expand Up @@ -4134,18 +4153,21 @@ item_structs:
denon_command@instance: info.mac
denon_read@instance: true
denon_write@instance: false
cache: true

wifimac:
type: str
denon_command@instance: info.wifimac
denon_read@instance: true
denon_write@instance: false
cache: true

btmac:
type: str
denon_command@instance: info.btmac
denon_read@instance: true
denon_write@instance: false
cache: true

audyif:
type: num
Expand All @@ -4158,6 +4180,7 @@ item_structs:
denon_command@instance: info.productid
denon_read@instance: true
denon_write@instance: false
cache: true

packageid:
type: num
Expand All @@ -4180,6 +4203,7 @@ item_structs:
- AVR-X6300H-NA
- AVR-X6300H-NA.info
denon_read_initial@instance: true
cache: true

general:

Expand Down

0 comments on commit 8a98006

Please sign in to comment.