mc0110 / wifimanager

micropython nano-os with ap-support
MIT License
10 stars 3 forks source link

How to use? #4

Closed 7wells closed 1 year ago

7wells commented 1 year ago

Hi Magnus! Sorry that I don't understand it right away. I have updated to your latest version of inetbox2mqtt, provided all necessary data including WiFi SSID and credentials. Everything works as before and expected.

Now I saw your new wifimanager but after going through the README, it's unclear to me how to proceed from here.

The ESP32 is in my RV (parked close to my home) and connected to my home WiFi. What would I now have to do to change something on the ESP32? Do I first have to bring it back home, attach it to my laptop, and flash wifimanager? Would this not overwrite inetbox2mqtt? When flashing, the Thonny Python IDE also asks if it should erase before flashing. Should it or better not, or has this nothing to do with preserving inetbox2mqtt? Sorry in case these questions are too basic for a discussion here; a very brief hint where I should read more background information would be very welcome in that case. :)

mc0110 commented 1 year ago

Hi Stan,

Your questions are very interesting! I haven't integrated the wifimanager into the inetbox2mqtt repo yet, because I wanted to discuss the points with interested people (like you) from the community first.

Of course you are right, if you were to flash the ESP32, everything would be gone. But you don't have to reflash it. You can also install the wifimanager. Then the wifimanager is started first and only when you have switched from OTA-run to normal run would the inetbox2mqtt be active when you restart. But the corresponding modules can be installed in parallel on the chip.

My thoughts: The web frontend is based on a library that is really very small. It will no longer be possible to significantly reduce its footprint. The question now is which use-cases you want to cover with the frontend. I have been running the inetbox2mqtt in my RV for a month quite stable and do not need a frontend.

Therefore, the question of added value becomes clear to me: This is for (a) the installation process and also for (b) installing updates, if there should be any.

(a) Installation process: Idea is a simple installation that should run without using an IDE.

Here are the steps:

(i) install micropython (super easy on the RPI pico) or burn python using ESPTool (on the ESP32, ESP8266). (ii) Use simple installation routine (this works very well via mip); here only a few lines have to be entered at a terminal (see the README for that), then the software is installed But both steps require an internet connection, but can take place anywhere, not necessarily in the RV

Then, once the wifimanager is installed, after a reboot the webfrontend would either open on an AP, if no credentials will be found.

(iii) Entering the confidential data (credentials) on a web mask (wifimanager) -Possibility even without an internet connection -Possibility to change the WLAN network or to switch between different wifi-stations

Since the physical installation in the RV and the LIN connection to the CPplus are full of pitfalls, I am currently thinking about implementing debugging in the frontend rather than the currently included file manager. This is probably dispensable if it also enables the simple download/upload of files.

What is your opinion?

(b) OTA-updates: The problem is the switching between normal operation and OTA updates. At the moment it is realised in such a way that after setting the flag (a special file in the filesystem), the inetbox2mqtt is started during a reboot and the web frontend is not active. To reactivate this, a file must first be deleted. Even if it is a simple command, this again requires a terminal connection to the chip. Alternatively, one could realise it in such a way that a button is used that has to be pressed during the reset, or as another alternative, the frontend remains active for a certain time after a reboot. At the moment, however, I am not sure what the best option is.

Do you have any ideas?

7wells commented 1 year ago

The 2 available small buttons cannot be used, if I'm correct, or could you use them for this purpose? But if the ESP32 etc. are behind a panel, we would have to attach a button to the GPIOs anyway, right? Maybe a stupid question, but could we trigger something on the ESP32 via the CP+, like pushing and holding the button and turning it? I would not like to drill another hole into the wall of my RV just for a button, but maybe a button could be attached close to the Truma Combi?

Maybe we can use the "Fensterkontakt" of the Truma Combi to trigger something? Or is the wrong way?

Truma Fensterkontakt (schwarzes Kabel) und Truma Uhrkontakt 4er Stecker. Über die Schaltkontakt ist die Truma ohne Bedienteil steuerbar. Es muß lediglich die Solltemperatur eingestellt sein. Der Wahlschalter selbst steht auf aus.

https://www.reisemobiltreff.de/viewtopic.php?p=44275

https://poesslforum.de/forum/elektrik/24639-automatisierung-ueber-raspberry-pi-openhab-und-evtl-tinkerforge#379110

Daniel knows about this, too: https://poesslforum.de/forum/elektrik/24639-automatisierung-ueber-raspberry-pi-openhab-und-evtl-tinkerforge#379144

7wells commented 1 year ago

About the update process you described before (including the quoted text), I have yet to fully understand and most of all try to do it myself. Hopefully, I can then provide with a more useful feedback. Thanks for your patience!

mc0110 commented 1 year ago

Stan,

you shouldn't drill holes into a wall or to do similar terrible things for this button. I'm thinking about the situation and the different use-cases.

By the way: I couldn't open your links into this forum.

7wells commented 1 year ago

Sorry about the links! Maybe it's necessary to sign in?

See quoted post below (not sure if it helps - I ran across it when searching about the Truma "Fensterkontakt" about I heard in context of somebody being able to use it):

Die Heizung im WoMo ist schon ein schönes Gerät, zumal es schön warm macht und zusätzlich bei unserer auch das warme Wasser liefert. Per Truma-Bedienpanel kann ja alles geschaltet werden incl. Klimaanlage (hierfür haben wir eine Fernbedienung), leider fehlt eine Steuerung per Handy-APP, um die ganze Sache bedienerfreundlicher zu machen. Um die Heizung APP-Steuerbar zu machen, wird die INET-Box des Herstellers benötigt, die sehr teuer ist, eine SIM-Karte benötigt und aus veralteter Technik besteht. In Zeiten von Internet, WLAN und Smartphone sollte doch etwas schickeres und zumindest günstigeres möglich sein. Da ich soviel Geld nicht ausgeben will und bei mir Beruf und Hobby zusammenfallen, habe ich eine einfache Steuerung der Heizung gebaut.

Folgende Steuerungen sind möglich:

1. Im ausgeschalteten Zustand läuft die Heizung ganz normal wie immer.
2. Wird das Modul eingeschaltet, übernimmt das Modul die Steuerung und gaukelt der Truma-Heizung
einen Sensor vor.
3. Wird der manuelle Modus aktiviert, läuft bis zum Auschalten die Heizung mit einer vorgegebenen
Temperatur.
4. Wird der Zeitschaltmodus aktiviert, läuft die Heizung in einen Tages- und Nachtmodus mit ein-
stellbaren Uhrzeiten und Temperaturen.

Zusätzlich kann ein Logging der Uhrzeiten und Temperaturen vorgenommen werden. Das Logging erfolgt auf eine SD-Karte.

IMG_20210324_184552

08-ESP8266-Truma-Hugo-SDCARD

The images are in the original post. I can remove them if somebody has concerns about them pasted here. Source of quoted post and images: https://www.reisemobiltreff.de/viewtopic.php?p=44275

7wells commented 1 year ago

Then somebody asks/comments (in the same forum thread):

Wie und wo muß was angeschlossen werden? Welche Platinenversion? Ich steuer die Zeizung über Fensterkontakt und Zeitschaltuhrkontakt, Sonoff/Evelink.

Answer (ebenda):

Die Steuerung ist eine reine Eigenentwicklung, auch die Platine.

Was, wie und wo etwas angeschlossen wird, ist im Schaltplan ersichtlich. Die Programmierung eines ESP8266 wird mit der Arduino-IDE durchgeführt. Für die APP wird B4A (Basic for Android, Freeware) benötigt. Soll die APP auf IOS laufen, wird B4I benötigt (Diese Software ist dann kostenpflichtig).

Und natürlich Programmiererfahrung und Erfahrung in der Herstellung von Platinen.

And further:

Man kann die Truma einfach über Sonoff steuern. Truma Fensterkontakt (schwarzes Kabel) und Truma Uhrkontakt 4er Stecker. Über die Schaltkontakt ist die Truma ohne Bedienteil steuerbar. Es muß lediglich die Solltemperatur eingestellt sein. Der Wahlschalter selbst steht auf aus. Trumaplatine-Fensterkontakt (Image from the very same thread linked above)

mc0110 commented 1 year ago

Hi Stan,

I don't understand your comments, but I know the author of this circuit (from the WoMoLin forum).

The solution is a nightmare and I am not sure if the TRUMA will survive this unscathed. With the inetbox2mqtt the TRUMA is completely controllable, my example for HA shows a solution that even allows alternate switching on / changing on the CPplus or in the app. That's where I value that this is completely different from what is proposed here. A bad 2-point control .....

7wells commented 1 year ago

Um, sorry! I quoted them (despite in German), because you wrote you could not open the links. Anyway, I only mentioned them because of the "Fensterkontakt", which was somehow used to trigger something. I thought that this could be useful to trigger an update of the ESP32. My apologies that this was long-winded and confusing from my end.

7wells commented 1 year ago

Hi Magnus, I hope you enjoyed peaceful Christmas holidays!

If this thread here is no longer of relevance, please feel free to close it. And if you think that there was maybe a misunderstanding, because I was confusing, please let me know.