Modbusmaster works fine with RS485 on a Esp32.
Have a look for the tip and tricks: http://evertdekker.com/?p=1307
You have to set the fucntions preTransmission() and postTransmission() correct, see the above sample
Payload is a pointer to the payload, by using the variable again will be overwritten try something like this. char *mypayload = payload; if (strcmp(topic, Blinds_Topic) == 0) { setRelay(payload); mqttClient.publish(Blinds_Feedback_Topic, 1, false, mypayload); Serial.println("Publishing Feedback");
Keep in mind that the asc712 works on 5V and the Esp32 on 3.3V So if you feeding the sensor with 5V you have to reduce the output to the 3.3V scale with a voltage divider. What current are you measuring AC, DC? If you want to measure energy consumption please have a look at my blog for the Pzem-016 .