22
33from dingz import make_call
44
5- from .constants import (
6- SHADE
7- )
5+ from .constants import SHADE
86from .registry import BaseRegistry , organize_by_absolute_index
97
108
@@ -19,7 +17,7 @@ def __init__(self, absolute_index, dingz):
1917 self .lamella = None
2018
2119 def _consume_config (self , config ):
22- self .name = config [' name' ]
20+ self .name = config [" name" ]
2321
2422 def _consume_device_state (self , state_details ):
2523 """
@@ -29,12 +27,12 @@ def _consume_device_state(self, state_details):
2927 'index': { 'relative': 0, 'absolute': 0 }
3028 }
3129 """
32- assert self .absolute_index == state_details [' index' ][ ' absolute' ]
33- self .index_relative = state_details [' index' ][ ' relative' ]
30+ assert self .absolute_index == state_details [" index" ][ " absolute" ]
31+ self .index_relative = state_details [" index" ][ " relative" ]
3432 self .seen_state = True
35- self .moving = state_details [' moving' ]
36- self .position = state_details [' position' ]
37- self .lamella = state_details [' lamella' ]
33+ self .moving = state_details [" moving" ]
34+ self .position = state_details [" position" ]
35+ self .lamella = state_details [" lamella" ]
3836
3937 def _consume_shade_state (self , state_details ):
4038 """
@@ -48,9 +46,9 @@ def _consume_shade_state(self, state_details):
4846 "index": { "relative": 1, "absolute": 1 }
4947 }
5048 """
51- assert self .absolute_index == state_details [' index' ][ ' absolute' ]
52- self .position = state_details [' current' ][ ' blind' ]
53- self .lamella = state_details [' current' ][ ' lamella' ]
49+ assert self .absolute_index == state_details [" index" ][ " absolute" ]
50+ self .position = state_details [" current" ][ " blind" ]
51+ self .lamella = state_details [" current" ][ " lamella" ]
5452
5553 async def operate_shade (self , blind = None , lamella = None ) -> None :
5654 """
@@ -112,7 +110,9 @@ async def lamella_stop(self) -> None:
112110
113111 async def shade_command (self , verb ):
114112 """Create a command for the shade."""
115- url = URL (self .dingz .uri ).join (URL ("%s/%s/%s" % (SHADE , self .absolute_index , verb )))
113+ url = URL (self .dingz .uri ).join (
114+ URL ("%s/%s/%s" % (SHADE , self .absolute_index , verb ))
115+ )
116116 await make_call (self .dingz , uri = url , method = "POST" )
117117
118118 def current_blind_level (self ):
@@ -126,10 +126,7 @@ def current_lamella_level(self):
126126 def is_shade_closed (self ):
127127 """Get the closed state of a shade."""
128128 # When closed, we care if the lamellas are opened or not
129- return (
130- self .current_blind_level () == 0
131- and self .current_lamella_level () == 0
132- )
129+ return self .current_blind_level () == 0 and self .current_lamella_level () == 0
133130
134131 def is_shade_opened (self ):
135132 """Get the open state of a shade."""
0 commit comments