I have a c# program to control my sonoff basic /ESP8266 with MQTT
When i start, every thing is ok (connects and get/send messages) but for some reason, it stops
after a while. When I do a restart, it’s reconnecting, and it’s working again.
Could this be the problem:
Program.GoBackground();
I have changed it to (which is working better):
while (Program.IsRunning && MqttIsConnected)
{Pause(3);}
Can somebody explain what the problem could be and of the solution is the solution (don’t know if it has a performance impact on the server)?
On my 525 installation I have a similar issue. I have a sensor reporting data every couple minutes (still working) but the MQTT app stopped working a few weeks ago. Restarting the app fixed it, but I’m sure it will stop again. I can post my whole code but it’s based on the stock MQTT app Gene wrote.
The problem with the above is that you probably have an infinite loop too, take a look between the two options and see what cpu load is like without the sleep.
@David_Wallis I did do the try … and catch but looks like the “event” is not triggert by mqtt. I shaw also that my 2.4ghz wifi was down today, perhaps that’s the problem. When i have time, i do some more digging.
add event (program number is here 1001) if you want to switch it on time
js script:
var Heater = $$.modules.withAddress(“1001”).get();
Heater.command(‘Control.On’).execute(); //turn it on
Heater.command(‘Control.Off’).execute(); // turn it off
Hello,
the Sonoff relay is ready so far. How do I get it under HG (MGTT) to run.
I created your program in HG. Is not I missing a widget now?
Would it be possible to upload all parts (widget + program). For a layman it is difficult to realize the project. What is normal for you is not solvable for me.
Thank you for your support!
Hi,
It’s better if you want help, to make a new thread.
But for this time, here is some extra info
I use mosquitto as broker. (installed on the same pc as HG)
Also for testing, i use my phone with MQTT Dash app, so i can check if the node is correct.
This is a modified switch-widget (the toggle give an error, i have not programmed it)
I found one problem (made by me), the unique ID for this client was used twice. One for a relays and one for esp8266 with bme280 for temperature/humidity/pressure. It’s now still working with Program.GoBackground(); so hopefully that was the problem.
Hope to hear from you when you have finish your project.
Kind regards,
Pepijn