I have a question about "good practice" or "rules of thumb" in the following configuration:
- Wemos D1 mini
- Level Converter
- MCP23017
- 8-channel relay (active low)
- ESPEasy v2.0 (compiled by myself just to hard code parameters to my WIFI network)
So to controll my watering system the rules looks like this:
Code: Select all
on System#Wake do
event,StopAll
endon
on R1 do
MCPLongPulse,1,0,%eventvalue%
endon
on R2 do
MCPLongPulse,2,0,%eventvalue%
endon
on R3 do
MCPLongPulse,3,0,%eventvalue%
endon
on R4 do
MCPLongPulse,4,0,%eventvalue%
endon
on R5 do
MCPLongPulse,5,0,%eventvalue%
endon
on R6 do
MCPLongPulse,6,0,%eventvalue%
endon
on R7 do
MCPLongPulse,7,0,%eventvalue%
endon
on R8 do
MCPLongPulse,8,0,%eventvalue%
endon
on R9 do
MCPLongPulse,9,0,%eventvalue%
endon
on R10 do
MCPLongPulse,10,0,%eventvalue%
endon
on StopAll do
MCPGPIO,1,1
MCPGPIO,2,1
MCPGPIO,3,1
MCPGPIO,4,1
MCPGPIO,5,1
MCPGPIO,6,1
MCPGPIO,7,1
MCPGPIO,8,1
MCPGPIO,9,1
MCPGPIO,10,1
endon
- When the system boots I set all relays to "off", but I'm not sure whether I should do this at "System#Wake" or "System#Boot" event? Or it doesn't matter? I can see from console that "System#Wake" is earlier event than "System#Boot". This is a protection in case of during PulseTime there will be power outage and the relay will get to last state after power back (and my garden will became a lake).
- Is there any setting/command/compile directive to not "remember" the last state of output pin and set it to default value every time the system boots (i.e. pins which control relay board will be default set to "HIGH" after boot, then I will not need the "StopAll" event at boot)?
- I can observe that when one or more relays are ON and I will cut the power and then power it back there is second or two when the relays "clicks" to ON state and then after that time they are turned OFF (by the StopAll event) - How can I mitigate this behaviour? It can be stressful for my water pump.
Code: Select all
Config.h
#undef DEFAULT_NAME
#define DEFAULT_NAME "ESPEasyTest" // Enter your device friendly name
#undef DEFAULT_SSID
#define DEFAULT_SSID "myiots" // Enter your network SSID
#undef DEFAULT_KEY
#define DEFAULT_KEY "sypersecret" // Enter your network WPA key
#undef DEFAULT_CONTROLLER
#define DEFAULT_CONTROLLER true // true or false enabled or disabled, set 1st controller defaults
#undef DEFAULT_SERVER
#define DEFAULT_SERVER "mqtt.lipowa54.local" // Enter your Server IP address
#undef DEFAULT_PORT
#define DEFAULT_PORT 2883 // Enter your Server port value
#undef DEFAULT_PROTOCOL
#define DEFAULT_PROTOCOL 5
#undef DEFAULT_USE_RULES
#define DEFAULT_USE_RULES true // (true|false) Enable Rules?
#undef DEFAULT_USE_NTP
#define DEFAULT_USE_NTP true // (true|false) Use NTP Server
#undef DEFAULT_NTP_HOST
#define DEFAULT_NTP_HOST "ntp.lipowa54.local" // NTP Server Hostname
#undef DEFAULT_TIME_ZONE
#define DEFAULT_TIME_ZONE 60 // Time Offset (in minutes)
#undef DEFAULT_USE_DST
#define DEFAULT_USE_DST true // (true|false) Use Daily Time Saving
#undef RULES_TIMER_MAX
#define RULES_TIMER_MAX 10
#undef SYSTEM_TIMER_MAX
#define SYSTEM_TIMER_MAX 10