From 2fa3b4f23e98dac172c9bdb46e171f3bb3e51fb5 Mon Sep 17 00:00:00 2001 From: sisamiwe Date: Wed, 13 Nov 2024 14:57:42 +0100 Subject: [PATCH] SONOS: - update WebIf - bugfix --- sonos/__init__.py | 9 ++++++--- sonos/webif/templates/index.html | 21 ++++++--------------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/sonos/__init__.py b/sonos/__init__.py index 707c48206..d6182febb 100644 --- a/sonos/__init__.py +++ b/sonos/__init__.py @@ -3125,9 +3125,12 @@ def parse_item(self, item: Items) -> object: if 'sonos_send' in item_config: return self.update_item - # some special handling for dpt3 volume + # handling sonos_attrib incl some special handling for dpt3 volume elif self.has_iattr(item.conf, 'sonos_attrib'): + uid = self._resolve_uid(item) + item_config.update({'uid': uid}) item_attribute = self.get_iattr_value(item.conf, 'sonos_attrib') + if item_attribute != 'vol_dpt3': item_config.update({'sonos_attrib': item_attribute}) self.add_item(item, config_data_dict=item_config, updating=True) @@ -3156,8 +3159,8 @@ def parse_item(self, item: Items) -> object: self.logger.warning("volume_dpt3 item has no helper item. Ignoring!") return - dpt3_step = self.has_iattr(item.conf, 'sonos_dpt3_step') - dpt3_time = self.has_iattr(item.conf, 'sonos_dpt3_time') + dpt3_step = self.get_iattr_value(item.conf, 'sonos_dpt3_step') + dpt3_time = self.get_iattr_value(item.conf, 'sonos_dpt3_time') item_config.update({'volume_item': parent_item, 'helper': child_helper, 'dpt3_step': dpt3_step, 'dpt3_time': dpt3_time}) self.add_item(item, config_data_dict=item_config, updating=True) diff --git a/sonos/webif/templates/index.html b/sonos/webif/templates/index.html index 69b0036b6..fb36e6f52 100644 --- a/sonos/webif/templates/index.html +++ b/sonos/webif/templates/index.html @@ -210,21 +210,12 @@ {{ item._path }} {{ item._type }} - - {% if 'sonos_uid' in item.conf %} - {{ p._get_zone_name_from_uid(item.conf['sonos_uid']) }} - {% elif 'sonos_recv' in item.conf %} - {{ p._get_zone_name_from_uid(p._resolve_uid(item)) }} - {% elif 'sonos_send' in item.conf %} - {{ p._get_zone_name_from_uid(p._resolve_uid(item)) }} - {% else %} - {{_('-')}} - {% endif %} - {% if 'sonos_recv' in item.conf %} {{ item.conf['sonos_recv'] }} {% else %} {{_('-')}} {% endif %} - {% if 'sonos_send' in item.conf %} {{ item.conf['sonos_send'] }} {% else %} {{_('-')}} {% endif %} - {% if 'sonos_attrib' in item.conf %} {{ item.conf['sonos_attrib'] }} {% else %} {{_('-')}} {% endif %} - {% if 'sonos_dpt3_step' in item.conf %} {{ item.conf['sonos_dpt3_step'] }} {% else %} {{_('-')}} {% endif %} - {% if 'sonos_dpt3_time' in item.conf %} {{ item.conf['sonos_dpt3_time'] }} {% else %} {{_('-')}} {% endif %} + {{ p._get_zone_name_from_uid(p.get_item_config(item).get('uid')) }} + {{ p.get_item_config(item).get('sonos_recv', '-') }} + {{ p.get_item_config(item).get('sonos_send', '-') }} + {{ p.get_item_config(item).get('sonos_attrib', '-') }} + {{ p.get_item_config(item).get('dpt3_step', '-') }} + {{ p.get_item_config(item).get('dpt3_time', '-') }} .{{ item._value }}