Page 1 of 1

Having difficulties with Default State

Posted: 20 Jan 2018, 20:12
by NDR008
So, I have ESP-EASY mega running on a sonoff like clone.

GPIO4 is connected to the relay.
I would like it to always turn on when the board is powered on.

Openhab is controlling this switch via MQTT too.

I tried setting the GPIO 4 default state to Output High but it does not seem to do anything.
I also tried using rules and system#boot, but it also did not work.

If the last message I sent over MQTT was to turn it on, then it will turn on after a power cycle (and around 6 seconds).
If the last message I sent over MQTT was to turn it off, then it will turn off after a power cycle.

It is confusing me since Openhab is not really continuously sending MQTT messages.

Any ideas what am I doing wrong?

Additionally, it is a bit surprising for me, but inside Pin buffer state I find:
Plugin Index/Pin Mode Value/State
1 4 output 0
1 15 output 0

I do not actually use Pin 15....

Re: Having difficulties with Default State

Posted: 20 Jan 2018, 20:25
by NDR008
Turns out I had 2 issues:

GPIO 4 is one of the 2 default I2C lines.
Removed that, and it was okay.

Now it turns on virtually instantly after turning on.
But around 5 seconds later, it retrieves the state of the gpio that was requested over MQTT.

Now to figure out why does that happen.

Re: Having difficulties with Default State

Posted: 20 Jan 2018, 23:06
by NDR008
Solved the second issue. I had retained messages on my Mqtt broker.