I am planning to use a SONOFF with a BH1750 luminosity sensor to control a secondary lamp in a bath room. The ESP will be used without an external controller but with the internal rules.
What I understand is the following example rule:
Code: Select all
On brightness#lux do
if [brighness#lux]>1 // Master light switched on, so turn on relais
gpio,12,1
gpio,13,0
endif
endon
On brightness#lux do
if [brighness#lux]<50 // Master light switched off but light connected to relais still on, so turn off relais
gpio,12,0
gpio,13,1
endif
endon
Code: Select all
On brightness#lux do
if [brighness#lux]>1 and [relais#relais] == 0 // Master light switched on, so turn on relais
gpio,12,1
gpio,13,0
endif
endon
On brightness#lux do
if [brighness#lux]<50 and [relais#relais] != 0 // Master light switched off but light connected to relais still on, so turn off relais
gpio,12,0
gpio,13,1
endif
endon
Could you tell me if my idea with a combining "and" is possible? Would it be possible to interleave two if loops?
Please help