@@ -53,23 +53,23 @@ def get_shades(self):
53
53
54
54
def get_status (self , shade ):
55
55
"""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
+
58
58
return shade .position
59
59
60
60
def close_shade (self , shade ):
61
61
"""Close a shade."""
62
62
self .make_request ("put" ,"/api/shades/" + str (shade .id ), {"shade" : {"motion" : "down" }})
63
63
64
- shade .update_position ( 0 )
64
+ shade .position = 0
65
65
66
66
return 0
67
67
68
68
def open_shade (self , shade ):
69
69
"""Open a shade."""
70
70
self .make_request ("put" ,"/api/shades/" + str (shade .id ), {"shade" : {"motion" : "up" }})
71
71
72
- shade .update_position ( 100 )
72
+ shade .position = 100
73
73
74
74
return 100
75
75
@@ -85,9 +85,9 @@ def set_shade_position(self, shade, position: int):
85
85
position = round (position * 65535 / 100 )
86
86
self .make_request ("put" ,"/api/shades/" + str (shade .id ), { "shade" : { "positions" : { "posKind1" : 1 , "position1" : position } } })
87
87
88
- shade .update_position ( round (position / 65535 * 100 ) )
88
+ shade .position = round (position / 65535 * 100 )
89
89
90
- return round ( position / 65535 * 100 )
90
+ return shade . position
91
91
92
92
else :
93
93
@@ -101,8 +101,4 @@ def __init__(self,
101
101
position : int ):
102
102
self .id = id
103
103
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
0 commit comments