Some have changed without warning, as almost always, that takes time to set the default value of the preferences and found a null instead of 0.
Before, driver set the defaults preferentes when starting the driver.
Hi @nayelyz
The defaults of the preferences were previously established when starting the driver with the set profile, or at least I had never seen that after 8 minutes of running the driver the preference was still at a null value instead of the default
It seems that the defaults defined in the profile preferences are not set when the device is installed.
When the driver goes to perform some operation with the values of the preferences, it encounters null values and an error is produced that stops the function.
This didn’t happen before it happened before
AlejandroPadilla
(Please contact @nayelyz or @Luis_Humberto_Medina )
4
We tried to reproduce your issue, but unfortunately, we can’t. For this reason, we need your help by sharing with us the profile definition you are currently using to generate the problem, please.
I did not detect it and I have not been able to replicate it either.
It was reported by a user @sflamm when he installed a fibaro smat implant and when calculating the corrected temperature with a preference, he found a null value instead of the default value, until he manually set to value = 0 in preferences.
The error was in this line: > [string “init.lua”]:124: attempt to perform arithmetic on a nil value (field ‘internalTempOffset’)
local function temperature_report_handler(self, device, cmd)
print(“<< Temperature_report_handler >>”)
if (cmd.args.sensor_type == SensorMultilevel.sensor_type.TEMPERATURE) then
local custom_temp = cmd.args.sensor_value
if cmd.src_channel == 7 then -- Internal temperature
***line 124*** custom_temp = custom_temp + device.preferences.internalTempOffset *****
elseif cmd.src_channel == 8 then -- Externaltemperature 1
custom_temp = custom_temp + device.preferences.externalTempOffset1
end
localscale = 'C'
if (cmd.args.scale == SensorMultilevel.scale.temperature.FAHRENHEIT) then scale = 'F' end
device:emit_event_for_endpoint(cmd.src_channel, capabilities.temperatureMeasurement.temperature({value = custom_temp, unit = scale}))
end
I don’t know if this error was something momentary and it has been self fixed, I couldn’t reproduce it in other profiles since I don’t have that device.
I don’t know if @sflamm it has happened this error again
AlejandroPadilla
(Please contact @nayelyz or @Luis_Humberto_Medina )
6
Hi @sflamm, I’m Alejandro Padilla from the dev support team
The problem had occurred in one of the first driver versions - got the divide by zero error when the parameter’s default value was zero. I fixed it by choosing the smallest non zero value to use.
In the later versions of the driver I have not encountered the problem. I currently have the values set to zero as default and it is working without error
Another error I received was that for Automation rules it was still showing parameter ranges as Celsius even though my locale sets the temperature in Fahrenheit. Over time that seemed to automatically correct itself without my making any adjustments on my side. But when the rule was originally created it was unusable - later when I returned to it the range has “magically” changed to Fahrenheit
Sorry to correct you @sflamm, the error was because the driver was trying to add a received temperature value from device with a null preference value, when the preference value should be 0.
You will no longer see this error if you do not delete the device from the App, then all the values of the device will be deleted and when you pair device again it should return to the default value 0 or fail if the driver does not receive the default value default = 0 and find a null value
AlejandroPadilla
(Please contact @nayelyz or @Luis_Humberto_Medina )
9
@sflamm if you have the chance to reproduce the issue so we can open an investigation about it, please share the following with us after doing so:
Thanks for the comment, but unfortunately we need more recent driver and Hub logs to generate a report to the corresponding team, the most recent logs saved in the Hub can help us investigate.
If you have the chance to reproduce the issue an share with us the recent logs, it would help a lot. If not, we will be attentive of other reports about the same issue.