@@ -324,7 +324,10 @@ def set_valve_alert_service(service):
324324 value = {}
325325 for switch in entities :
326326 if switch .entity_id == entity_id :
327- value = {"id" : switch .unique_id , "batt" : service .data [ATTR_BATT_ALERT ]}
327+ value = {
328+ "id" : switch .unique_id ,
329+ "batt" : service .data [ATTR_BATT_ALERT ],
330+ }
328331 switch .set_valve_alert (value )
329332 switch .schedule_update_ha_state (True )
330333 break
@@ -335,7 +338,10 @@ def set_valve_temp_alert_service(service):
335338 value = {}
336339 for switch in entities :
337340 if switch .entity_id == entity_id :
338- value = {"id" : switch .unique_id , "temp" : service .data [ATTR_TEMP_ALERT ]}
341+ value = {
342+ "id" : switch .unique_id ,
343+ "temp" : service .data [ATTR_TEMP_ALERT ],
344+ }
339345 switch .set_valve_temp_alert (value )
340346 switch .schedule_update_ha_state (True )
341347 break
@@ -403,7 +409,10 @@ def set_activation_service(service):
403409 value = {}
404410 for switch in entities :
405411 if switch .entity_id == entity_id :
406- value = {"id" : switch .unique_id , "active" : service .data [ATTR_ACTIVE ]}
412+ value = {
413+ "id" : switch .unique_id ,
414+ "active" : service .data [ATTR_ACTIVE ],
415+ }
407416 switch .set_activation (value )
408417 switch .schedule_update_ha_state (True )
409418 break
@@ -820,7 +829,7 @@ def do_stat(self, start):
820829 and self ._energy_stat_time != 0
821830 ):
822831 device_hourly_stats = self ._client .get_device_hourly_stats (self ._id )
823- # _LOGGER.warning("%s device_hourly_stats = %s", self._name, device_hourly_stats)
832+ # _LOGGER.warning("%s device_hourly_stats = %s", self._name, device_hourly_stats)
824833 if device_hourly_stats is not None and len (device_hourly_stats ) > 1 :
825834 self ._hour_energy_kwh_count = (
826835 device_hourly_stats [1 ]["counter" ] / 1000
@@ -831,7 +840,7 @@ def do_stat(self, start):
831840 self ._hour_kwh = 0
832841 _LOGGER .warning ("Got None for device_hourly_stats" )
833842 device_daily_stats = self ._client .get_device_daily_stats (self ._id )
834- # _LOGGER.warning("%s device_daily_stats = %s", self._name, device_daily_stats)
843+ # _LOGGER.warning("%s device_daily_stats = %s", self._name, device_daily_stats)
835844 if device_daily_stats is not None and len (device_daily_stats ) > 1 :
836845 self ._today_energy_kwh_count = (
837846 device_daily_stats [0 ]["counter" ] / 1000
@@ -842,7 +851,7 @@ def do_stat(self, start):
842851 self ._today_kwh = 0
843852 _LOGGER .warning ("Got None for device_daily_stats" )
844853 device_monthly_stats = self ._client .get_device_monthly_stats (self ._id )
845- # _LOGGER.warning("%s device_monthly_stats = %s", self._name, device_monthly_stats)
854+ # _LOGGER.warning("%s device_monthly_stats = %s", self._name, device_monthly_stats)
846855 if device_monthly_stats is not None and len (device_monthly_stats ) > 1 :
847856 self ._month_energy_kwh_count = (
848857 device_monthly_stats [0 ]["counter" ] / 1000
@@ -881,15 +890,18 @@ def log_error(self, error_data):
881890 elif error_data == "MAINTENANCE" :
882891 _LOGGER .warning ("Access blocked for maintenance...Retry later." )
883892 self .notify_ha (
884- "Warning: Neviweb access temporary blocked for maintenance...Retry later."
893+ "Warning: Neviweb access temporary blocked for maintenance..."
894+ + "Retry later."
885895 )
886896 self ._client .reconnect ()
887897 elif error_data == "ACCSESSEXC" :
888898 _LOGGER .warning (
889- "Maximun session number reached...Close other connections and try again."
899+ "Maximun session number reached...Close other connections "
900+ + "and try again."
890901 )
891902 self .notify_ha (
892- "Warning: Maximun Neviweb session number reached...Close other connections and try again."
903+ "Warning: Maximun Neviweb session number reached...Close "
904+ + "other connections and try again."
893905 )
894906 self ._client .reconnect ()
895907 elif error_data == "DVCATTRNSPTD" :
@@ -901,13 +913,16 @@ def log_error(self, error_data):
901913 )
902914 elif error_data == "DVCACTNSPTD" :
903915 _LOGGER .warning (
904- "Device action not supported for %s...(SKU: %s) Report to maintainer." ,
916+ "Device action not supported for %s...(SKU: %s) Report to "
917+ + "maintainer." ,
905918 self ._name ,
906919 self ._sku ,
907920 )
908921 elif error_data == "DVCCOMMTO" :
909922 _LOGGER .warning (
910- "Device Communication Timeout for %s... The device did not respond to the server within the prescribed delay. (SKU: %s)" ,
923+ "Device Communication Timeout for %s... The device did not "
924+ + "respond to the server within the prescribed delay. "
925+ + "(SKU: %s)" ,
911926 self ._name ,
912927 self ._sku ,
913928 )
@@ -920,7 +935,8 @@ def log_error(self, error_data):
920935 )
921936 elif error_data == "DVCBUSY" :
922937 _LOGGER .warning (
923- "Device busy can't reach (neviweb update ?), retry later %s: %s...(SKU: %s)" ,
938+ "Device busy can't reach (neviweb update ?), retry later %s: %s..."
939+ + "(SKU: %s)" ,
924940 self ._name ,
925941 error_data ,
926942 self ._sku ,
@@ -934,16 +950,21 @@ def log_error(self, error_data):
934950 self ._sku ,
935951 )
936952 _LOGGER .warning (
937- "This device %s is de-activated and won't be updated for 20 minutes." ,
953+ "This device %s is de-activated and won't be updated for "
954+ + "20 minutes." ,
938955 self ._name ,
939956 )
940957 _LOGGER .warning (
941- "You can re-activate device %s with service.neviweb130_set_activation or wait 20 minutes for update to restart or just restart HA." ,
958+ "You can re-activate device %s with "
959+ + "service.neviweb130_set_activation or wait 20 minutes "
960+ + "for update to restart or just restart HA." ,
942961 self ._name ,
943962 )
944963 if NOTIFY == "notification" or NOTIFY == "both" :
945964 self .notify_ha (
946- "Warning: Received message from Neviweb, device disconnected... Check your log... Neviweb update will be halted for 20 minutes for "
965+ "Warning: Received message from Neviweb, device "
966+ + "disconnected... Check your log... Neviweb update will "
967+ + "be halted for 20 minutes for "
947968 + self ._name
948969 + ", Sku: "
949970 + self ._sku
@@ -1094,7 +1115,10 @@ def update(self):
10941115 self ._battery_alert = device_data [ATTR_BATT_ALERT ]
10951116 if ATTR_WATER_LEAK_STATUS in device_data :
10961117 self ._water_leak_status = device_data [ATTR_WATER_LEAK_STATUS ]
1097- if self ._water_leak_status == "flowMeter" :
1118+ if (
1119+ self ._water_leak_status == "flowMeter"
1120+ and device_data [ATTR_FLOW_METER_CONFIG ]["offset" ] != 0
1121+ ):
10981122 self .notify_ha (
10991123 "Warning: Neviweb Device error detected: "
11001124 + device_data [ATTR_WATER_LEAK_STATUS ]
@@ -1399,7 +1423,10 @@ def update(self):
13991423 ]
14001424 self ._flowmeter_model = model_to_HA (self ._flowmeter_multiplier )
14011425 self ._water_leak_status = device_data [ATTR_WATER_LEAK_STATUS ]
1402- if self ._water_leak_status == "flowMeter" :
1426+ if (
1427+ self ._water_leak_status == "flowMeter"
1428+ and device_data [ATTR_FLOW_METER_CONFIG ]["offset" ] != 0
1429+ ):
14031430 self .notify_ha (
14041431 "Warning: Neviweb Device error detected: "
14051432 + device_data [ATTR_WATER_LEAK_STATUS ]
@@ -1657,7 +1684,10 @@ def update(self):
16571684 ]
16581685 self ._flowmeter_model = model_to_HA (self ._flowmeter_multiplier )
16591686 self ._water_leak_status = device_data [ATTR_WATER_LEAK_STATUS ]
1660- if self ._water_leak_status == "flowMeter" :
1687+ if (
1688+ self ._water_leak_status == "flowMeter"
1689+ and device_data [ATTR_FLOW_METER_CONFIG ]["offset" ] != 0
1690+ ):
16611691 self .notify_ha (
16621692 "Warning: Neviweb Device error detected: "
16631693 + device_data [ATTR_WATER_LEAK_STATUS ]
0 commit comments