#ifndef __SOLAR_CBF_PYLON // include GUARD #define __SOLAR_CBF_PYLON #include "esphome.h" #include #include "common.h" #include "cb_frame.h" using namespace esphome; namespace solar { class cbf_pylon : virtual public cb_frame { public: // Pylontech battery CAN IDs // All unverified IDs are taken from the Pylontech CAN protocol documentation // https://domosimple.eu/en/documentation/manuels/pylontech-can-bus-protocole // VERIFIED IDs have been confirmed by capturing actual CAN bus traffic from a Pylontech battery static const int CB_BATTERY_LIMITS = 0x351; // VERIFIED: Pylontech battery max charging/discharging values message static const int CB_BATTERY_SETTING2 = 0x352; // used for Pylontech batteries static const int CB_BATTERY_SETTING3 = 0x353; // used for Pylontech batteries static const int CB_BATTERY_SETTING4 = 0x354; // used for Pylontech batteries static const int CB_BATTERY_STATE = 0x355; // VERIFIED: Pylontech battery state message static const int CB_BATTERY_STATUS = 0x356; // VERIFIED: Pylontech battery status message static const int CB_BATTERY_ERROR = 0x357; static const int CB_BATTERY_WARNING = 0x358; static const int CB_BATTERY_FAULT = 0x359; // VERIFIED: Pylontech battery fault message static const int CB_BATTERY_REQUEST = 0x35A; static const int CB_BATTERY_RESPONSE = 0x35B; static const int CB_BATTERY_REQUEST_FLAGS = 0x35C; // VERIFIED: Pylontech battery request flag message static const int CB_BATTERY_MANUFACTURER_ID = 0x35D; static const int CB_BATTERY_MODEL_ID = 0x35E; static const int CB_BATTERY_MANUFACTURER = 0x35E; // VERIFIED: Pylontech battery manufacturer message static const int CB_BATTERY_MODEL = 0x35D; static const int CB_BATTERY_SERIAL_NUMBER = 0x35F; static const int CB_BATTERY_VERSION = 0x360; static const int CB_BATTERY_CAPACITY = 0x361; static const int CB_BATTERY_TEMPERATURE = 0x362; static const int CB_BATTERY_VOLTAGE = 0x363; static const int CB_BATTERY_CURRENT = 0x364; static const int CB_BATTERY_SOC = 0x365; static const int CB_BATTERY_SOH = 0x366; static const int CB_BATTERY_CHARGE_POWER = 0x367; static const int CB_BATTERY_DISCHARGE_POWER = 0x368; static const int CB_BATTERY_CHARGE_ENERGY = 0x369; static const int CB_BATTERY_DISCHARGE_ENERGY = 0x36A; static const int CB_BATTERY_CHARGE_CYCLES = 0x36B; static const int CB_BATTERY_CHARGE_LIMIT = 0x36C; static const int CB_BATTERY_DISCHARGE_LIMIT = 0x36D; static const int CB_BATTERY_CHARGE_MODE = 0x36E; static const int CB_BATTERY_DISCHARGE_MODE = 0x36F; static const int CB_BATTERY_CHARGE_STATUS = 0x370; static const int CB_BATTERY_DISCHARGE_STATUS = 0x371; static const int CB_BATTERY_CHARGE_CYCLE_COUNT = 0x372; static const int CB_BATTERY_CHARGE_CYCLE_LIMIT = 0x373; static const int CB_BATTERY_CHARGE_CYCLE_STATUS = 0x374; static const int CB_BATTERY_CHARGE_CYCLE_MODE = 0x375; static const int CB_BATTERY_CHARGE_CYCLE_LIMIT_STATUS = 0x376; static const int CB_BATTERY_CHARGE_CYCLE_MODE_STATUS = 0x377; static const int CB_BATTERY_CHARGE_CYCLE_LIMIT_MODE = 0x378; static const int CB_BATTERY_CHARGE_CYCLE_LIMIT_MODE_STATUS = 0x379; static const int CB_BATTERY_CHARGE_CYCLE_LIMIT_MODE_STATUS2 = 0x37A; static const int CB_BATTERY_CHARGE_CYCLE_LIMIT_MODE_STATUS3 = 0x37B; static const int CB_BATTERY_CHARGE_CYCLE_LIMIT_MODE_STATUS4 = 0x37C; static const int CB_BATTERY_CHARGE_CYCLE_LIMIT_MODE_STATUS5 = 0x37D; static const int CB_BATTERY_CHARGE_CYCLE_LIMIT_MODE_STATUS6 = 0x37E; static const int CB_BATTERY_CHARGE_CYCLE_LIMIT_MODE_STATUS7 = 0x37F; // Pylontech battery publish spec // This is used to determine when to publish the battery data static const publish_spec_t publish_spec; cbf_pylon() = default; void clear(); std::string to_string() const override; cbf_pylon& operator=(cbf_pylon&& src); // required due to double inheritance in cbf_store_pylon // using default (compiler auto generated) copy and move constructors and assignment operators }; } // namespace solar #endif // __SOLAR_CBF_PYLON