Skip to content

Commit 59e944e

Browse files
committed
tested with HASS
1 parent 6c90de7 commit 59e944e

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

pypowerview/__init__.py

+7-11
Original file line numberDiff line numberDiff line change
@@ -53,23 +53,23 @@ def get_shades(self):
5353

5454
def get_status(self, shade):
5555
"""Update status of shade."""
56-
new_position = round((self.make_request("get","/api/shades/" + str(shade.id) + "?refresh=true")['shade']['positions']['position1'] / 65535) * 100)
57-
shade.update_position(new_position)
56+
shade.position = round((self.make_request("get","/api/shades/" + str(shade.id) + "?refresh=true")['shade']['positions']['position1'] / 65535) * 100)
57+
5858
return shade.position
5959

6060
def close_shade(self, shade):
6161
"""Close a shade."""
6262
self.make_request("put","/api/shades/" + str(shade.id), {"shade": {"motion": "down"}})
6363

64-
shade.update_position(0)
64+
shade.position = 0
6565

6666
return 0
6767

6868
def open_shade(self, shade):
6969
"""Open a shade."""
7070
self.make_request("put","/api/shades/" + str(shade.id), {"shade": {"motion": "up"}})
7171

72-
shade.update_position(100)
72+
shade.position = 100
7373

7474
return 100
7575

@@ -85,9 +85,9 @@ def set_shade_position(self, shade, position: int):
8585
position = round(position * 65535 / 100)
8686
self.make_request("put","/api/shades/" + str(shade.id), { "shade": { "positions": { "posKind1": 1, "position1": position } } })
8787

88-
shade.update_position(round(position / 65535 * 100))
88+
shade.position = round(position / 65535 * 100)
8989

90-
return round(position / 65535 * 100)
90+
return shade.position
9191

9292
else:
9393

@@ -101,8 +101,4 @@ def __init__(self,
101101
position: int):
102102
self.id = id
103103
self.name = name
104-
self.position = position
105-
106-
def update_position(self, position: int):
107-
self.position = position
108-
return True
104+
self.position = position

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import setuptools
44

5-
VERSION = '0.1'
5+
VERSION = '0.2'
66

77
license = """
88
MIT License
@@ -47,4 +47,4 @@
4747
"Operating System :: OS Independent",
4848
"Development Status :: 4 - Beta"
4949
],
50-
)
50+
)

0 commit comments

Comments
 (0)