@@ -191,36 +191,34 @@ class KnxYamlCover(_KnxCover, KnxYamlEntity):
191191
192192 def __init__ (self , knx_module : KNXModule , config : ConfigType ) -> None :
193193 """Initialize the cover."""
194+ self ._device = XknxCover (
195+ xknx = knx_module .xknx ,
196+ name = config [CONF_NAME ],
197+ group_address_long = config .get (CoverSchema .CONF_MOVE_LONG_ADDRESS ),
198+ group_address_short = config .get (CoverSchema .CONF_MOVE_SHORT_ADDRESS ),
199+ group_address_stop = config .get (CoverSchema .CONF_STOP_ADDRESS ),
200+ group_address_position_state = config .get (
201+ CoverSchema .CONF_POSITION_STATE_ADDRESS
202+ ),
203+ group_address_angle = config .get (CoverSchema .CONF_ANGLE_ADDRESS ),
204+ group_address_angle_state = config .get (CoverSchema .CONF_ANGLE_STATE_ADDRESS ),
205+ group_address_position = config .get (CoverSchema .CONF_POSITION_ADDRESS ),
206+ travel_time_down = config [CoverConf .TRAVELLING_TIME_DOWN ],
207+ travel_time_up = config [CoverConf .TRAVELLING_TIME_UP ],
208+ invert_updown = config [CoverConf .INVERT_UPDOWN ],
209+ invert_position = config [CoverConf .INVERT_POSITION ],
210+ invert_angle = config [CoverConf .INVERT_ANGLE ],
211+ )
194212 super ().__init__ (
195213 knx_module = knx_module ,
196- device = XknxCover (
197- xknx = knx_module .xknx ,
198- name = config [CONF_NAME ],
199- group_address_long = config .get (CoverSchema .CONF_MOVE_LONG_ADDRESS ),
200- group_address_short = config .get (CoverSchema .CONF_MOVE_SHORT_ADDRESS ),
201- group_address_stop = config .get (CoverSchema .CONF_STOP_ADDRESS ),
202- group_address_position_state = config .get (
203- CoverSchema .CONF_POSITION_STATE_ADDRESS
204- ),
205- group_address_angle = config .get (CoverSchema .CONF_ANGLE_ADDRESS ),
206- group_address_angle_state = config .get (
207- CoverSchema .CONF_ANGLE_STATE_ADDRESS
208- ),
209- group_address_position = config .get (CoverSchema .CONF_POSITION_ADDRESS ),
210- travel_time_down = config [CoverConf .TRAVELLING_TIME_DOWN ],
211- travel_time_up = config [CoverConf .TRAVELLING_TIME_UP ],
212- invert_updown = config [CoverConf .INVERT_UPDOWN ],
213- invert_position = config [CoverConf .INVERT_POSITION ],
214- invert_angle = config [CoverConf .INVERT_ANGLE ],
214+ unique_id = (
215+ f"{ self ._device .updown .group_address } _"
216+ f"{ self ._device .position_target .group_address } "
215217 ),
218+ name = config [CONF_NAME ],
219+ entity_category = config .get (CONF_ENTITY_CATEGORY ),
216220 )
217221 self .init_base ()
218-
219- self ._attr_entity_category = config .get (CONF_ENTITY_CATEGORY )
220- self ._attr_unique_id = (
221- f"{ self ._device .updown .group_address } _"
222- f"{ self ._device .position_target .group_address } "
223- )
224222 if custom_device_class := config .get (CONF_DEVICE_CLASS ):
225223 self ._attr_device_class = custom_device_class
226224
0 commit comments