Chdev.lua many attributes passed via statevariable are ignored

Hi AK,

I was trying to set a number of attributes (model, manufacturer, device_json) via the statevariable on device creation and found they got ignored. Looking at the chdev.lue code I found that the specified attribute values get overruled by the defaults. So moved setting the attributes from the statevariable after the default (line 216) and it now behaved as a Vera does.

– 2019.09.13 set attributes from state variable as we can overwrite defaults.
if type(x.statevariables) == “table” then
for _,v in ipairs(x.statevariables) do
if (not v.service) and v.variable and v.value then – 2019.06.02
dev:attr_set (v.variable, v.value)
end
end
end

Can you look at this for a next release?

Cheers Rene

Rene

Great catch! Thanks very much. I’ve moved the code and it’s in the latest Development branch. v19.9.14.

Grateful if you could verify that it all works as expected for you.

Cheers , AK

Hi AK.

Works like a charm :smiley:

Cheers Rene

1 Like

Excellent! Thanks.