Skip to content

Commit b614806

Browse files
committed
__dict__ -> model_dump()
1 parent acb9921 commit b614806

File tree

17 files changed

+42
-34
lines changed

17 files changed

+42
-34
lines changed

zha/application/gateway.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ async def async_device_initialized(self, device: zigpy.device.Device) -> None:
650650

651651
device_info = ExtendedDeviceInfoWithPairingStatus(
652652
pairing_status=DevicePairingStatus.INITIALIZED,
653-
**zha_device.extended_device_info.__dict__,
653+
**zha_device.extended_device_info.model_dump(),
654654
)
655655
self.emit(
656656
ZHA_GW_MSG_DEVICE_FULL_INIT,
@@ -665,7 +665,7 @@ async def _async_device_joined(self, zha_device: Device) -> None:
665665
self.create_platform_entities()
666666
device_info = ExtendedDeviceInfoWithPairingStatus(
667667
pairing_status=DevicePairingStatus.CONFIGURED,
668-
**zha_device.extended_device_info.__dict__,
668+
**zha_device.extended_device_info.model_dump(),
669669
)
670670
self.emit(
671671
ZHA_GW_MSG_DEVICE_FULL_INIT,
@@ -683,7 +683,7 @@ async def _async_device_rejoined(self, zha_device: Device) -> None:
683683
await zha_device.async_configure()
684684
device_info = ExtendedDeviceInfoWithPairingStatus(
685685
pairing_status=DevicePairingStatus.CONFIGURED,
686-
**zha_device.extended_device_info.__dict__,
686+
**zha_device.extended_device_info.model_dump(),
687687
)
688688
self.emit(
689689
ZHA_GW_MSG_DEVICE_FULL_INIT,

zha/application/platforms/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ def maybe_emit_state_changed_event(self) -> None:
218218
if self._previous_state != state:
219219
self.emit(
220220
STATE_CHANGED,
221-
EntityStateChangedEvent(state=self.state, **self.identifiers.__dict__),
221+
EntityStateChangedEvent(
222+
state=self.state, **self.identifiers.model_dump()
223+
),
222224
)
223225
self._previous_state = state
224226

@@ -375,7 +377,9 @@ def maybe_emit_state_changed_event(self) -> None:
375377
if isinstance(self.device.gateway, WebSocketServerGateway):
376378
self.device.gateway.emit(
377379
STATE_CHANGED,
378-
EntityStateChangedEvent(state=self.state, **self.identifiers.__dict__),
380+
EntityStateChangedEvent(
381+
state=self.state, **self.identifiers.model_dump()
382+
),
379383
)
380384

381385
async def async_update(self) -> None:
@@ -461,7 +465,9 @@ def maybe_emit_state_changed_event(self) -> None:
461465
if isinstance(self.group.gateway, WebSocketServerGateway):
462466
self.group.gateway.emit(
463467
STATE_CHANGED,
464-
EntityStateChangedEvent(state=self.state, **self.identifiers.__dict__),
468+
EntityStateChangedEvent(
469+
state=self.state, **self.identifiers.model_dump()
470+
),
465471
)
466472

467473
def debounced_update(self, _: Any | None = None) -> None:

zha/application/platforms/alarm_control_panel/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def __init__(
113113
def info_object(self) -> AlarmControlPanelEntityInfo:
114114
"""Return a representation of the alarm control panel."""
115115
return AlarmControlPanelEntityInfo(
116-
**super().info_object.__dict__,
116+
**super().info_object.model_dump(),
117117
code_arm_required=self.code_arm_required,
118118
code_format=self.code_format,
119119
supported_features=self.supported_features,

zha/application/platforms/binary_sensor/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def _init_from_quirks_metadata(self, entity_metadata: BinarySensorMetadata) -> N
9696
def info_object(self) -> BinarySensorEntityInfo:
9797
"""Return a representation of the binary sensor."""
9898
return BinarySensorEntityInfo(
99-
**super().info_object.__dict__,
99+
**super().info_object.model_dump(),
100100
attribute_name=self._attribute_name,
101101
)
102102

zha/application/platforms/button/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def _init_from_quirks_metadata(
8080
def info_object(self) -> CommandButtonEntityInfo:
8181
"""Return a representation of the button."""
8282
return CommandButtonEntityInfo(
83-
**super().info_object.__dict__,
83+
**super().info_object.model_dump(),
8484
command=self._command_name,
8585
args=self._args,
8686
kwargs=self._kwargs,
@@ -168,7 +168,7 @@ def _init_from_quirks_metadata(
168168
def info_object(self) -> WriteAttributeButtonEntityInfo:
169169
"""Return a representation of the button."""
170170
return WriteAttributeButtonEntityInfo(
171-
**super().info_object.__dict__,
171+
**super().info_object.model_dump(),
172172
attribute_name=self._attribute_name,
173173
attribute_value=self._attribute_value,
174174
)

zha/application/platforms/climate/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def __init__(
220220
def info_object(self) -> ThermostatEntityInfo:
221221
"""Return a representation of the thermostat."""
222222
return ThermostatEntityInfo(
223-
**super().info_object.__dict__,
223+
**super().info_object.model_dump(),
224224
max_temp=self.max_temp,
225225
min_temp=self.min_temp,
226226
supported_features=self.supported_features,

zha/application/platforms/cover/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ def supported_features(self) -> CoverEntityFeature:
163163
def info_object(self) -> CoverEntityInfo:
164164
"""Return the info object for this entity."""
165165
return CoverEntityInfo(
166-
**super().info_object.__dict__, supported_features=self.supported_features
166+
**super().info_object.model_dump(),
167+
supported_features=self.supported_features,
167168
)
168169

169170
@property
@@ -483,7 +484,8 @@ def __init__(
483484
def info_object(self) -> ShadeEntityInfo:
484485
"""Return the info object for this entity."""
485486
return ShadeEntityInfo(
486-
**super().info_object.__dict__, supported_features=self.supported_features
487+
**super().info_object.model_dump(),
488+
supported_features=self.supported_features,
487489
)
488490

489491
@property

zha/application/platforms/fan/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def __init__(
282282
def info_object(self) -> FanEntityInfo:
283283
"""Return a representation of the binary sensor."""
284284
return FanEntityInfo(
285-
**super().info_object.__dict__,
285+
**super().info_object.model_dump(),
286286
preset_modes=self.preset_modes,
287287
supported_features=self.supported_features,
288288
speed_count=self.speed_count,
@@ -355,7 +355,7 @@ def __init__(self, group: Group):
355355
def info_object(self) -> FanEntityInfo:
356356
"""Return a representation of the binary sensor."""
357357
return FanEntityInfo(
358-
**super().info_object.__dict__,
358+
**super().info_object.model_dump(),
359359
preset_modes=self.preset_modes,
360360
supported_features=self.supported_features,
361361
speed_count=self.speed_count,

zha/application/platforms/light/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ def __init__(
795795
def info_object(self) -> LightEntityInfo:
796796
"""Return a representation of the select."""
797797
return LightEntityInfo(
798-
**super().info_object.__dict__,
798+
**super().info_object.model_dump(),
799799
effect_list=self.effect_list,
800800
supported_features=self.supported_features,
801801
min_mireds=self.min_mireds,
@@ -1147,7 +1147,7 @@ def __init__(self, group: Group):
11471147
def info_object(self) -> LightEntityInfo:
11481148
"""Return a representation of the select."""
11491149
return LightEntityInfo(
1150-
**super().info_object.__dict__,
1150+
**super().info_object.model_dump(),
11511151
effect_list=self.effect_list,
11521152
supported_features=self.supported_features,
11531153
min_mireds=self.min_mireds,

zha/application/platforms/number/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def __init__(
130130
def info_object(self) -> NumberEntityInfo:
131131
"""Return a representation of the number entity."""
132132
return NumberEntityInfo(
133-
**super().info_object.__dict__,
133+
**super().info_object.model_dump(),
134134
engineering_units=self._analog_output_cluster_handler.engineering_units,
135135
application_type=self._analog_output_cluster_handler.application_type,
136136
min_value=self.native_min_value,
@@ -308,7 +308,7 @@ def _init_from_quirks_metadata(self, entity_metadata: NumberMetadata) -> None:
308308
def info_object(self) -> NumberConfigurationEntityInfo:
309309
"""Return a representation of the number entity."""
310310
return NumberConfigurationEntityInfo(
311-
**super().info_object.__dict__,
311+
**super().info_object.model_dump(),
312312
min_value=self._attr_native_min_value,
313313
max_value=self._attr_native_max_value,
314314
step=self._attr_native_step,

0 commit comments

Comments
 (0)