Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
helgeerbe committed Sep 28, 2023
2 parents ae39232 + 4ee49a6 commit f0a55ea
Show file tree
Hide file tree
Showing 28 changed files with 759 additions and 378 deletions.
25 changes: 25 additions & 0 deletions include/BatteryStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "AsyncJson.h"
#include "Arduino.h"
#include "JkBmsDataPoints.h"
#include "VeDirectShuntController.h"

// mandatory interface for all kinds of batteries
class BatteryStats {
Expand Down Expand Up @@ -98,3 +99,27 @@ class JkBmsBatteryStats : public BatteryStats {
mutable uint32_t _lastMqttPublish = 0;
mutable uint32_t _lastFullMqttPublish = 0;
};

class VictronSmartShuntStats : public BatteryStats {
public:
void getLiveViewData(JsonVariant& root) const final;
void mqttPublish() const final;

void updateFrom(VeDirectShuntController::veShuntStruct const& shuntData);

private:
float _voltage;
float _current;
float _temperature;
uint8_t _chargeCycles;
uint32_t _timeToGo;
float _chargedEnergy;
float _dischargedEnergy;
String _modelName;

bool _alarmLowVoltage;
bool _alarmHighVoltage;
bool _alarmLowSOC;
bool _alarmLowTemperature;
bool _alarmHighTemperature;
};
5 changes: 3 additions & 2 deletions include/MqttHandleVedirect.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

#include "VeDirectFrameHandler.h"
#include "VeDirectMpptController.h"
#include "Configuration.h"
#include <Arduino.h>

Expand All @@ -18,7 +18,8 @@ class MqttHandleVedirectClass {
void init();
void loop();
private:
veStruct _kvFrame{};

VeDirectMpptController::veMpptStruct _kvFrame{};

// point of time in millis() when updated values will be published
uint32_t _nextPublishUpdatesOnly = 0;
Expand Down
2 changes: 1 addition & 1 deletion include/MqttHandleVedirectHass.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#pragma once

#include <ArduinoJson.h>
#include "VeDirectFrameHandler.h"
#include "VeDirectMpptController.h"

class MqttHandleVedirectHassClass {
public:
Expand Down
16 changes: 16 additions & 0 deletions include/VictronSmartShunt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once

#include "Battery.h"

class VictronSmartShunt : public BatteryProvider {
public:
bool init(bool verboseLogging) final;
void deinit() final { }
void loop() final;
std::shared_ptr<BatteryStats> getStats() const final { return _stats; }

private:
std::shared_ptr<VictronSmartShuntStats> _stats =
std::make_shared<VictronSmartShuntStats>();
};
2 changes: 1 addition & 1 deletion include/WebApi_ws_vedirect_live.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "ArduinoJson.h"
#include <ESPAsyncWebServer.h>
#include <VeDirectFrameHandler.h>
#include <VeDirectMpptController.h>

class WebApiWsVedirectLiveClass {
public:
Expand Down
Loading

0 comments on commit f0a55ea

Please sign in to comment.