Skip to content

Commit

Permalink
Issue #145: Amazon abandoned Dash Buttons (dhcp).
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekmo committed Sep 30, 2019
1 parent 4acf9f7 commit 898b547
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions amazon_dash/wifi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
"""
import subprocess

from amazon_dash.exceptions import ConfigWifiError
# from amazon_dash.exceptions import ConfigWifiError


def get_cmd_output(cmd, split_lines=True):
def get_cmd_output(cmd, split_lines=True, decode='utf-8'):
output = subprocess.check_output(cmd)
if decode:
output = output.decode('utf-8')
if split_lines:
output = [line.rstrip('\n') for line in output.split('\n')]
return output
Expand All @@ -31,3 +33,11 @@ def connect(self, essid, key=None):
if key:
cmd += ['key', key]
get_cmd_output(cmd)

def dhcp(self):
get_cmd_output(['dhclient', self.device])


if __name__ == '__main__':
w = Wifi()
w.connect('Amazon ConfigureMe')

0 comments on commit 898b547

Please sign in to comment.