Skip to content

Commit

Permalink
RF single button names
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexxIT committed Feb 20, 2020
1 parent da6bfb9 commit b6b75aa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions custom_components/sonoff/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ def __init__(self, device: EWeLinkDevice):
# init button names
self._buttons = {}
for remote in self.device.config.get('tags', {}).get('zyx_info', []):
for button in remote.get('buttonName'):
self._buttons.update(button)
buttons = remote['buttonName']
if len(buttons) > 1:
for button in buttons:
self._buttons.update(button)
else:
k = next(iter(buttons[0]))
self._buttons.update({k: remote['name']})

async def async_added_to_hass(self) -> None:
# Присваиваем имя устройства только на этом этапе, чтоб в `entity_id`
Expand Down

0 comments on commit b6b75aa

Please sign in to comment.