logo elektroda
logo elektroda
X
logo elektroda

ESP8266, secrets.h library: Usage, data storage, WiFi connection and ThingSpeak

TDA2593 945 7
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 20599742
    TDA2593
    Level 9  
    Hello.
    Unfortunately I don't know how to deal with the library "secrets.h"?

    As far as I know "Secrets.h" is not a standard library in Arduino and I guess it can't be "normally" downloaded, installed. It allows to store confidential data in a special file.

    How to deal with it? How does it work.
    Can it be uncommented? Because I did, but I can't connect to the router.

    Here's the code and the page I'm using.

    https://makerslab.dev/kurs-esp-przesylanie-danych-do-chmury


    Code: Arduino
    Log in, to see the code


    Greetings.
    Do you have a problem with Arduino? Ask question. Visit our forum Arduino.
  • ADVERTISEMENT
  • #2 20599804
    JacekCz
    Level 42  
    Firstly, rarely is "xxxx.h" a library, even if all the holy arduino people say so.

    Secondly, if you ask a question and are genuinely interested in progressing in the thread, then paste the content, "something will be said".
  • ADVERTISEMENT
  • Helpful post
    #3 20599844
    gps79
    Level 36  
    If you're referring to this file (I'm guessing)
    https://github.com/mathworks/thingspeak-ardui...les/ArduinoMKR1000/WriteSingleField/secrets.h
    then you don't need it for anything, because you've revealed the "secret" data in the file you've attached.
    I recommend removing the #include "secrets.h" line from your code. You will not lose anything on the functionality of your program.
  • #4 20599932
    JacekCz
    Level 42  
    gps79 wrote:



    Sorry ...
    It's really Captain Kloss wouldn't be embarrassed ...

    If you guessed, and you probably did, I support the recommendation.

    Sorry, but the level of quality of the programming patterns that are communicated in the Arduino ...
  • #5 20601017
    TDA2593
    Level 9  
    Hi.

    Factually, I only needed to uncomment "secrets.h" in 2 places in the code.
    I did this earlier (as I wrote in the post), only I connected ESP to a router in the 5GHz band (similar network names) and that's where my problem arose.

    But how to correctly use and utilise this library I would be happy to learn.

    Greetings.
  • ADVERTISEMENT
  • #6 20601040
    gps79
    Level 36  
    Colleague @JacekCz in #2 asked for the contents of the file. We don't know what is in it. secrets.h is not a standard header. You haven't confirmed my assumption either. Let's not continue playing blind shooting.
  • ADVERTISEMENT
  • #7 20601190
    jvoytech
    Level 21  
    JacekCz wrote:
    First of all, rarely is "xxxx.h" a library, even if all the holy arduino people say so.

    A library can be a header and it is not that rare. There is nothing stopping you from putting everything into the file "xxxx.h" and including this file in your own project. You just need to use the appropriate macro instructions so that you don't have the problem of redefinitions.

    TDA2593 wrote:
    As far as I know "Secrets.h" is not a standard library in Arduino and I don't think it can be "normally" downloaded, installed. It allows to store confidential data in a special file.

    How to deal with it? How does it work
    Can it be uncommented? Because I did, but I can't connect to the router.

    The "secret.h" file is not a library but has a project configuration function implemented in a rather twisted and incorrect way. Generally such things are not placed in a repository and this file should be generated usually from the "secret.h.in" file where the placeholders are located. Such an example using cmake where from the file "config.h.in" with the following contents:
    Code: C / C++
    Log in, to see the code


    the file "config.h" is generated:
    Code: Objective-C
    Log in, to see the code

    This happens when using "cmake" for the first time and the name of this configuration file "config.h", should be found in ".gitignore". When using other tools (e.g. "./configure" from Autotools) this pattern "xxx.h.in -> xxx.h" is also used. Configurations could be entered from your finger as a macro when calling gcc, then you do not need to include "secret.h":
    Code: Bash
    Log in, to see the code


    this prevents sensitive data from being placed in the code, but with this way of configuring the project, it is worth ensuring that the compiler provides all the necessary macros, e.g. something like this:
    Code: C / C++
    Log in, to see the code



    The ArduinoIDE is crippled and there is rather no option to generate the appropriate configuration for the project and ask the user for data. That's why in the "examples" for a given library there should be a tutorial on how to create such a file and inform the user not to smoke a fool and put it in the repository.
  • #8 20601237
    JacekCz
    Level 42  
    jvoytech wrote:
    JacekCz wrote:
    First of all, rarely is "xxxx.h" a library, even though all the holy arduino people would say so.

    A library can be a header and this is not that rare. Nothing prevents you from putting everything into the file "xxxx.h" and including this file in your own project. You just need to use the appropriate macro instructions so that you don't have the problem of redefinitions.


    And this is the maximum "security" you can squeeze out of yourself in the Arduino.

    Meanwhile, many libraries (bibliotus, one header) base the file name / main class / variable (oh! a variable in a library, one of the more brilliant ideas) on the main ABC_1234 chip it is trying to support. 1/3 of the trouble here, is the adept combining two "codes" (I love the word "codes" plural) and coming into conflict.
    And such a beautiful C++ "security" as namespace is unknown to prominent arduino programmers, devil vs holy water.

    Following this is the common patient talk of library name as header file name, no author name, no github link, nothing, "no distinction in reasoning". *).
    I definitely think so, people are as weak as the content they are fed. When you unreflectively copy random search results, you don't know where you're copying from.

    *) https://www.elektroda.pl/rtvforum/topic3407648.html#16885936

    Added after 15 [minutes]:


    jvoytech wrote:
    The ArduinoIDE is crippled and there is unlikely to be an option for

    This is just a minor addition to bad patterns.
    There is no need in the community -> IDE doesn't get the fizz.

Topic summary

The discussion revolves around the usage of the "secrets.h" library in conjunction with the ESP8266 microcontroller for WiFi connectivity and data transmission to ThingSpeak. The user initially struggles with the library, questioning its necessity and functionality. Responses clarify that "secrets.h" is not a standard Arduino library and suggest removing it if the secret data is exposed. The user later identifies that the connection issue stemmed from using a 5GHz WiFi band. The conversation highlights the importance of understanding library configurations and the potential pitfalls of using non-standard libraries in Arduino projects.
Summary generated by the language model.
ADVERTISEMENT