Hardwire Meek MP1

GPIO-13Touch IC
GPIO-16Power touch IC
GPIO-14RGWB LED
GPIO-12Doppler sensor
GPIO-15Speaker
GPIO-4Output (SSR)
GPIO-1SCL
GPIO-3SDA
ADCLDR

Hardware settings

GPIO->LED:None
Inverse LED:Off
GPIO<->SDA:GPIO-1
GPIO<->SCL:GPIO-3
Pin Mode 0,16,15Output Low
Pin Mode 13,12Input

Predefined Commands

  • http:///control?cmd=event,toggle
    • Toggle Light On/Off
  • http:///control?cmd=event,LightsOff
    • Turn Light Off
  • http:///control?cmd=event,LightsOn
    • Turn Light On
  • http:///control?cmd=rtttl,15:d=10,o=6,b=180,c,e,g
    • Play notes
  • http:///control?cmd=tone,15,1300,200
    • Play a tone
  • http:///control?cmd=event,StarWars
    • Play The Imperial March tune
  • http:///control?cmd=event,Batman
    • Play Batman tune
  • http://<espeasyip>/control?cmd=event,EnableDetection
    • Enable Presence Detection
  • http://<espeasyip>/control?cmd=event,DisableDetection
    • Disable Presence Detection
  • http://<espeasyip>/control?cmd=event,CalibrateTouch
    • Re-Calibrate Touch Sensor
  • http://<espeasyip>/?cmd=reboot
    • Reboot Meek Switch

Rule : Toggle

on toggle do
if [Meek#Presence]=0 and [Meek#Touch]=0
gpio 4,1
TaskValueSet 3,1,1
Neopixel,1,50,0,50
timerSet,2,0
timerSet,1,0
else
gpio 4,0
TaskValueSet 3,1,0
Neopixel,1,25,25,25
timerSet,2,0
timerSet,1,0
endif
endon

on toggle do //*START executing below commands when “toggle” command received (http://<espeasyip>/control?cmd=event,toggle)*\\
if [Meek#Presence]=0 and [Meek#Touch]=0 //*in case status of  “Meek#Presence” &   “Meek#Touch” = 0   *\\



gpio 4,1 //*set SSR output 1= lights on*\\
TaskValueSet 3,1,1 //*sets  “Meek#Touch” on 1, so we know the lights are now on*\\
Neopixel,1,50,0,50 //*set the RGWB LED 1, to Purple (you can play with these values from 0-255 for other color LED indicator)*\\
timerSet,2,0 //*Reset timer 2*\\
timerSet,1,0 //*Reset timer 1*\\



else //*in case the status of  “Meek#Presence” or   “Meek#Touch” is not= 0    *\\
gpio 4,0 //*set SSR output 0= lights off*\\
TaskValueSet 3,1,0 //*sets  “Meek#Touch” on 0, so we know the lights are now off*\\
Neopixel,1,25,25,25 //*set the RGWB LED 1,to White (you can play with these values from 0-255 for other color LED indicator)*\\
timerSet,2,0 //*Reset timer 2*\\
timerSet,1,0 //*Reset timer 1*\\
endif //*END the IF funmction*\\
endon //*END the “toggle” session *\\

Change all the values between <> with your own data (for instance :  

SendToHTTP 192.168.0.100,8080,/json.htm?type=command&param=udevice&idx=65&nvalue=0).

 

on toggle do
if [Meek#Presence]=0 and [Meek#Touch]=0
gpio 4,1
TaskValueSet 3,1,1
Neopixel,1,50,0,50
SendToHTTP <Domoticz IP>,<Domoticz port>,/json.htm?type=command&param=udevice&idx=<Domoticz Device IDX>&nvalue=1
timerSet,2,0
timerSet,1,0
else
gpio 4,0
TaskValueSet 3,1,0
Neopixel,1,25,25,25
SendToHTTP <Domoticz IP>,<Domoticz port>,/json.htm?type=command&param=udevice&idx=<Domoticz Device IDX>&nvalue=0
timerSet,2,0
timerSet,1,0
endif
endon

Rule : Presence Detection

on Presence#Detection=1 do
if [Meek#DisableDetection]=0 and [Meek#Presence]=0 and [Meek#Touch]=0
gpio 4,1
Neopixel,1,50,0,50
TaskValueSet 3,4,1
timerSet,1,25
timerSet,2,0
endif
endon

on Presence#Detection=1 do
if [Meek#DisableDetection]=0 and [Meek#Presence]=1
Neopixel,1,50,0,50
timerSet,1,25
timerSet,2,0
endif
endon

on Rules#Timer=1 do
else
Neopixel,1,0,0,50
timerSet,2,15
endif
endon

on Rules#Timer=2 do
else
Neopixel,1,25,25,25
TaskValueSet 3,4,0
gpio 4,0
endif
endon

When we for the 1’st time detect movement:


on Presence#Detection=1 do //*When the doppler sensor “Presence#Detection“is triggered=1, Start executing this Rules Function*\\
if [Meek#DisableDetection]=0 and [Meek#Presence]=0 and [Meek#Touch]=0  //*In case of “Meek#DisableDetection” & “Meek#Presence” & “Meek#Touch” are all equal to 0*\\
gpio 4,1 //*set SSR output 1= lights on*\\
Neopixel,1,50,0,50 //*set the RGWB LED 1, to Purple (you can play with these values from 0-255 for other color LED indicator)*\\
TaskValueSet 3,4,1  //*sets  “Meek#Presence” on 1, so we know movement is detected*\\
timerSet,1,25 //*Start timer 1 with a delay of 25 seconds*\\
timerSet,2,0 //*Reset timer 2, in case this is active*\\
endif //*END this IF function*\\
endon //*END the “Presence#Detection” session *\\


 

When movement detected after the 1’st time detection:

on Presence#Detection=1 do //*When the doppler sensor “Presence#Detection“is triggered=1, Start executing this Rules Function*\\
if [Meek#DisableDetection]=0 and [Meek#Presence]=1 //*In case of “Meek#DisableDetection” is equal to 0 & “Meek#Presence” is equal to 1, do the following*\\
Neopixel,1,50,0,50 //*set the RGWB LED 1, to Purple (you can play with these values from 0-255 for other color LED indicator)*\\
timerSet,1,25 //*Start timer 1 with a delay of 25 seconds*\\
timerSet,2,0 //*Reset timer 2, so it does not interfere with ongoing timer executions*\\
endif //*END the IF funmction*\\
endon //*END this session *\\


 

When the first timer expires:

on Rules#Timer=1 do //*When timer 1 starts counting, execute this Rules Function*\\
else //*When timer 1 expires(=0), execute this Rules Function*\\ 
Neopixel,1,0,0,50 //*set the RGWB LED 1, to Blue (you can play with these values from 0-255 for other color LED indicator)*\\
timerSet,2,15 //*Start timer 2 with a 15 seconds countdown*\\
endif //*END the IF funmction*\\
endon //*END the “Rules#Timer1” session *\\

on Rules#Timer=2 do /*When timer 2 starts counting, execute this Rules Function*\\
else //*When timer 2 expires(=0), execute this Rules Function*\\ 
Neopixel,1,25,25,25 //*set the RGWB LED 1, to Blue (you can play with these values from 0-255 for other color LED indicator)*\\
TaskValueSet 3,4,0  //*sets  “Meek#Presence” on 0, so we know there is no movement detected during the pasing of the timers 1 & 2*\\
gpio 4,0 //*set SSR output 0= lights off*\\
endif //*END the IF funmction*\\
endon //*END the “Rules#Timer=2” session *\\

Rule : Lights Off

on LightsOff do
gpio 4,0
TaskValueSet 3,1,0
Neopixel,1,50,0,50
timerSet,2,0
timerSet,1,0
endon

Rule : Enable Presence Detection

on EnableDetection do
TaskValueSet 3,2,0
Neopixel,1,50,50,50
endon

Rule : Disable Presence Detection

on DisableDetection do
TaskValueSet 3,2,1
Neopixel,1,0,50,0
endon

Rule : Touch Button Input

on Touch#Button=1 do
if [Meek#Touch]=0
gpio 4,1
TaskValueSet 3,1,1
Neopixel,1,50,50,50
else
gpio 4,0
TaskValueSet 3,1,0
Neopixel,1,50,0,50
endif
endon

Rule : System Boot

on System#Boot do
neopixel,1,125,0,0
gpio,16,0
delay,3000
gpio,16,1
gpio,5,0
gpio,4,0
endon

Rule : Calibrate Touch Button

on CalibrateTouch do
gpio,16,0
delay,5000
gpio,16,1
endon