Skip to content

Commit

Permalink
SONOS:
Browse files Browse the repository at this point in the history
- update WebIf
- bugfix
  • Loading branch information
sisamiwe committed Nov 13, 2024
1 parent 8179880 commit 2fa3b4f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
9 changes: 6 additions & 3 deletions sonos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
21 changes: 6 additions & 15 deletions sonos/webif/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -210,21 +210,12 @@
<td></td>
<td class="py-1">{{ item._path }}</td>
<td class="py-1">{{ item._type }}</td>
<td class="py-1">
{% 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 %}</td>
<td class="py-1">{% if 'sonos_recv' in item.conf %} {{ item.conf['sonos_recv'] }} {% else %} {{_('-')}} {% endif %}</td>
<td class="py-1">{% if 'sonos_send' in item.conf %} {{ item.conf['sonos_send'] }} {% else %} {{_('-')}} {% endif %}</td>
<td class="py-1">{% if 'sonos_attrib' in item.conf %} {{ item.conf['sonos_attrib'] }} {% else %} {{_('-')}} {% endif %}</td>
<td class="py-1">{% if 'sonos_dpt3_step' in item.conf %} {{ item.conf['sonos_dpt3_step'] }} {% else %} {{_('-')}} {% endif %}</td>
<td class="py-1">{% if 'sonos_dpt3_time' in item.conf %} {{ item.conf['sonos_dpt3_time'] }} {% else %} {{_('-')}} {% endif %}</td>
<td class="py-1">{{ p._get_zone_name_from_uid(p.get_item_config(item).get('uid')) }}</td>
<td class="py-1">{{ p.get_item_config(item).get('sonos_recv', '-') }}</td>
<td class="py-1">{{ p.get_item_config(item).get('sonos_send', '-') }}</td>
<td class="py-1">{{ p.get_item_config(item).get('sonos_attrib', '-') }}</td>
<td class="py-1">{{ p.get_item_config(item).get('dpt3_step', '-') }}</td>
<td class="py-1">{{ p.get_item_config(item).get('dpt3_time', '-') }}</td>
<td class="py-1" id="{{ item.id() }}_value">.{{ item._value }}</td>
<!-- <td class="py-1">{{ item.conf }}</td> -->
</tr>
Expand Down

0 comments on commit 2fa3b4f

Please sign in to comment.