NodeMCU as a microcontroller without WIFI connection


#1

Hi everyone,

I have a NodeMCU monitoring a EDM machine. Cayenne works great. I record the time machine is running and I receive warnings on my email about faults and etc. However, I connected a flame sensor on my A0 channel where it activates a fire extinguisher. The problem is that it doesn’t work without WIFI, even though this piece of code is outside “Cayenne.loop()”.

Is there any way I can isolate this logic from the internet and allow my NodeMCU to work only as a microcontroller? But I still want to keep my other triggers through Cayenne.

Thank you.


#2

Good use case :slight_smile:

Tagging some of our residents experts here. @kreggly @vapor83 @adam @shramiksalgaonkar @tad.dvor @jameszahary


#3

Working on it. Might implement tonight. Myself and @dforco have been discussing it in this thread:

Cheers,

Craig


#4

@mcoutinh13, @dforco, @bestes,

I have a solution, but it requires changes to the following files:

CayenneMQTTESP8266.h
CayenneMQTTWiFiClient.h
CayenneArduinoMQTTClient.h
Your sketch

I’d like to try and improve it as there are some library delays that I think are overkill and make the main loop slow when the network is lost.

Also, these changes should really be part of the agnostic libraries, but it is tough to break things out and still keep the elegance the Cayenne code framework is trying to maintain and improve upon.

Anyway, there is a solution. Might take me some time to package it.

Cheers,

Craig


#5

Great Craig! excelent!
Maybe you may create new begin/loop functions in order to keep compatibility with all the existent sketches.
Thanks a lot!
David


#6

Thx. That was the easy part. There is another function once initialized and wifi is lost that waits indefinitely until the connection returns. That’s what makes a solution trickier and since it is in the agnostic library, it needs to needs tested with all devices.

Cheers,

Craig