Neo CoolCam Temperature Sensor showing 0

I’ve got a number of Neo CoolCam motions sensors which include a temperature sensor. I managed to include everything correctly and everything seems to be working fine. However there is one annoyance/bug with the temperature sensor. The reading goes to 0.00 quite often. Eventually the real temperature reading will return for a while and then go back to 0.00.

I believe this is related to the fact that the sensor runs on a battery, and the idea is not to wake the sensor to often, in order to save battery. This is completely understandable.

What I don’t understand is why the reading has to go to 0.00 instead of just staying at the last recorded temperature.

Also this means that since the reading goes to 0.00, I can’t setup any alerts that trigger when the temperature goes below a certain temperature. Because of the 0.00 reading I would get false positives alerts.

Any idea whether this is fixable?

It’s something related to the report. You can fix it with some code and just avoid 0.

1 Like

I’m new to Vera. So could you elaborate a bit on what needs to be done and where I can find resources to learn to code things up.

Sure, sorry :slight_smile:

It’s the way the Z-Wave report is handled by Vera (or, probably, some non-standard way of doing it by the device). Anyway, the idea is to intercept the urn:upnp-org:serviceId:TemperatureSensor1 / CurrentTemperature and write it back. Something like this:

D_TEMP = "urn:upnp-org:serviceId:TemperatureSensor1"
local devID = 310 -- place your device ID here
luup.variable_watch("filterTemperatureReading", D_TEMP, "CurrentTemperature", devID)

function filterTemperatureReading(deviceID, service, variable, oldValue, newValue)
	luup.log('newValue: ' .. tostring(newValue))
	luup.log('oldValue: ' .. tostring(oldValue))
	if newValue == 0 and oldValue ~= newValue then
		luup.variable_set(D_TEMP, "CurrentTemperature", oldValue, deviceID)
		luup.log('oldValue saved instead of newValue')
	end
end

Place it under Apps, Develop Apps, Startup Code. Be sure to set devID to your ID (you can find under your device, then advanced.

This code can be adapted easily to prevent new values to be saved when an invalid value is detected.

1 Like

That’s amazing. Thanks for your help. I’ll give it a try.

I tested this out and unfortunately for some reason this didn’t work. Could it be related to the fact that this is a multisensor? Should I use the device number of the parent device or the sub-device that gives the temperature output?

Also if I have two of these devices do I just copy the same code twice and update the device number? Or does the code need to be modified?

Use it on the child device. If you have more than one, simply repeat this code

local devID = 310 -- place your device ID here
luup.variable_watch("filterTemperatureReading", D_TEMP, "CurrentTemperature", devID)

devID = 311 -- place your device ID here
luup.variable_watch("filterTemperatureReading", D_TEMP, "CurrentTemperature", devID)

And leave the function after it.

1 Like

I tried what you suggested and I have been monitoring things but unfortunately it doesn’t work. The readings still go to 0.00 every now and then.

That’s strage. Try to change the code to this and try again:

function filterTemperatureReading(deviceID, service, variable, oldValue, newValue)
	luup.log('newValue: ' .. tostring(newValue))
	luup.log('oldValue: ' .. tostring(oldValue))
	if tonumber(newValue) == 0 and tonumber(oldValue) ~= tonumber(newValue) then
		luup.variable_set(D_TEMP, "CurrentTemperature", oldValue, deviceID)
		luup.log('oldValue saved instead of newValue')
	end
end
1 Like

Your solution seems to have worked. Thanks for that!

However the underlying issue remains. Thanks to your solution the last known temperature (that is not 0C) remains the reading that can be seen. However the underlying temperature still regularly goes to 0.00C. This of course creates havoc with any alerts. For example, I have an alert that triggers when the temperature goes below 7 degrees C. The temperature in reality has never gone below 9 degrees but because of this issue that, the alert is triggered regularly.

Also I have done some research and this does not seem to be an issue with Fibaro Home Centre or Indigodomo. Which might imply that there is some issue with the way this motion sensor has been implemented in Vera. Could this be?

Yes, there’s definitely something strange going on. To prevent false readings, I always avoid normal scenes, and write some defensive code (ie: for binary sensors triggering again, even if this was already triggered). In this example, you can easily attach any code in the else block of the code. Or you can also write both value (new and old) and check them.

Also, a very simple solution it to write some code in the scene, and return false if the temp is zero: this will prevent the scene from running if temp is exactly zero.

I also suggest you to open a ticket with support: there are chances this could be fixed in a future firmware.

© 2020 Vera Control Ltd., All Rights Reserved. Terms of Use | Privacy Policy