Replies: 9 comments 6 replies
-
|
Hm, a recent PR changed the default to MQTT enabled = false. It should ofc load the right settings but maybe it's doing things in the wrong order or something. I'll check it out but will not have time until next week. |
Beta Was this translation helpful? Give feedback.
-
|
I did some digging and think may know why it's happening. My day job is a SAP Consultant more used to ABAP programming and still getting to grips with OO stuff, but looking at the file names .cpp I guessed this is written in C++ which I've not used before, but from a bit of playing around with C 30 years ago I was trying to find the main() function to see where it all starts. After a bit of head scratching I realised that with Arduino the main function is in the arduino.h include and calls init(), setup() and loop(). I didn't see an init() but did see setup() and loop() so started with these. The setup calls startMqtt() function. This calls loadMqtt() which reads the mqtt.json file and passes values from it into mqtt_info, including the field useMqtt. There is a line commented out that would have set a flag enableMqtt: after calling loadMqtt(), startMqtt() then calls mqttConnect() - this connects to the MQTT broker, but only if the I looked at where enableMqtt gets set and in the main.h it is first set to false. So what I think happens is that enableMqtt is false to start off with when the system boots. I'm not sure why that line in loadMqtt() is commented out, or why mqttConnect uses a separate flag enableMqtt instead of directly using mqtt_info->useMqtt. I tried uncommenting the line in loadMqtt(), but that made the web gui unresponsive so I reverted the change. I then realised the line I was going to try that, but was a bit worried I'd bricked the device when the webgui wasn't working after my first change. I'm doing this remotely via VPN as not at the cottage at the moment and was relieved it still let me upload previous firmware. I need to be sure I can turn it on remotely tomorrow so don't want to mess it up by trying anything else yet. So will have another try next week. |
Beta Was this translation helpful? Give feedback.
-
|
Hi regfixit, i had the same problem after upgrading to the last firmware. My last FW was from April2024. |
Beta Was this translation helpful? Give feedback.
-
|
I just noticed that when I access the file system in mqtt.json I get the message "Permission denied". |
Beta Was this translation helpful? Give feedback.
-
|
@visualapproach I'm still confused by the fact that reading mqtt.json in loadMqtt() isn't working. I noticed that in the old source code, the IP address was four individual integers, but it's now treated as a string. Is it possible that even though I have the new firmware installed, the website is still in its old state and is no longer compatible? Does the ESP8266 perhaps need to be completely (FW and FS) reinstalled? |
Beta Was this translation helpful? Give feedback.
-
|
As visualapproach mentioned, the system stops you downloading the mqtt.json (and wifi.json) files as these contain passwords. In my local copy I commented out the code that prevents this [in handleFileRead() in main.cpp] and saw the file correctly written. but there is also a bit in the setup() module that sets the variables to default values I think it's just a case of sorting out setting and getting things in a single place and the right order. Also when I talk about the latest version I was meaning the latest Master release rather than the development branch. It might be that branch does things again a bit differently. I'll have a more detailed look this week. I'm enjoying learning new things and thanks once again @visualapproach for such a great project. |
Beta Was this translation helpful? Give feedback.
-
|
Hi. Yes, my initial mistake was that I was coming from an older version, when the broker address still consisted of four individual fields. After uploading the mqtt.html file for the appropriate version, it now read the configuration correctly. Regarding the enable, I now also see clearly. As visualapproach commented in the loadMqtt() method, he commented out the assignment |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
I saw the same behaviour in the latest Dev release - i.e. initially stays disconnected and then when periodictimer runs, it connects, so not sure why @Gelbwichtel yours didn't subsequently connect a minute or two after getting its IP.
Will create a pull request to incorporate changes |
Beta Was this translation helpful? Give feedback.


Uh oh!
There was an error while loading. Please reload this page.
-
Am not sure if this was always the case, but since updating FW I find the MQTT does not connect when the device reboots. I have to go to the MQTT config page (which has all details saved and Enable MQTT tick box marked ) and it says in the password field. I enter the password and click Save and then it connects, although the password field still says .
I modified the handleFileRead() function to allow me to download the mqtt.json file and can see that all the details including the password are there, but it doesn't start unless I re-enter the password and save.
Any ideas on where to look ?
Beta Was this translation helpful? Give feedback.
All reactions