mirror of
https://github.com/KinDR007/VictronMPPT-ESPHOME.git
synced 2024-10-21 07:09:27 +00:00
Merge pull request #79 from syssi/add-fwe-support
This commit is contained in:
commit
a0f5353d40
@ -15,6 +15,7 @@ CONF_WARNING = "warning"
|
||||
CONF_TRACKING_MODE = "tracking_mode"
|
||||
CONF_DEVICE_MODE = "device_mode"
|
||||
CONF_FIRMWARE_VERSION = "firmware_version"
|
||||
CONF_FIRMWARE_VERSION_24BIT = "firmware_version_24bit"
|
||||
CONF_DEVICE_TYPE = "device_type"
|
||||
CONF_SERIAL_NUMBER = "serial_number"
|
||||
|
||||
@ -29,6 +30,7 @@ TEXT_SENSORS = [
|
||||
CONF_TRACKING_MODE,
|
||||
CONF_DEVICE_MODE,
|
||||
CONF_FIRMWARE_VERSION,
|
||||
CONF_FIRMWARE_VERSION_24BIT,
|
||||
CONF_DEVICE_TYPE,
|
||||
CONF_SERIAL_NUMBER,
|
||||
#
|
||||
@ -59,6 +61,9 @@ CONFIG_SCHEMA = cv.Schema(
|
||||
cv.Optional(CONF_FIRMWARE_VERSION): text_sensor.TEXT_SENSOR_SCHEMA.extend(
|
||||
{cv.GenerateID(): cv.declare_id(text_sensor.TextSensor)}
|
||||
),
|
||||
cv.Optional(CONF_FIRMWARE_VERSION_24BIT): text_sensor.TEXT_SENSOR_SCHEMA.extend(
|
||||
{cv.GenerateID(): cv.declare_id(text_sensor.TextSensor)}
|
||||
),
|
||||
cv.Optional(CONF_DEVICE_TYPE): text_sensor.TEXT_SENSOR_SCHEMA.extend(
|
||||
{cv.GenerateID(): cv.declare_id(text_sensor.TextSensor)}
|
||||
),
|
||||
|
@ -7,7 +7,7 @@ namespace victron {
|
||||
|
||||
static const char *const TAG = "victron";
|
||||
|
||||
void VictronComponent::dump_config() {
|
||||
void VictronComponent::dump_config() { // NOLINT(google-readability-function-size,readability-function-size)
|
||||
ESP_LOGCONFIG(TAG, "Victron:");
|
||||
LOG_BINARY_SENSOR(" ", "Load state", load_state_binary_sensor_);
|
||||
LOG_BINARY_SENSOR(" ", "Relay state", relay_state_binary_sensor_);
|
||||
@ -39,6 +39,7 @@ void VictronComponent::dump_config() {
|
||||
LOG_TEXT_SENSOR(" ", "Tracking Mode", tracking_mode_text_sensor_);
|
||||
LOG_TEXT_SENSOR(" ", "Device Mode", device_mode_text_sensor_);
|
||||
LOG_TEXT_SENSOR(" ", "Firmware Version", firmware_version_text_sensor_);
|
||||
LOG_TEXT_SENSOR(" ", "Firmware Version 24bit", firmware_version_24bit_text_sensor_);
|
||||
LOG_TEXT_SENSOR(" ", "Device Type", device_type_text_sensor_);
|
||||
|
||||
LOG_SENSOR(" ", "Battery Temperature ", battery_temperature_sensor_);
|
||||
@ -849,7 +850,10 @@ void VictronComponent::handle_value_() {
|
||||
return;
|
||||
}
|
||||
|
||||
// @TODO: "FWE" Firmware version (24 bit)
|
||||
if (label_ == "FWE") {
|
||||
this->publish_state_once_(firmware_version_24bit_text_sensor_, value_);
|
||||
return;
|
||||
}
|
||||
|
||||
if (label_ == "PID") {
|
||||
this->publish_state_once_(device_type_text_sensor_, device_type_text(strtol(value_.c_str(), nullptr, 0)));
|
||||
|
@ -98,6 +98,9 @@ class VictronComponent : public uart::UARTDevice, public Component {
|
||||
void set_firmware_version_text_sensor(text_sensor::TextSensor *firmware_version_text_sensor) {
|
||||
firmware_version_text_sensor_ = firmware_version_text_sensor;
|
||||
}
|
||||
void set_firmware_version_24bit_text_sensor(text_sensor::TextSensor *firmware_version_24bit_text_sensor) {
|
||||
firmware_version_24bit_text_sensor_ = firmware_version_24bit_text_sensor;
|
||||
}
|
||||
void set_device_type_text_sensor(text_sensor::TextSensor *device_type_text_sensor) {
|
||||
device_type_text_sensor_ = device_type_text_sensor;
|
||||
}
|
||||
@ -233,6 +236,7 @@ class VictronComponent : public uart::UARTDevice, public Component {
|
||||
text_sensor::TextSensor *tracking_mode_text_sensor_{nullptr};
|
||||
text_sensor::TextSensor *device_mode_text_sensor_{nullptr};
|
||||
text_sensor::TextSensor *firmware_version_text_sensor_{nullptr};
|
||||
text_sensor::TextSensor *firmware_version_24bit_text_sensor_{nullptr};
|
||||
text_sensor::TextSensor *device_type_text_sensor_{nullptr};
|
||||
text_sensor::TextSensor *serial_number_text_sensor_{nullptr};
|
||||
|
||||
|
@ -79,7 +79,8 @@ text_sensor:
|
||||
name: "${name} device type"
|
||||
serial_number:
|
||||
name: "${name} serial number"
|
||||
# TODO: FWE
|
||||
firmware_version_24bit:
|
||||
name: "${name} firmware version 24bit"
|
||||
charging_mode:
|
||||
name: "${name} charging mode"
|
||||
error:
|
||||
|
Loading…
Reference in New Issue
Block a user