The pubsubclient.h files defines the publish call as:
boolean publish(const char* topic, const char* payload);
boolean publish(const char* topic, const char* payload, boolean retained);
If I call it with:
client.publish("mytopic", "0")
I get a warning:
C++ forbids converting a string constant to 'char*'
Short of sifting the code to define a 0 and 1 as chars, such as
const char ON = "1";
const char OFF = "0";
Then amending the calls to be:
client.publish("mytopic", OFF)
I am not certain how to remove the warning as the "0" or "1" are not variables, but simple values. Perhaps I am missing some point.