My first IOT project , so I'm probably doing something dumb :0)
I have a "ESP12F_RELAY_X1" board that I'm controlling a relay using the cloud service. Simple dashboard with a switch on it. Turn of and off the switch and the relay turns on and off. Problem is that when the board connects to the cloud , the relay turns on. Now the switch on the dashboard shows "OFF" but the relay is on. Turning on the switch turns the relay OFF :0(
My first thought was that the output driving the relay was active low , but that is not the case.
Is there a good was to syncronise the switch with the relay output , so no matter what the output is , the switch will be in the correct position.
Why not start by setting the required relay state in setup() to match the dashboard ?
I set the output to 0 in setup.
As soon as it connects to the cloud , it changes to 1.
I'm new to the cloud thing , so I''m not sure what is going on. I assume the "RelayOnChange" is being called when the connection is made. It does not take any parameters , so how can you tell if the switch is being turned off or on? There is only a "OnChange()" call,
So set the state to 0 as soon as it connects to the cloud
got it working.
Stupid programming mistake.
just a short following question - have you tried to change the value of your variable in the sketch and let then the relay switch? I have the same setup like you and all works, but when the the variable-value changes because of a sensor, then the OnChange-Method isn't called and the relay does not switch???
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.