I figured out why I did see the sensor values in my log. The update frequency was set to 1 hour (default) and I was expecting it much more often. To change this parameter, you can use the menu "Modify configuration parameter" in "Interfaces->Z-wave", then select your device in the list, set the param index to 111, set the param size to 4 and the param value to the refresh interval that you want, in seconds (e.g. 900 for 15min).
I also improved the script of mikebnz to be more robust and to include calibration values:
- Code: Select all
# Scan log for MultiSenor6 ZWave Updates
# Load into variables
# Uses regular expressions
import re
# ****** UPDATE THIS PART ******
# Custom variables (create those 3 variable in "Window->Variable List and copy their IDs here)
humid = indigo.variables[350419275]
lux = indigo.variables[1871125472]
temp = indigo.variables[400330053]
# Custom device name
deviceName = "Multisensor"
#Optional:
# Custom calibration (difference between real value and measured value)
calibHumid = 0.0
calibLux = 0.0
calibTemp = 0.0
# *******************************
# Number of log entires to go back through and scan
lines = 500
# Get the last xxx log entires
logEntries = indigo.server.getEventLogList(lineCount=lines)
# Split by newline so we can process the array from newest message to oldest
log=logEntries.splitlines()
# This is the common text that comes back for the mulitsensor 6
searchLine = 'received "'+deviceName+'" sensor update to '
numberRegex = "[-+]?\d*\.\d+|\d+"
# Go backwards through log, newest to oldest
for logevent in reversed(log):
match = re.search(searchLine + ".*?(" + numberRegex + ")%", logevent)
if match:
sensorValue = float(match.group(1)) + calibHumid
indigo.server.log(" MS6: Humidity sensor value: ["+str(sensorValue)+"%]")
indigo.variable.updateValue(humid, value=str(sensorValue))
# Stop looking, we have the newest update, we dont want older ones
break
for logevent in reversed(log):
match = re.search(searchLine + ".*?(" + numberRegex + ") lux", logevent)
if match:
sensorValue = float(match.group(1)) + calibLux
indigo.server.log(" MS6: Lux sensor value: ["+str(sensorValue)+" lux]")
indigo.variable.updateValue(lux, value=str(sensorValue))
# Stop looking, we have the newest update, we dont want older ones
break
for logevent in reversed(log):
#For Farenheits, I'm not sure about the syntax
match = re.search(searchLine + ".*?(" + numberRegex + ")( .C| .F)", logevent)
if match:
sensorValue = float(match.group(1)) + calibTemp
indigo.server.log(" MS6: Temp sensor value: ["+str(sensorValue) + match.group(2)+"]")
indigo.variable.updateValue(temp, value=str(sensorValue))
# Stop looking, we have the newest update, we dont want older ones
break