cmcgerty / Sofar2mqtt

A smart home interface for Sofar solar and battery inverters.
GNU General Public License v3.0
79 stars 45 forks source link

Errors in compile and empty mqtt message #6

Closed cliffdude closed 3 years ago

cliffdude commented 3 years ago

So I have a working module with the old version as you know, I have now built a new one to test the new version that sends all data in the same mqtt message in JSON. Sounds like a good idea to reduce the number of errors and to have all variables update at the same time in HA. Problem is I cannot get any data and I was wondering if the errors in the compile of the code could have caused the problem. This is what I get in the arduino compiler, however mqtt connects and I get some flashing on the RS485. The inverter also keeps the RS485 logo active on the display however as I said the messages are empty just () on topic "deviceid"/state. This is the HYBRID.ino /Users/cliff/Downloads/Sofar2mqtt-main/HYBRID/HYBRID.ino: In function 'void mqttCallback(String, byte*, unsigned int)': /Users/cliff/Downloads/Sofar2mqtt-main/HYBRID/HYBRID.ino:407:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < length; i++) { ^ /Users/cliff/Downloads/Sofar2mqtt-main/HYBRID/HYBRID.ino: In function 'modbusResponce listen()': /Users/cliff/Downloads/Sofar2mqtt-main/HYBRID/HYBRID.ino:671:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] ret.errorMessage = "Valid data frame"; ^ /Users/cliff/Downloads/Sofar2mqtt-main/HYBRID/HYBRID.ino:676:20: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings] ret.errorMessage = "Error: invalid data frame"; ^ /Users/cliff/Downloads/Sofar2mqtt-main/HYBRID/HYBRID.ino:602:10: warning: variable 'inFunctionCode' set but not used [-Wunused-but-set-variable] uint8_t inFunctionCode; ^ /Users/cliff/Downloads/Sofar2mqtt-main/HYBRID/HYBRID.ino: In function 'unsigned int batteryWatts()': /Users/cliff/Downloads/Sofar2mqtt-main/HYBRID/HYBRID.ino:815:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ Keep up the great work!

cmcgerty commented 3 years ago

Hi.

Those compiler warning are not an issue and the fact that it is connected shows it obviously compiled and installed ok. I would be inclined to check the wiring on your new ttl converter. Better yet, install the update to the existing, known good unit. You can always go back to the previous code if you prefer.