File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,19 +106,18 @@ def _detect_low_batteries(self) -> list[str]:
106106 def _add_or_update_notifications (
107107 self , entity_id : str , entity : GwEntityData
108108 ) -> None :
109- """Helper-function adding or updating the Plugwise notifications."""
110- if (
111- entity_id == self ._gateway_id
112- and (self ._is_thermostat or self .smile .type == "power" )
113- ) or (
114- "binary_sensors" in entity
115- and "plugwise_notification" in entity ["binary_sensors" ]
116- ):
117- entity ["binary_sensors" ]["plugwise_notification" ] = bool (
118- self ._notifications
119- )
120- entity ["notifications" ] = self ._notifications
121- self ._count += 2
109+ """Helper-function adding or updating the Plugwise notifications to the gateway."""
110+
111+ if entity_id != self ._gateway_id :
112+ return # pragma: no cover
113+
114+ if self ._is_thermostat or self .smile .type == "power" :
115+ if "plugwise_notification" not in entity ["binary_sensors" ]:
116+ entity ["binary_sensors" ].update (
117+ {"plugwise_notification" : bool (self ._notifications )}
118+ )
119+ entity .update ({"notifications" : self ._notifications })
120+ self ._count += 2
122121
123122 def _update_for_cooling (self , entity : GwEntityData ) -> None :
124123 """Helper-function for adding/updating various cooling-related values."""
You can’t perform that action at this time.
0 commit comments