@@ -140,7 +140,6 @@ def _create_api(self, mac_address, ip, port, name):
140140 self ._known_plugs .add (mac_address )
141141 self ._known_plug_names [name ] = mac_address
142142 known_evs = [
143- #'exception',
144143 'average_flow' ,
145144 'average_power' ,
146145 'average_power_components' ,
@@ -154,6 +153,7 @@ def _create_api(self, mac_address, ip, port, name):
154153 for ev in known_evs :
155154 api .subscribe (ev , self .handle_message )
156155 api .subscribe ('now_relaying_for' , self .handle_relaying_for )
156+ api .subscribe ('exception' , self .handle_exception )
157157 api .connect ()
158158
159159 def cancel_any_pending_removal (self , mac , source ):
@@ -162,6 +162,9 @@ def cancel_any_pending_removal(self, mac, source):
162162 task .cancel ()
163163 _LOGGER .debug (f"Cancelled pending removal for { mac } by { source } ." )
164164
165+ async def handle_exception (self , event : str , exc : BaseException ):
166+ _LOGGER .error (f"Plug connection reported exception: { exc } " )
167+
165168 async def handle_relaying_for (self , event : str , message : dict ):
166169 """Handle a potentially new sensor being reported."""
167170 mac = message .get ('mac' , None )
0 commit comments