SensESP / VEDirect

Victron Energy VE.Direct protocol input parser for SensESP
Apache License 2.0
5 stars 1 forks source link

transform state of charge #3

Open mat214 opened 1 year ago

mat214 commented 1 year ago

Thank you for this library. I'm new to esp32. I'm trying to build a battery monitor with a shunt.

First I try to communicate my mppt with my esp. It's done thanks to your library.

However, I don't understand how to modify the state of charge output to have the text indication in signalk.

Here's what I tried to do but it doesn't work... I admit I don't quite understand how to create functions/transform classes.


 vedi->parser.data.state_of_operation.connect_to(new socstring).connect_to(new SKOutputString(
      "electrical.solar." SOLAR_CHARGE_CONTROLLER_ID ".state_of_operation",
      "/Signal K/Solar Charger " SOLAR_CHARGE_CONTROLLER_ID " state of operation"));

[...]

class socstring: public Transform<int, String> {
 public:
 String trad(int soc) {
        switch( soc ) {
              case 0:
                  return "Off";
              case 2:
                return "Fault";
              case 3:
                  return "Bulk";
              case 5:
                  return "Float";
              case 6:
                  return "Equalize  (manual)";
              case 245:
                  return "Starting-up";
              case 247:
                  return "Auto equalize / Recondition";
              case 252:
                  return "External Control";
              default:
                  return "NA";
          }
        };

};
mat214 commented 1 year ago

I managed to move forward and better understood the sensESP framework

Thanks to your library I was able to carry out my colometer project: https://github.com/mat214/sensCoulo