ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
systa_bus_sensor.cpp
Go to the documentation of this file.
1#include "systa_bus_sensor.h"
3#include "esphome/core/log.h"
4
6
7ESPHOME_LOG_TAG(TAG, "systa_bus.sensor");
8
9static int16_t get_i16be(std::span<const uint8_t> message, size_t start) {
10 return static_cast<int16_t>(encode_uint16(message[start], message[start + 1]));
11}
12
14 ESP_LOGCONFIG(TAG, "SystaSolar Aqua:");
15 LOG_SENSOR(" ", "Temperature TSA", this->temperature_tsa_sensor_);
16 LOG_SENSOR(" ", "Temperature TSE", this->temperature_tse_sensor_);
17 LOG_SENSOR(" ", "Temperature TWU", this->temperature_twu_sensor_);
18 LOG_SENSOR(" ", "Temperature TW2", this->temperature_tw2_sensor_);
19 LOG_SENSOR(" ", "Pump Speed", this->pump_speed_sensor_);
20}
21
22void SystaSolarAquaSensor::handle_message(std::span<const uint8_t> message) {
23 if (get_message_type(message) != MESSAGE_TYPE_AQUA_SENSOR_DATA)
24 return;
25 if (this->temperature_tsa_sensor_ != nullptr)
26 this->temperature_tsa_sensor_->publish_state(get_i16be(message, 4) * 0.1f);
27 if (this->temperature_tse_sensor_ != nullptr)
28 this->temperature_tse_sensor_->publish_state(get_i16be(message, 6) * 0.1f);
29 if (this->temperature_twu_sensor_ != nullptr)
30 this->temperature_twu_sensor_->publish_state(get_i16be(message, 8) * 0.1f);
31 if (this->temperature_tw2_sensor_ != nullptr)
32 this->temperature_tw2_sensor_->publish_state(get_i16be(message, 10) * 0.1f);
33 if (this->pump_speed_sensor_ != nullptr)
34 this->pump_speed_sensor_->publish_state(message[12]);
35}
36
37} // namespace esphome::systa_bus
virtual void dump_config()
const LogString * message
Definition component.cpp:35
uint16_t get_message_type(std::span< const uint8_t > message)
Definition systa_bus.h:24
ESPHOME_LOG_TAG(TAG, "systa_bus.sensor")
constexpr uint16_t encode_uint16(uint8_t msb, uint8_t lsb)
Encode a 16-bit value given the most and least significant byte.
Definition helpers.h:980