0

I'm using an ESP8266, to create certain tasks ( triggers from MQTT, or a physical button).I'm trying to create a log of events, store it (SPIFFS or SD) and retrieve it back( perhaps using MQTT ), on demand (and not at the moment it occurs). log structure should be formatted as: "EVENT #1- time: XX:XX:XX, description"

My question is not about how to read or write a file, but how to create such log, and especially - how to retrieve it back for displaying.

Guy

  • This page outlines very clearly how to use the filesystem, create, write to and read from files on the ESP8266. You probably need NTP or an RTC set up to keep the time for your log entries. How you would retrieve it is up to you. You can use mqtt, http, the serial port, an SD card... I don’t know your requirements. – StarCat May 16 at 7:24
  • I have no problem creating the text, time or saving the file- or how to send the information, the question is more about how to create the log, and how to read it as log entries – Guy . D May 16 at 7:31
  • What do you mean with "how to create the log, and how to read it as log entries", do you want automated processing on e.g. the PC or with a tool. You write line to line to the file and as StarCat said how to get is up to you. If you know all the SPIFFS stuff as you say what is the real problem? - The more details you add to your question the more help you will get as no mind readers are around here, although some are near to mind reading ;-) – Codebreaker007 May 16 at 8:54
  • @Codebreaker007 - well for those who aren"t :) ( probably my poor English skill to explain well )- I'm not looking for any tool outside ESP8266, but I wish to create a file ( store data and access it ) as if I use an array, meaning - read the file, and identify each chunk of data store, as an event ( as if it was store in 2D array ), now loop over those entries - and send it ( for example MQTT each event ). – Guy . D May 16 at 8:59
  • 1
    I have a separate array of events stored in EEPROM (last occurence) and an optional log file with timestamped events stored on SD card. They are displayed on web page too. – Juraj May 16 at 9:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.