78 lines
2.6 KiB
C++
78 lines
2.6 KiB
C++
#ifndef __SOLAR_CBF_STHOME_H // include GUARD
|
|
#define __SOLAR_CBF_STHOME_H
|
|
#include "esphome.h"
|
|
#include <utility>
|
|
#include "common.h"
|
|
#include "cb_frame.h"
|
|
using namespace esphome;
|
|
|
|
namespace solar
|
|
{
|
|
|
|
class cbf_sthome : virtual public cb_frame {
|
|
private:
|
|
// float _get_battery_charge_voltage_limit() const;
|
|
|
|
public:
|
|
// STHOME publish spec
|
|
// This is used to determine when to publish the sthome data
|
|
static const publish_spec_t publish_spec; // default publish spec for sthome messages
|
|
static const publish_spec_t rtr_publish_spec; // for remote transmission requests
|
|
|
|
enum geyser_modes : int {
|
|
GM_SUNDAY,
|
|
GM_WORKDAY,
|
|
GM_SATURDAY,
|
|
GM_PUBLIC_HOLIDAY,
|
|
GM_SCHOOL_HOLIDAY,
|
|
};
|
|
enum canbus_ids : int {
|
|
CB_CANBUS_ID01 = 0x501,
|
|
CB_CANBUS_ID02,
|
|
CB_CANBUS_ID03,
|
|
CB_CANBUS_ID04,
|
|
CB_CANBUS_ID05,
|
|
CB_CANBUS_ID06,
|
|
CB_CANBUS_ID07,
|
|
CB_CANBUS_ID08,
|
|
CB_CANBUS_ID09,
|
|
CB_CANBUS_ID10,
|
|
CB_POWER_MAINS = 0x401,
|
|
CB_POWER_INVERTER,
|
|
CB_POWER_PLUGS,
|
|
CB_POWER_LIGHTS,
|
|
CB_POWER_GEYSER,
|
|
CB_POWER_POOL,
|
|
CB_POWER_GENERATED,
|
|
CB_ENERGY_MAINS,
|
|
CB_ENERGY_GEYSER,
|
|
CB_ENERGY_POOL,
|
|
CB_ENERGY_PLUGS,
|
|
CB_ENERGY_LIGHTS,
|
|
CB_ENERGY_HOUSE,
|
|
CB_ENERGY_GENERATED,
|
|
CB_ENERGY_LOSS,
|
|
CB_CONTROLLER_STATES,
|
|
CB_GEYSER_TEMPERATURE_TOP,
|
|
CB_GEYSER_TEMPERATURE_BOTTOM,
|
|
CB_GEYSER_TEMPERATURE_AMBIENT,
|
|
CB_GEYSER_HEATING,
|
|
CB_GEYSER_ACTIVE_SCHEDULE,
|
|
};
|
|
|
|
//Property<int, cbf_sthome> battery_charge_voltage_limit {this, &cbf_sthome::_set_battery_charge_voltage_limit, &cbf_sthome::_get_battery_charge_voltage_limit };
|
|
//Property<float, cbf_sthome> battery_charge_voltage_limit {this, &cbf_sthome::_get_battery_charge_voltage_limit};
|
|
static const std::string heartbeat;
|
|
|
|
cbf_sthome() = default;
|
|
cbf_sthome(int msg_id, uint32_t can_id, const byte_vector& frame, bool rtr);
|
|
void clear();
|
|
virtual std::string to_string() const override;
|
|
cbf_sthome& operator=(cbf_sthome&& src); // required due to double inheritance in cbf_store_pylon
|
|
// using default (compiler auto generated) copy and move constructors and assignment operators
|
|
virtual ~cbf_sthome() = default;
|
|
bool verify_heartbeat() const;
|
|
};
|
|
|
|
} // namespace solar
|
|
#endif // __SOLAR_CBF_STHOME_H
|