Each switch is connected to a port on a GPIO expander chip (MCP23017) and I am reading the status of all pins in Rules.
I then use the pin status to set a Dummy task value coinciding with wind angle.
All works fine when I only use 1 pin at a time and ask "if" the status of a pin is High however if I try to put an "and" into my statement, the Dummy Device is not updated (even though the pin status does)
I am obviously doing something wrong in line 12 of my Rule but I cant see it.
Any advice on what Im doing wrong will be very welcome.
Code: Select all
on System#Boot do
MCPmodeRange,1,8,2
MonitorRange,MCP,1,8
LoopTimerSet,1,2
endon
On Rules#Timer=1 do
If [Wind_N#State]=1
TaskValueSet,Wind,Direction,0 // Sets the Dummy device task "Wind,Direction", value to "000 deg"
Endif
If [Wind_N#State]=1 And [Wind_NE#State]=1
TaskValueSet,Wind,Direction,22.5 // Sets the Dummy device task "Wind,Direction", value to "22.5 deg"
Endif
If [Wind_NE#State]=1
TaskValueSet,Wind,Direction,45 // Sets the Dummy device task "Wind,Direction", value to "045 deg"
Endif
If [Wind_E#State]=1
TaskValueSet,Wind,Direction,90 // Sets the Dummy device task "Wind,Direction", value to "090 deg"
Endif
If [Wind_SE#State]=1
TaskValueSet,Wind,Direction,135 // Sets the Dummy device task "Wind,Direction", value to "135 deg"
Endif
If [Wind_S#State]=1
TaskValueSet,Wind,Direction,180 // Sets the Dummy device task "Wind,Direction", value to "180 deg"
Endif
If [Wind_SW#State]=1
TaskValueSet,Wind,Direction,225 // Sets the Dummy device task "Wind,Direction", value to "225 deg"
Endif
If [Wind_W#State]=1
TaskValueSet,Wind,Direction,270 // Sets the Dummy device task "Wind,Direction", value to "270 deg"
Endif
If [Wind_NW#State]=1
TaskValueSet,Wind,Direction,315 // Sets the Dummy device task "Wind,Direction", value to "315 deg"
Endif
endon