Cat litterrobot counter: it can be used as SWITCH ? LUA ?
Posted: Tuesday 27 February 2018 12:21
I have a cat litterrobot (see attachment) and I want to add a sensor to it which gives Domotics a signal that it is used.
After a cat has used the catlitter robot, the robot cleans itself by turning round..
So, I have made a simple sensor with an Arduino Nano, and NRF24LC01 with adapter and a SW-420 Vibration Tilt Sensor Module (see attachments).
In Domoticz I see the sensor, and I see when it's active or not active. So far so good.
1) first problem: the new Domoticz sensor is visable as SWITCH and can be enabled and disabled: but it must be an INPUT SENSOR ONLY, not a switch/.
=> can this be changed ??
2) second issue (SCRIPT)
I want to have a counter: this counter must be displayed on the Domoticz Dashboard and after (for example) 7 cleanings, the system must send a warning 'EMPTY LITTERBOX PLEASE". After cleaning, the counter must be reset to zero again.
So, I have added an uservariable 'catlitterbox' : integer and initial value 0.
But I have no idea how I must make the LUA script, I have started with the script below and made it active. Counter is changed from 0 to 3, no changes after that....
commandArray = {}
if otherdevices['catlitterbox'] == "On" then
commandArray['Variable:catlitterbox'] = tostring(8)
else
commandArray['Variable:catlitterbox'] = tostring(3)
end
return commandArray
I hope somebody can help ?
Many thanks !!
Arthur
After a cat has used the catlitter robot, the robot cleans itself by turning round..
So, I have made a simple sensor with an Arduino Nano, and NRF24LC01 with adapter and a SW-420 Vibration Tilt Sensor Module (see attachments).
In Domoticz I see the sensor, and I see when it's active or not active. So far so good.
1) first problem: the new Domoticz sensor is visable as SWITCH and can be enabled and disabled: but it must be an INPUT SENSOR ONLY, not a switch/.
=> can this be changed ??
2) second issue (SCRIPT)
I want to have a counter: this counter must be displayed on the Domoticz Dashboard and after (for example) 7 cleanings, the system must send a warning 'EMPTY LITTERBOX PLEASE". After cleaning, the counter must be reset to zero again.
So, I have added an uservariable 'catlitterbox' : integer and initial value 0.
But I have no idea how I must make the LUA script, I have started with the script below and made it active. Counter is changed from 0 to 3, no changes after that....
commandArray = {}
if otherdevices['catlitterbox'] == "On" then
commandArray['Variable:catlitterbox'] = tostring(8)
else
commandArray['Variable:catlitterbox'] = tostring(3)
end
return commandArray
I hope somebody can help ?
Many thanks !!
Arthur