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.
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.
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)
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
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.
Just read your post - I have just got a Neo Coolcam to try - What I’m finding is that the temperature doesn’t seem to report back very quickly - it can take a couple of hours before the temp change is reported - where my fibaro is very responsive - I have looked in the book for a parameter if that can be changed for quicker reporting - I have only using this for the temperature monitoring as I need something small and portable - Hope you can help
Thanks for the reply - They sometimes stick at 0.00 for some reason I’m going to change them for Fibaro sensor - I thought I would give them a go as they are cheaper than the Fibaro Sensors
The annoying thing is that the sensors are fine. It’s the compatibility with Vera that’s the issue. I have the same sensors hooked up to my Indigo Domo controller and they work perfectly.