Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when filter nwkid on logging, we can see that some function dont log … #1770

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Classes/AdminWidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ def _get_switch_selector_options(self, ):
}

class AdminWidgets:
def __init__(self, log, PluginConf, pluginParameters, ListOfDomoticzWidget, Devices, ListOfDevices, HardwareID):
def __init__(self, log, PluginConf, pluginParameters, ListOfDomoticzWidget, Devices, ListOfDevices, HardwareID, IEEE2NWK):

self.pluginconf = PluginConf
self.pluginParameters = pluginParameters
self.ListOfDomoticzWidget = ListOfDomoticzWidget
self.Devices = Devices # Point to the List of Domoticz Devices
self.ListOfDevices = ListOfDevices # Point to the Global ListOfDevices
self.HardwareID = HardwareID
self.IEEE2NWK = IEEE2NWK
self.log = log
self.createStatusWidget(Devices)
self.createNotificationWidget(Devices)
Expand Down
10 changes: 5 additions & 5 deletions Modules/domoMaj.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,10 @@ def _domo_maj_one_cluster_type_entry( self, Devices, NwkId, Ep, device_id_ieee,
check_set_meter_widget( self, Devices, NwkId, device_id_ieee, device_unit, prev_nValue, prev_sValue, 0)
instant, _summation = retrieve_data_from_current(self, Devices, device_id_ieee, device_unit, prev_nValue, prev_sValue, "0;0")
summation = round(float(zlinky_sum_all_indexes( self, NwkId )), 2)
self.log.logging(["ZLinky","Electric"], "Debug", "------> Summation for Meter : %s" %summation)
self.log.logging(["ZLinky","Electric"], "Debug", "------> Summation for Meter : %s" %summation, NwkId)

sValue = "%s;%s" % (instant, summation)
self.log.logging(["ZLinky","Electric"], "Debug", "------> : " + sValue)
self.log.logging(["ZLinky","Electric"], "Debug", "------> : " + sValue, NwkId)
update_domoticz_widget(self, Devices, device_id_ieee, device_unit, 0, sValue, BatteryLevel, SignalLevel)

elif WidgetType == "Meter" and Attribute_ == "050f":
Expand All @@ -391,7 +391,7 @@ def _domo_maj_one_cluster_type_entry( self, Devices, NwkId, Ep, device_id_ieee,
_instant, summation = retrieve_data_from_current(self, Devices, device_id_ieee, device_unit, prev_nValue, prev_sValue, "0;0")
instant = round(float(value), 2)
sValue = "%s;%s" % (instant, summation)
self.log.logging(["Widget","Electric"], "Debug", f"- {device_id_ieee} {device_unit} Instant Power received {value} converted to {instant} and {summation} resulting in {sValue}")
self.log.logging(["Widget","Electric"], "Debug", f"- {device_id_ieee} {device_unit} Instant Power received {value} converted to {instant} and {summation} resulting in {sValue}", NwkId)

update_domoticz_widget(self, Devices, device_id_ieee, device_unit, 0, sValue, BatteryLevel, SignalLevel)

Expand All @@ -415,7 +415,7 @@ def _domo_maj_one_cluster_type_entry( self, Devices, NwkId, Ep, device_id_ieee,
# No summation retreive, so we make sure that EnergyMeterMode is
# correctly set to 1 (compute), if not adjust

self.log.logging(["Widget","Electric"], "Debug", f"------> Update Meter/Meter : {device_id_ieee} {device_unit} {sValue}")
self.log.logging(["Widget","Electric"], "Debug", f"------> Update Meter/Meter : {device_id_ieee} {device_unit} {sValue}", NwkId)
update_domoticz_widget(self, Devices, device_id_ieee, device_unit, 0, sValue, BatteryLevel, SignalLevel)

if "WaterCounter" in ClusterType and WidgetType == "WaterCounter":
Expand Down Expand Up @@ -1594,7 +1594,7 @@ def check_set_meter_widget( self, Devices, NwkId, DeviceId, Unit, oldnValue, old
Options = {'EnergyMeterMode': '0'}

_device_options = domo_read_Options( self, Devices, DeviceId, Unit,)
self.log.logging( "Widget", "Debug", "check_set_meter_widget Options: %s" %_device_options)
self.log.logging( "Widget", "Debug", "check_set_meter_widget Options: %s" %_device_options, NwkId)

# Do we have the Energy Mode calculation already set ?
if "EnergyMeterMode" in _device_options:
Expand Down
12 changes: 9 additions & 3 deletions Modules/domoticzAbstractLayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,12 +396,18 @@ def domo_update_api(self, Devices, DeviceID_, Unit_, nValue, sValue, SignalLevel
TimedOut (int, optional): Timeoud flag 0 to unset the Timeout. Defaults to None.
Color (str, optional): Color . Defaults to "".
"""
nwkid = None
try:
nwkid = self.IEEE2NWK[DeviceID_]
except KeyError :
pass

self.log.logging("AbstractDz", "Debug", "domo_update_api: DeviceID_ : %s Unit_: %s nValue: %s sValue: %s SignalLevel: %s BatteryLevel: %s TimedOut: %s Color: %s : %s" %(
DeviceID_, Unit_, nValue, sValue, SignalLevel, BatteryLevel, TimedOut, Color, Options), DeviceID_)
DeviceID_, Unit_, nValue, sValue, SignalLevel, BatteryLevel, TimedOut, Color, Options), nwkid)

if nValue is None:
self.log.logging("AbstractDz", "Error", "domo_update_api: DeviceID_ : %s Unit_: %s nValue: %s sValue: %s SignalLevel: %s BatteryLevel: %s TimedOut: %s Color: %s : %s" %(
DeviceID_, Unit_, nValue, sValue, SignalLevel, BatteryLevel, TimedOut, Color, Options), DeviceID_)
DeviceID_, Unit_, nValue, sValue, SignalLevel, BatteryLevel, TimedOut, Color, Options), nwkid)
return

if DOMOTICZ_EXTENDED_API:
Expand All @@ -428,7 +434,7 @@ def domo_update_api(self, Devices, DeviceID_, Unit_, nValue, sValue, SignalLevel
Devices[DeviceID_].Units[Unit_].Options = Options

except Exception as e:
self.log.logging("AbstractDz", "Debug", f"domo_update_api: Cannot Write Attribute Option with {Options}")
self.log.logging("AbstractDz", "Debug", f"domo_update_api: Cannot Write Attribute Option with {Options}", nwkid)

Devices[DeviceID_].Units[Unit_].Update(Log=(not SuppressTriggers) )
return
Expand Down
2 changes: 1 addition & 1 deletion plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def onStart(self):
)
self.WebUsername, self.WebPassword = self.domoticzdb_Preferences.retreiveWebUserNamePassword()

self.adminWidgets = AdminWidgets( self.log , self.pluginconf, self.pluginParameters, self.ListOfDomoticzWidget, Devices, self.ListOfDevices, self.HardwareID)
self.adminWidgets = AdminWidgets( self.log , self.pluginconf, self.pluginParameters, self.ListOfDomoticzWidget, Devices, self.ListOfDevices, self.HardwareID, self.IEEE2NWK)
self.adminWidgets.updateStatusWidget(Devices, "Starting up")

self.DeviceListName = "DeviceList-" + str(Parameters["HardwareID"]) + ".txt"
Expand Down
Loading