That code only seems to do the job, but the thinger library will not accept a string as a parameter.
The error is:
no matching function for call to ‘ThingerESP8266::ThingerESP8266(const char [9], String, const char [8])’
Only a static char type is accepted .So we need another solution.
Ideally the Thinger library should populate the device name automatically with the Host Name if the parameter is missing.
Thank you…
Edited the first message: the thinger library will not accept a string as a parameter. Only a static char type is accepted .So we need another solution.
That worked perfectly !
Having several devices using directly their Hostname as Thinger device is a feature that permits using the same hex file on many devices without need to recompile if the user and the credentials are shared.
IMHO that should be documented.
At the beginning of the sketch you give the directive: #define DEVICE_NAME WiFi.getHostname()
or of you prefer a fixed name #define DEVICE_NAME “my_fixed_name”
so it works in Thinger, but also on print instructions and on the OTA initalisation.