File tree Expand file tree Collapse file tree 1 file changed +11
-10
lines changed
Expand file tree Collapse file tree 1 file changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -107,16 +107,17 @@ def _add_or_update_notifications(
107107 self , entity_id : str , entity : GwEntityData
108108 ) -> None :
109109 """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- )
110+
111+ if entity_id != self ._gateway_id :
112+ return
113+
114+ if (self ._is_thermostat or self .smile .type == "power" ) and "binary_sensors" not in entity :
115+ entity .update ({"binary_sensors" : {"plugwise_notification" : bool (self ._notifications )}})
116+ entity .update ({"notifications" : self ._notifications })
117+ self ._count += 2
118+
119+ if "plugwise_notification" in entity ["binary_sensors" ]:
120+ entity ["binary_sensors" ]["plugwise_notification" ] = bool (self ._notifications )
120121 entity ["notifications" ] = self ._notifications
121122 self ._count += 2
122123
You can’t perform that action at this time.
0 commit comments