esphome 2024.8.3__py3-none-any.whl → 2024.9.0b1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- esphome/__main__.py +6 -2
- esphome/components/api/api_connection.cpp +19 -0
- esphome/components/api/api_connection.h +1 -0
- esphome/components/api/api_pb2.cpp +136 -0
- esphome/components/api/api_pb2.h +43 -0
- esphome/components/api/api_pb2_service.cpp +21 -0
- esphome/components/api/api_pb2_service.h +6 -0
- esphome/components/async_tcp/__init__.py +3 -3
- esphome/components/atm90e26/sensor.py +10 -10
- esphome/components/atm90e32/sensor.py +1 -1
- esphome/components/bl0906/__init__.py +1 -0
- esphome/components/bl0906/bl0906.cpp +238 -0
- esphome/components/bl0906/bl0906.h +96 -0
- esphome/components/bl0906/const.py +4 -0
- esphome/components/bl0906/constants.h +122 -0
- esphome/components/bl0906/sensor.py +184 -0
- esphome/components/bl0942/__init__.py +1 -1
- esphome/components/bl0942/bl0942.cpp +127 -34
- esphome/components/bl0942/bl0942.h +87 -3
- esphome/components/bl0942/sensor.py +46 -8
- esphome/components/ble_client/__init__.py +1 -3
- esphome/components/bluetooth_proxy/bluetooth_proxy.cpp +5 -0
- esphome/components/bmp280/sensor.py +2 -93
- esphome/components/bmp280_base/__init__.py +88 -0
- esphome/components/{bmp280/bmp280.cpp → bmp280_base/bmp280_base.cpp} +11 -4
- esphome/components/{bmp280/bmp280.h → bmp280_base/bmp280_base.h} +9 -5
- esphome/components/bmp280_i2c/__init__.py +0 -0
- esphome/components/bmp280_i2c/bmp280_i2c.cpp +27 -0
- esphome/components/bmp280_i2c/bmp280_i2c.h +22 -0
- esphome/components/bmp280_i2c/sensor.py +22 -0
- esphome/components/bmp280_spi/__init__.py +0 -0
- esphome/components/bmp280_spi/bmp280_spi.cpp +65 -0
- esphome/components/bmp280_spi/bmp280_spi.h +20 -0
- esphome/components/bmp280_spi/sensor.py +22 -0
- esphome/components/captive_portal/captive_portal.cpp +2 -0
- esphome/components/captive_portal/captive_portal.h +3 -1
- esphome/components/ch422g/__init__.py +67 -0
- esphome/components/ch422g/ch422g.cpp +122 -0
- esphome/components/ch422g/ch422g.h +70 -0
- esphome/components/debug/debug_esp32.cpp +3 -1
- esphome/components/display/__init__.py +5 -4
- esphome/components/dsmr/dsmr.cpp +6 -0
- esphome/components/dsmr/dsmr.h +6 -0
- esphome/components/dsmr/text_sensor.py +7 -2
- esphome/components/e131/e131.cpp +2 -0
- esphome/components/e131/e131.h +3 -1
- esphome/components/e131/e131_addressable_light_effect.cpp +2 -0
- esphome/components/e131/e131_addressable_light_effect.h +2 -1
- esphome/components/e131/e131_packet.cpp +2 -0
- esphome/components/esp32_camera/__init__.py +4 -0
- esphome/components/esp32_camera/esp32_camera.cpp +9 -1
- esphome/components/esp32_camera/esp32_camera.h +3 -0
- esphome/components/esp32_can/canbus.py +18 -7
- esphome/components/esp32_can/esp32_can.cpp +8 -0
- esphome/components/esp32_can/esp32_can.h +4 -0
- esphome/components/esp32_rmt_led_strip/led_strip.cpp +14 -2
- esphome/components/esp32_rmt_led_strip/led_strip.h +3 -2
- esphome/components/esp32_rmt_led_strip/light.py +21 -4
- esphome/components/esphome/ota/ota_esphome.cpp +2 -1
- esphome/components/esphome/ota/ota_esphome.h +2 -0
- esphome/components/font/__init__.py +11 -22
- esphome/components/font/font.cpp +3 -2
- esphome/components/font/font.h +12 -3
- esphome/components/gree/climate.py +2 -1
- esphome/components/gree/gree.cpp +54 -3
- esphome/components/gree/gree.h +10 -2
- esphome/components/gt911/touchscreen/__init__.py +6 -4
- esphome/components/gt911/touchscreen/gt911_touchscreen.cpp +17 -0
- esphome/components/gt911/touchscreen/gt911_touchscreen.h +2 -0
- esphome/components/hmac_md5/__init__.py +2 -0
- esphome/components/hmac_md5/hmac_md5.cpp +56 -0
- esphome/components/hmac_md5/hmac_md5.h +48 -0
- esphome/components/homeassistant/__init__.py +13 -0
- esphome/components/homeassistant/switch/__init__.py +15 -2
- esphome/components/homeassistant/switch/homeassistant_switch.cpp +2 -2
- esphome/components/i2s_audio/__init__.py +88 -9
- esphome/components/i2s_audio/i2s_audio.h +20 -2
- esphome/components/i2s_audio/media_player/__init__.py +8 -4
- esphome/components/i2s_audio/media_player/i2s_audio_media_player.h +1 -1
- esphome/components/i2s_audio/microphone/__init__.py +19 -51
- esphome/components/i2s_audio/microphone/i2s_audio_microphone.cpp +18 -15
- esphome/components/i2s_audio/microphone/i2s_audio_microphone.h +0 -12
- esphome/components/i2s_audio/speaker/__init__.py +39 -27
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +49 -37
- esphome/components/i2s_audio/speaker/i2s_audio_speaker.h +3 -4
- esphome/components/ili9xxx/display.py +16 -17
- esphome/components/ili9xxx/ili9xxx_display.cpp +1 -1
- esphome/components/ili9xxx/ili9xxx_display.h +18 -18
- esphome/components/ili9xxx/ili9xxx_init.h +0 -3
- esphome/components/improv_serial/improv_serial_component.cpp +2 -1
- esphome/components/improv_serial/improv_serial_component.h +2 -1
- esphome/components/ledc/ledc_output.cpp +11 -7
- esphome/components/libretiny/__init__.py +8 -13
- esphome/components/ltr501/__init__.py +1 -0
- esphome/components/ltr501/ltr501.cpp +542 -0
- esphome/components/ltr501/ltr501.h +184 -0
- esphome/components/ltr501/ltr_definitions_501.h +260 -0
- esphome/components/ltr501/sensor.py +274 -0
- esphome/components/ltr_als_ps/sensor.py +2 -2
- esphome/components/lvgl/__init__.py +19 -16
- esphome/components/lvgl/automation.py +90 -9
- esphome/components/lvgl/defines.py +29 -2
- esphome/components/lvgl/gradient.py +61 -0
- esphome/components/lvgl/lv_validation.py +45 -27
- esphome/components/lvgl/lvcode.py +8 -3
- esphome/components/lvgl/lvgl_esphome.cpp +54 -0
- esphome/components/lvgl/lvgl_esphome.h +9 -3
- esphome/components/lvgl/number/__init__.py +1 -0
- esphome/components/lvgl/number/lvgl_number.h +3 -1
- esphome/components/lvgl/schemas.py +16 -11
- esphome/components/lvgl/select/__init__.py +1 -0
- esphome/components/lvgl/select/lvgl_select.h +3 -1
- esphome/components/lvgl/switch/__init__.py +2 -1
- esphome/components/lvgl/switch/lvgl_switch.h +3 -1
- esphome/components/lvgl/text/__init__.py +1 -0
- esphome/components/lvgl/text/lvgl_text.h +3 -1
- esphome/components/lvgl/trigger.py +3 -2
- esphome/components/lvgl/types.py +2 -1
- esphome/components/lvgl/widgets/__init__.py +23 -8
- esphome/components/lvgl/widgets/arc.py +5 -1
- esphome/components/lvgl/widgets/buttonmatrix.py +5 -1
- esphome/components/lvgl/widgets/checkbox.py +8 -3
- esphome/components/lvgl/widgets/meter.py +8 -1
- esphome/components/lvgl/widgets/msgbox.py +26 -15
- esphome/components/lvgl/widgets/page.py +51 -7
- esphome/components/lvgl/widgets/tileview.py +2 -8
- esphome/components/max31856/max31856.cpp +12 -1
- esphome/components/max31856/max31856.h +5 -2
- esphome/components/max31856/sensor.py +20 -0
- esphome/components/mcp9600/sensor.py +2 -2
- esphome/components/mdns/__init__.py +6 -6
- esphome/components/media_player/media_player.h +15 -0
- esphome/components/micro_wake_word/__init__.py +2 -25
- esphome/components/microphone/microphone.h +1 -1
- esphome/components/mics_4514/mics_4514.cpp +26 -36
- esphome/components/modbus_controller/__init__.py +6 -0
- esphome/components/modbus_controller/const.py +2 -0
- esphome/components/modbus_controller/modbus_controller.cpp +30 -27
- esphome/components/modbus_controller/modbus_controller.h +22 -4
- esphome/components/network/__init__.py +11 -8
- esphome/components/pipsolar/pipsolar.cpp +3 -0
- esphome/components/pipsolar/pipsolar.h +1 -0
- esphome/components/pipsolar/switch/__init__.py +2 -0
- esphome/components/prometheus/prometheus_handler.cpp +2 -0
- esphome/components/prometheus/prometheus_handler.h +3 -1
- esphome/components/rp2040/__init__.py +7 -8
- esphome/components/rpi_dpi_rgb/display.py +20 -17
- esphome/components/rpi_dpi_rgb/rpi_dpi_rgb.cpp +36 -6
- esphome/components/rpi_dpi_rgb/rpi_dpi_rgb.h +4 -0
- esphome/components/socket/socket.cpp +2 -0
- esphome/components/socket/socket.h +2 -0
- esphome/components/speaker/speaker.h +1 -1
- esphome/components/st7701s/display.py +35 -37
- esphome/components/st7701s/st7701s.cpp +11 -6
- esphome/components/st7701s/st7701s.h +1 -0
- esphome/components/statsd/__init__.py +65 -0
- esphome/components/statsd/statsd.cpp +156 -0
- esphome/components/statsd/statsd.h +86 -0
- esphome/components/tuya/__init__.py +1 -0
- esphome/components/tuya/number/__init__.py +39 -2
- esphome/components/tuya/number/tuya_number.cpp +58 -2
- esphome/components/tuya/number/tuya_number.h +12 -3
- esphome/components/udp/__init__.py +158 -0
- esphome/components/udp/binary_sensor.py +27 -0
- esphome/components/udp/sensor.py +27 -0
- esphome/components/udp/udp_component.cpp +616 -0
- esphome/components/udp/udp_component.h +158 -0
- esphome/components/uponor_smatrix/uponor_smatrix.cpp +4 -6
- esphome/components/uponor_smatrix/uponor_smatrix.h +0 -1
- esphome/components/veml7700/sensor.py +2 -2
- esphome/components/voice_assistant/__init__.py +6 -0
- esphome/components/voice_assistant/voice_assistant.cpp +23 -1
- esphome/components/voice_assistant/voice_assistant.h +4 -0
- esphome/components/web_server/__init__.py +11 -11
- esphome/components/web_server/list_entities.cpp +2 -0
- esphome/components/web_server/list_entities.h +3 -1
- esphome/components/web_server/web_server.cpp +2 -1
- esphome/components/web_server/web_server.h +2 -0
- esphome/components/web_server_base/web_server_base.cpp +2 -0
- esphome/components/web_server_base/web_server_base.h +3 -1
- esphome/components/wifi/wifi_component_libretiny.cpp +15 -1
- esphome/components/wireguard/__init__.py +9 -6
- esphome/components/wireguard/wireguard.cpp +2 -1
- esphome/components/wireguard/wireguard.h +3 -1
- esphome/config_validation.py +8 -0
- esphome/const.py +8 -1
- esphome/core/bytebuffer.cpp +117 -84
- esphome/core/bytebuffer.h +69 -21
- esphome/core/defines.h +2 -0
- esphome/core/ring_buffer.cpp +13 -2
- esphome/core/ring_buffer.h +56 -0
- esphome/external_files.py +5 -3
- {esphome-2024.8.3.dist-info → esphome-2024.9.0b1.dist-info}/METADATA +1 -1
- {esphome-2024.8.3.dist-info → esphome-2024.9.0b1.dist-info}/RECORD +198 -163
- {esphome-2024.8.3.dist-info → esphome-2024.9.0b1.dist-info}/LICENSE +0 -0
- {esphome-2024.8.3.dist-info → esphome-2024.9.0b1.dist-info}/WHEEL +0 -0
- {esphome-2024.8.3.dist-info → esphome-2024.9.0b1.dist-info}/entry_points.txt +0 -0
- {esphome-2024.8.3.dist-info → esphome-2024.9.0b1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,96 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include "esphome/components/sensor/sensor.h"
|
4
|
+
#include "esphome/components/uart/uart.h"
|
5
|
+
#include "esphome/core/automation.h"
|
6
|
+
#include "esphome/core/component.h"
|
7
|
+
#include "esphome/core/datatypes.h"
|
8
|
+
|
9
|
+
// https://www.belling.com.cn/media/file_object/bel_product/BL0906/datasheet/BL0906_V1.02_cn.pdf
|
10
|
+
// https://www.belling.com.cn/media/file_object/bel_product/BL0906/guide/BL0906%20APP%20Note_V1.02.pdf
|
11
|
+
|
12
|
+
namespace esphome {
|
13
|
+
namespace bl0906 {
|
14
|
+
|
15
|
+
struct DataPacket { // NOLINT(altera-struct-pack-align)
|
16
|
+
uint8_t l{0};
|
17
|
+
uint8_t m{0};
|
18
|
+
uint8_t h{0};
|
19
|
+
uint8_t checksum; // checksum
|
20
|
+
uint8_t address;
|
21
|
+
} __attribute__((packed));
|
22
|
+
|
23
|
+
struct ube24_t { // NOLINT(readability-identifier-naming,altera-struct-pack-align)
|
24
|
+
uint8_t l{0};
|
25
|
+
uint8_t m{0};
|
26
|
+
uint8_t h{0};
|
27
|
+
} __attribute__((packed));
|
28
|
+
|
29
|
+
struct sbe24_t { // NOLINT(readability-identifier-naming,altera-struct-pack-align)
|
30
|
+
uint8_t l{0};
|
31
|
+
uint8_t m{0};
|
32
|
+
int8_t h{0};
|
33
|
+
} __attribute__((packed));
|
34
|
+
|
35
|
+
template<typename... Ts> class ResetEnergyAction;
|
36
|
+
|
37
|
+
class BL0906;
|
38
|
+
|
39
|
+
using ActionCallbackFuncPtr = void (BL0906::*)();
|
40
|
+
|
41
|
+
class BL0906 : public PollingComponent, public uart::UARTDevice {
|
42
|
+
SUB_SENSOR(voltage)
|
43
|
+
SUB_SENSOR(current_1)
|
44
|
+
SUB_SENSOR(current_2)
|
45
|
+
SUB_SENSOR(current_3)
|
46
|
+
SUB_SENSOR(current_4)
|
47
|
+
SUB_SENSOR(current_5)
|
48
|
+
SUB_SENSOR(current_6)
|
49
|
+
SUB_SENSOR(power_1)
|
50
|
+
SUB_SENSOR(power_2)
|
51
|
+
SUB_SENSOR(power_3)
|
52
|
+
SUB_SENSOR(power_4)
|
53
|
+
SUB_SENSOR(power_5)
|
54
|
+
SUB_SENSOR(power_6)
|
55
|
+
SUB_SENSOR(total_power)
|
56
|
+
SUB_SENSOR(energy_1)
|
57
|
+
SUB_SENSOR(energy_2)
|
58
|
+
SUB_SENSOR(energy_3)
|
59
|
+
SUB_SENSOR(energy_4)
|
60
|
+
SUB_SENSOR(energy_5)
|
61
|
+
SUB_SENSOR(energy_6)
|
62
|
+
SUB_SENSOR(total_energy)
|
63
|
+
SUB_SENSOR(frequency)
|
64
|
+
SUB_SENSOR(temperature)
|
65
|
+
|
66
|
+
public:
|
67
|
+
void loop() override;
|
68
|
+
|
69
|
+
void update() override;
|
70
|
+
void setup() override;
|
71
|
+
void dump_config() override;
|
72
|
+
|
73
|
+
protected:
|
74
|
+
template<typename... Ts> friend class ResetEnergyAction;
|
75
|
+
|
76
|
+
void reset_energy_();
|
77
|
+
|
78
|
+
void read_data_(uint8_t address, float reference, sensor::Sensor *sensor);
|
79
|
+
|
80
|
+
void bias_correction_(uint8_t address, float measurements, float correction);
|
81
|
+
|
82
|
+
uint8_t current_channel_{0};
|
83
|
+
size_t enqueue_action_(ActionCallbackFuncPtr function);
|
84
|
+
void handle_actions_();
|
85
|
+
|
86
|
+
private:
|
87
|
+
std::vector<ActionCallbackFuncPtr> action_queue_{};
|
88
|
+
};
|
89
|
+
|
90
|
+
template<typename... Ts> class ResetEnergyAction : public Action<Ts...>, public Parented<BL0906> {
|
91
|
+
public:
|
92
|
+
void play(Ts... x) override { this->parent_->enqueue_action_(&BL0906::reset_energy_); }
|
93
|
+
};
|
94
|
+
|
95
|
+
} // namespace bl0906
|
96
|
+
} // namespace esphome
|
@@ -0,0 +1,122 @@
|
|
1
|
+
#pragma once
|
2
|
+
#include <cstdint>
|
3
|
+
|
4
|
+
namespace esphome {
|
5
|
+
namespace bl0906 {
|
6
|
+
|
7
|
+
// Total power conversion
|
8
|
+
static const float BL0906_WATT = 16 * 1.097 * 1.097 * (20000 + 20000 + 20000 + 20000 + 20000) /
|
9
|
+
(40.41259 * ((5.1 + 5.1) * 1000 / 2000) * 1 * 100 * 1 * 1000);
|
10
|
+
// Total Energy conversion
|
11
|
+
static const float BL0906_CF = 16 * 4194304 * 0.032768 * 16 /
|
12
|
+
(3600000 * 16 *
|
13
|
+
(40.4125 * ((5.1 + 5.1) * 1000 / 2000) * 1 * 100 * 1 * 1000 /
|
14
|
+
(1.097 * 1.097 * (20000 + 20000 + 20000 + 20000 + 20000))));
|
15
|
+
// Frequency conversion
|
16
|
+
static const float BL0906_FREF = 10000000;
|
17
|
+
// Temperature conversion
|
18
|
+
static const float BL0906_TREF = 12.5 / 59 - 40;
|
19
|
+
// Current conversion
|
20
|
+
static const float BL0906_IREF = 1.097 / (12875 * 1 * (5.1 + 5.1) * 1000 / 2000);
|
21
|
+
// Voltage conversion
|
22
|
+
static const float BL0906_UREF = 1.097 * (20000 + 20000 + 20000 + 20000 + 20000) / (13162 * 1 * 100 * 1000);
|
23
|
+
// Power conversion
|
24
|
+
static const float BL0906_PREF = 1.097 * 1.097 * (20000 + 20000 + 20000 + 20000 + 20000) /
|
25
|
+
(40.41259 * ((5.1 + 5.1) * 1000 / 2000) * 1 * 100 * 1 * 1000);
|
26
|
+
// Energy conversion
|
27
|
+
static const float BL0906_EREF = 4194304 * 0.032768 * 16 /
|
28
|
+
(3600000 * 16 *
|
29
|
+
(40.4125 * ((5.1 + 5.1) * 1000 / 2000) * 1 * 100 * 1 * 1000 /
|
30
|
+
(1.097 * 1.097 * (20000 + 20000 + 20000 + 20000 + 20000))));
|
31
|
+
// Current coefficient
|
32
|
+
static const float BL0906_KI = 12875 * 1 * (5.1 + 5.1) * 1000 / 2000 / 1.097;
|
33
|
+
// Power coefficient
|
34
|
+
static const float BL0906_KP = 40.4125 * ((5.1 + 5.1) * 1000 / 2000) * 1 * 100 * 1 * 1000 / 1.097 / 1.097 /
|
35
|
+
(20000 + 20000 + 20000 + 20000 + 20000);
|
36
|
+
|
37
|
+
static const uint8_t USR_WRPROT_WITABLE[6] = {0xCA, 0x9E, 0x55, 0x55, 0x00, 0xB7};
|
38
|
+
static const uint8_t USR_WRPROT_ONLYREAD[6] = {0xCA, 0x9E, 0x00, 0x00, 0x00, 0x61};
|
39
|
+
|
40
|
+
static const uint8_t BL0906_READ_COMMAND = 0x35;
|
41
|
+
static const uint8_t BL0906_WRITE_COMMAND = 0xCA;
|
42
|
+
|
43
|
+
// Register address
|
44
|
+
// Voltage
|
45
|
+
static const uint8_t BL0906_V_RMS = 0x16;
|
46
|
+
|
47
|
+
// Total power
|
48
|
+
static const uint8_t BL0906_WATT_SUM = 0X2C;
|
49
|
+
|
50
|
+
// Current1~6
|
51
|
+
static const uint8_t BL0906_I_1_RMS = 0x0D; // current_1
|
52
|
+
static const uint8_t BL0906_I_2_RMS = 0x0E;
|
53
|
+
static const uint8_t BL0906_I_3_RMS = 0x0F;
|
54
|
+
static const uint8_t BL0906_I_4_RMS = 0x10;
|
55
|
+
static const uint8_t BL0906_I_5_RMS = 0x13;
|
56
|
+
static const uint8_t BL0906_I_6_RMS = 0x14; // current_6
|
57
|
+
|
58
|
+
// Power1~6
|
59
|
+
static const uint8_t BL0906_WATT_1 = 0X23; // power_1
|
60
|
+
static const uint8_t BL0906_WATT_2 = 0X24;
|
61
|
+
static const uint8_t BL0906_WATT_3 = 0X25;
|
62
|
+
static const uint8_t BL0906_WATT_4 = 0X26;
|
63
|
+
static const uint8_t BL0906_WATT_5 = 0X29;
|
64
|
+
static const uint8_t BL0906_WATT_6 = 0X2A; // power_6
|
65
|
+
|
66
|
+
// Active pulse count, unsigned
|
67
|
+
static const uint8_t BL0906_CF_1_CNT = 0X30; // Channel_1
|
68
|
+
static const uint8_t BL0906_CF_2_CNT = 0X31;
|
69
|
+
static const uint8_t BL0906_CF_3_CNT = 0X32;
|
70
|
+
static const uint8_t BL0906_CF_4_CNT = 0X33;
|
71
|
+
static const uint8_t BL0906_CF_5_CNT = 0X36;
|
72
|
+
static const uint8_t BL0906_CF_6_CNT = 0X37; // Channel_6
|
73
|
+
|
74
|
+
// Total active pulse count, unsigned
|
75
|
+
static const uint8_t BL0906_CF_SUM_CNT = 0X39;
|
76
|
+
|
77
|
+
// Voltage frequency cycle
|
78
|
+
static const uint8_t BL0906_FREQUENCY = 0X4E;
|
79
|
+
|
80
|
+
// Internal temperature
|
81
|
+
static const uint8_t BL0906_TEMPERATURE = 0X5E;
|
82
|
+
|
83
|
+
// Calibration register
|
84
|
+
// RMS gain adjustment register
|
85
|
+
static const uint8_t BL0906_RMSGN_1 = 0x6D; // Channel_1
|
86
|
+
static const uint8_t BL0906_RMSGN_2 = 0x6E;
|
87
|
+
static const uint8_t BL0906_RMSGN_3 = 0x6F;
|
88
|
+
static const uint8_t BL0906_RMSGN_4 = 0x70;
|
89
|
+
static const uint8_t BL0906_RMSGN_5 = 0x73;
|
90
|
+
static const uint8_t BL0906_RMSGN_6 = 0x74; // Channel_6
|
91
|
+
|
92
|
+
// RMS offset correction register
|
93
|
+
static const uint8_t BL0906_RMSOS_1 = 0x78; // Channel_1
|
94
|
+
static const uint8_t BL0906_RMSOS_2 = 0x79;
|
95
|
+
static const uint8_t BL0906_RMSOS_3 = 0x7A;
|
96
|
+
static const uint8_t BL0906_RMSOS_4 = 0x7B;
|
97
|
+
static const uint8_t BL0906_RMSOS_5 = 0x7E;
|
98
|
+
static const uint8_t BL0906_RMSOS_6 = 0x7F; // Channel_6
|
99
|
+
|
100
|
+
// Active power gain adjustment register
|
101
|
+
static const uint8_t BL0906_WATTGN_1 = 0xB7; // Channel_1
|
102
|
+
static const uint8_t BL0906_WATTGN_2 = 0xB8;
|
103
|
+
static const uint8_t BL0906_WATTGN_3 = 0xB9;
|
104
|
+
static const uint8_t BL0906_WATTGN_4 = 0xBA;
|
105
|
+
static const uint8_t BL0906_WATTGN_5 = 0xBD;
|
106
|
+
static const uint8_t BL0906_WATTGN_6 = 0xBE; // Channel_6
|
107
|
+
|
108
|
+
// User write protection setting register,
|
109
|
+
// You must first write 0x5555 to the write protection setting register before writing to other registers.
|
110
|
+
static const uint8_t BL0906_USR_WRPROT = 0x9E;
|
111
|
+
|
112
|
+
// Reset Register
|
113
|
+
static const uint8_t BL0906_SOFT_RESET = 0x9F;
|
114
|
+
|
115
|
+
const uint8_t BL0906_INIT[2][6] = {
|
116
|
+
// Reset to default
|
117
|
+
{BL0906_WRITE_COMMAND, BL0906_SOFT_RESET, 0x5A, 0x5A, 0x5A, 0x52},
|
118
|
+
// Enable User Operation Write
|
119
|
+
{BL0906_WRITE_COMMAND, BL0906_USR_WRPROT, 0x55, 0x55, 0x00, 0xB7}};
|
120
|
+
|
121
|
+
} // namespace bl0906
|
122
|
+
} // namespace esphome
|
@@ -0,0 +1,184 @@
|
|
1
|
+
from esphome import automation
|
2
|
+
from esphome.automation import maybe_simple_id
|
3
|
+
import esphome.codegen as cg
|
4
|
+
from esphome.components import sensor, uart
|
5
|
+
import esphome.config_validation as cv
|
6
|
+
from esphome.const import (
|
7
|
+
CONF_CHANNEL,
|
8
|
+
CONF_CURRENT,
|
9
|
+
CONF_ENERGY,
|
10
|
+
CONF_FREQUENCY,
|
11
|
+
CONF_ID,
|
12
|
+
CONF_NAME,
|
13
|
+
CONF_POWER,
|
14
|
+
CONF_TEMPERATURE,
|
15
|
+
CONF_TOTAL_POWER,
|
16
|
+
CONF_VOLTAGE,
|
17
|
+
DEVICE_CLASS_CURRENT,
|
18
|
+
DEVICE_CLASS_ENERGY,
|
19
|
+
DEVICE_CLASS_FREQUENCY,
|
20
|
+
DEVICE_CLASS_POWER,
|
21
|
+
DEVICE_CLASS_TEMPERATURE,
|
22
|
+
DEVICE_CLASS_VOLTAGE,
|
23
|
+
ICON_CURRENT_AC,
|
24
|
+
ICON_POWER,
|
25
|
+
ICON_THERMOMETER,
|
26
|
+
STATE_CLASS_MEASUREMENT,
|
27
|
+
STATE_CLASS_TOTAL_INCREASING,
|
28
|
+
UNIT_AMPERE,
|
29
|
+
UNIT_CELSIUS,
|
30
|
+
UNIT_HERTZ,
|
31
|
+
UNIT_KILOWATT_HOURS,
|
32
|
+
UNIT_VOLT,
|
33
|
+
UNIT_WATT,
|
34
|
+
)
|
35
|
+
|
36
|
+
# Import ICONS not included in esphome's const.py, from the local components const.py
|
37
|
+
from .const import ICON_ENERGY, ICON_FREQUENCY, ICON_VOLTAGE
|
38
|
+
|
39
|
+
DEPENDENCIES = ["uart"]
|
40
|
+
AUTO_LOAD = ["bl0906"]
|
41
|
+
CONF_TOTAL_ENERGY = "total_energy"
|
42
|
+
|
43
|
+
bl0906_ns = cg.esphome_ns.namespace("bl0906")
|
44
|
+
BL0906 = bl0906_ns.class_("BL0906", cg.PollingComponent, uart.UARTDevice)
|
45
|
+
ResetEnergyAction = bl0906_ns.class_("ResetEnergyAction", automation.Action)
|
46
|
+
|
47
|
+
CONFIG_SCHEMA = (
|
48
|
+
cv.Schema(
|
49
|
+
{
|
50
|
+
cv.GenerateID(): cv.declare_id(BL0906),
|
51
|
+
cv.Optional(CONF_FREQUENCY): sensor.sensor_schema(
|
52
|
+
icon=ICON_FREQUENCY,
|
53
|
+
accuracy_decimals=0,
|
54
|
+
device_class=DEVICE_CLASS_FREQUENCY,
|
55
|
+
unit_of_measurement=UNIT_HERTZ,
|
56
|
+
state_class=STATE_CLASS_MEASUREMENT,
|
57
|
+
),
|
58
|
+
cv.Optional(CONF_TEMPERATURE): sensor.sensor_schema(
|
59
|
+
icon=ICON_THERMOMETER,
|
60
|
+
accuracy_decimals=0,
|
61
|
+
device_class=DEVICE_CLASS_TEMPERATURE,
|
62
|
+
unit_of_measurement=UNIT_CELSIUS,
|
63
|
+
state_class=STATE_CLASS_MEASUREMENT,
|
64
|
+
),
|
65
|
+
cv.Optional(CONF_VOLTAGE): sensor.sensor_schema(
|
66
|
+
icon=ICON_VOLTAGE,
|
67
|
+
accuracy_decimals=1,
|
68
|
+
device_class=DEVICE_CLASS_VOLTAGE,
|
69
|
+
unit_of_measurement=UNIT_VOLT,
|
70
|
+
state_class=STATE_CLASS_MEASUREMENT,
|
71
|
+
),
|
72
|
+
cv.Optional(CONF_TOTAL_POWER): sensor.sensor_schema(
|
73
|
+
icon=ICON_POWER,
|
74
|
+
accuracy_decimals=3,
|
75
|
+
device_class=DEVICE_CLASS_POWER,
|
76
|
+
unit_of_measurement=UNIT_WATT,
|
77
|
+
state_class=STATE_CLASS_MEASUREMENT,
|
78
|
+
),
|
79
|
+
cv.Optional(CONF_TOTAL_ENERGY): sensor.sensor_schema(
|
80
|
+
icon=ICON_ENERGY,
|
81
|
+
accuracy_decimals=3,
|
82
|
+
device_class=DEVICE_CLASS_ENERGY,
|
83
|
+
state_class=STATE_CLASS_TOTAL_INCREASING,
|
84
|
+
unit_of_measurement=UNIT_KILOWATT_HOURS,
|
85
|
+
),
|
86
|
+
}
|
87
|
+
)
|
88
|
+
.extend(
|
89
|
+
cv.Schema(
|
90
|
+
{
|
91
|
+
cv.Optional(f"{CONF_CHANNEL}_{i + 1}"): cv.Schema(
|
92
|
+
{
|
93
|
+
cv.Optional(CONF_CURRENT): cv.maybe_simple_value(
|
94
|
+
sensor.sensor_schema(
|
95
|
+
icon=ICON_CURRENT_AC,
|
96
|
+
accuracy_decimals=3,
|
97
|
+
device_class=DEVICE_CLASS_CURRENT,
|
98
|
+
unit_of_measurement=UNIT_AMPERE,
|
99
|
+
state_class=STATE_CLASS_MEASUREMENT,
|
100
|
+
),
|
101
|
+
key=CONF_NAME,
|
102
|
+
),
|
103
|
+
cv.Optional(CONF_POWER): cv.maybe_simple_value(
|
104
|
+
sensor.sensor_schema(
|
105
|
+
icon=ICON_POWER,
|
106
|
+
accuracy_decimals=0,
|
107
|
+
device_class=DEVICE_CLASS_POWER,
|
108
|
+
unit_of_measurement=UNIT_WATT,
|
109
|
+
state_class=STATE_CLASS_MEASUREMENT,
|
110
|
+
),
|
111
|
+
key=CONF_NAME,
|
112
|
+
),
|
113
|
+
cv.Optional(CONF_ENERGY): cv.maybe_simple_value(
|
114
|
+
sensor.sensor_schema(
|
115
|
+
icon=ICON_ENERGY,
|
116
|
+
accuracy_decimals=3,
|
117
|
+
device_class=DEVICE_CLASS_ENERGY,
|
118
|
+
unit_of_measurement=UNIT_KILOWATT_HOURS,
|
119
|
+
state_class=STATE_CLASS_TOTAL_INCREASING,
|
120
|
+
),
|
121
|
+
key=CONF_NAME,
|
122
|
+
),
|
123
|
+
}
|
124
|
+
)
|
125
|
+
for i in range(6)
|
126
|
+
}
|
127
|
+
)
|
128
|
+
)
|
129
|
+
.extend(uart.UART_DEVICE_SCHEMA)
|
130
|
+
.extend(cv.polling_component_schema("60s"))
|
131
|
+
)
|
132
|
+
|
133
|
+
FINAL_VALIDATE_SCHEMA = uart.final_validate_device_schema(
|
134
|
+
"bl0906", baud_rate=19200, require_tx=True, require_rx=True
|
135
|
+
)
|
136
|
+
|
137
|
+
|
138
|
+
@automation.register_action(
|
139
|
+
"bl0906.reset_energy",
|
140
|
+
ResetEnergyAction,
|
141
|
+
maybe_simple_id(
|
142
|
+
{
|
143
|
+
cv.Required(CONF_ID): cv.use_id(BL0906),
|
144
|
+
}
|
145
|
+
),
|
146
|
+
)
|
147
|
+
async def reset_energy_to_code(config, action_id, template_arg, args):
|
148
|
+
paren = await cg.get_variable(config[CONF_ID])
|
149
|
+
return cg.new_Pvariable(action_id, template_arg, paren)
|
150
|
+
|
151
|
+
|
152
|
+
async def to_code(config):
|
153
|
+
var = cg.new_Pvariable(config[CONF_ID])
|
154
|
+
await cg.register_component(var, config)
|
155
|
+
await uart.register_uart_device(var, config)
|
156
|
+
if frequency_config := config.get(CONF_FREQUENCY):
|
157
|
+
sens = await sensor.new_sensor(frequency_config)
|
158
|
+
cg.add(var.set_frequency_sensor(sens))
|
159
|
+
if temperature_config := config.get(CONF_TEMPERATURE):
|
160
|
+
sens = await sensor.new_sensor(temperature_config)
|
161
|
+
cg.add(var.set_temperature_sensor(sens))
|
162
|
+
if voltage_config := config.get(CONF_VOLTAGE):
|
163
|
+
sens = await sensor.new_sensor(voltage_config)
|
164
|
+
cg.add(var.set_voltage_sensor(sens))
|
165
|
+
|
166
|
+
for i in range(6):
|
167
|
+
if channel_config := config.get(f"{CONF_CHANNEL}_{i + 1}"):
|
168
|
+
if current_config := channel_config.get(CONF_CURRENT):
|
169
|
+
sens = await sensor.new_sensor(current_config)
|
170
|
+
cg.add(getattr(var, f"set_current_{i + 1}_sensor")(sens))
|
171
|
+
if power_config := channel_config.get(CONF_POWER):
|
172
|
+
sens = await sensor.new_sensor(power_config)
|
173
|
+
cg.add(getattr(var, f"set_power_{i + 1}_sensor")(sens))
|
174
|
+
if energy_config := channel_config.get(CONF_ENERGY):
|
175
|
+
sens = await sensor.new_sensor(energy_config)
|
176
|
+
cg.add(getattr(var, f"set_energy_{i + 1}_sensor")(sens))
|
177
|
+
|
178
|
+
if total_power_config := config.get(CONF_TOTAL_POWER):
|
179
|
+
sens = await sensor.new_sensor(total_power_config)
|
180
|
+
cg.add(var.set_total_power_sensor(sens))
|
181
|
+
|
182
|
+
if total_energy_config := config.get(CONF_TOTAL_ENERGY):
|
183
|
+
sens = await sensor.new_sensor(total_energy_config)
|
184
|
+
cg.add(var.set_total_energy_sensor(sens))
|
@@ -1 +1 @@
|
|
1
|
-
CODEOWNERS = ["@dbuezas"]
|
1
|
+
CODEOWNERS = ["@dbuezas", "@dwmw2"]
|
@@ -2,6 +2,8 @@
|
|
2
2
|
#include "esphome/core/log.h"
|
3
3
|
#include <cinttypes>
|
4
4
|
|
5
|
+
// Datasheet: https://www.belling.com.cn/media/file_object/bel_product/BL0942/datasheet/BL0942_V1.06_en.pdf
|
6
|
+
|
5
7
|
namespace esphome {
|
6
8
|
namespace bl0942 {
|
7
9
|
|
@@ -12,43 +14,64 @@ static const uint8_t BL0942_FULL_PACKET = 0xAA;
|
|
12
14
|
static const uint8_t BL0942_PACKET_HEADER = 0x55;
|
13
15
|
|
14
16
|
static const uint8_t BL0942_WRITE_COMMAND = 0xA8;
|
15
|
-
|
16
|
-
static const uint8_t
|
17
|
-
static const uint8_t
|
18
|
-
static const uint8_t
|
17
|
+
|
18
|
+
static const uint8_t BL0942_REG_I_RMSOS = 0x12;
|
19
|
+
static const uint8_t BL0942_REG_WA_CREEP = 0x14;
|
20
|
+
static const uint8_t BL0942_REG_I_FAST_RMS_TH = 0x15;
|
21
|
+
static const uint8_t BL0942_REG_I_FAST_RMS_CYC = 0x16;
|
22
|
+
static const uint8_t BL0942_REG_FREQ_CYC = 0x17;
|
23
|
+
static const uint8_t BL0942_REG_OT_FUNX = 0x18;
|
24
|
+
static const uint8_t BL0942_REG_MODE = 0x19;
|
25
|
+
static const uint8_t BL0942_REG_SOFT_RESET = 0x1C;
|
26
|
+
static const uint8_t BL0942_REG_USR_WRPROT = 0x1D;
|
19
27
|
static const uint8_t BL0942_REG_TPS_CTRL = 0x1B;
|
20
28
|
|
21
|
-
|
22
|
-
const
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
static const uint32_t BL0942_REG_MODE_RESV = 0x03;
|
30
|
+
static const uint32_t BL0942_REG_MODE_CF_EN = 0x04;
|
31
|
+
static const uint32_t BL0942_REG_MODE_RMS_UPDATE_SEL = 0x08;
|
32
|
+
static const uint32_t BL0942_REG_MODE_FAST_RMS_SEL = 0x10;
|
33
|
+
static const uint32_t BL0942_REG_MODE_AC_FREQ_SEL = 0x20;
|
34
|
+
static const uint32_t BL0942_REG_MODE_CF_CNT_CLR_SEL = 0x40;
|
35
|
+
static const uint32_t BL0942_REG_MODE_CF_CNT_ADD_SEL = 0x80;
|
36
|
+
static const uint32_t BL0942_REG_MODE_UART_RATE_19200 = 0x200;
|
37
|
+
static const uint32_t BL0942_REG_MODE_UART_RATE_38400 = 0x300;
|
38
|
+
static const uint32_t BL0942_REG_MODE_DEFAULT =
|
39
|
+
BL0942_REG_MODE_RESV | BL0942_REG_MODE_CF_EN | BL0942_REG_MODE_CF_CNT_ADD_SEL;
|
40
|
+
|
41
|
+
static const uint32_t BL0942_REG_SOFT_RESET_MAGIC = 0x5a5a5a;
|
42
|
+
static const uint32_t BL0942_REG_USR_WRPROT_MAGIC = 0x55;
|
43
|
+
|
44
|
+
// 23-byte packet, 11 bits per byte, 2400 baud: about 105ms
|
45
|
+
static const uint32_t PKT_TIMEOUT_MS = 200;
|
33
46
|
|
34
47
|
void BL0942::loop() {
|
35
48
|
DataPacket buffer;
|
36
|
-
|
49
|
+
int avail = this->available();
|
50
|
+
|
51
|
+
if (!avail) {
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
if (avail < sizeof(buffer)) {
|
55
|
+
if (!this->rx_start_) {
|
56
|
+
this->rx_start_ = millis();
|
57
|
+
} else if (millis() > this->rx_start_ + PKT_TIMEOUT_MS) {
|
58
|
+
ESP_LOGW(TAG, "Junk on wire. Throwing away partial message (%d bytes)", avail);
|
59
|
+
this->read_array((uint8_t *) &buffer, avail);
|
60
|
+
this->rx_start_ = 0;
|
61
|
+
}
|
37
62
|
return;
|
38
63
|
}
|
39
|
-
|
40
|
-
|
41
|
-
|
64
|
+
|
65
|
+
if (this->read_array((uint8_t *) &buffer, sizeof(buffer))) {
|
66
|
+
if (this->validate_checksum_(&buffer)) {
|
67
|
+
this->received_package_(&buffer);
|
42
68
|
}
|
43
|
-
} else {
|
44
|
-
ESP_LOGW(TAG, "Junk on wire. Throwing away partial message");
|
45
|
-
while (read() >= 0)
|
46
|
-
;
|
47
69
|
}
|
70
|
+
this->rx_start_ = 0;
|
48
71
|
}
|
49
72
|
|
50
|
-
bool BL0942::
|
51
|
-
uint8_t checksum = BL0942_READ_COMMAND;
|
73
|
+
bool BL0942::validate_checksum_(DataPacket *data) {
|
74
|
+
uint8_t checksum = BL0942_READ_COMMAND | this->address_;
|
52
75
|
// Whole package but checksum
|
53
76
|
uint8_t *raw = (uint8_t *) data;
|
54
77
|
for (uint32_t i = 0; i < sizeof(*data) - 1; i++) {
|
@@ -61,17 +84,73 @@ bool BL0942::validate_checksum(DataPacket *data) {
|
|
61
84
|
return checksum == data->checksum;
|
62
85
|
}
|
63
86
|
|
64
|
-
void BL0942::
|
87
|
+
void BL0942::write_reg_(uint8_t reg, uint32_t val) {
|
88
|
+
uint8_t pkt[6];
|
89
|
+
|
90
|
+
this->flush();
|
91
|
+
pkt[0] = BL0942_WRITE_COMMAND | this->address_;
|
92
|
+
pkt[1] = reg;
|
93
|
+
pkt[2] = (val & 0xff);
|
94
|
+
pkt[3] = (val >> 8) & 0xff;
|
95
|
+
pkt[4] = (val >> 16) & 0xff;
|
96
|
+
pkt[5] = (pkt[0] + pkt[1] + pkt[2] + pkt[3] + pkt[4]) ^ 0xff;
|
97
|
+
this->write_array(pkt, 6);
|
98
|
+
delay(1);
|
99
|
+
}
|
100
|
+
|
101
|
+
int BL0942::read_reg_(uint8_t reg) {
|
102
|
+
union {
|
103
|
+
uint8_t b[4];
|
104
|
+
uint32_le_t le32;
|
105
|
+
} resp;
|
106
|
+
|
107
|
+
this->write_byte(BL0942_READ_COMMAND | this->address_);
|
108
|
+
this->write_byte(reg);
|
65
109
|
this->flush();
|
66
|
-
this->
|
110
|
+
if (this->read_array(resp.b, 4) &&
|
111
|
+
resp.b[3] ==
|
112
|
+
(uint8_t) ((BL0942_READ_COMMAND + this->address_ + reg + resp.b[0] + resp.b[1] + resp.b[2]) ^ 0xff)) {
|
113
|
+
resp.b[3] = 0;
|
114
|
+
return resp.le32;
|
115
|
+
}
|
116
|
+
return -1;
|
117
|
+
}
|
118
|
+
|
119
|
+
void BL0942::update() {
|
120
|
+
this->write_byte(BL0942_READ_COMMAND | this->address_);
|
67
121
|
this->write_byte(BL0942_FULL_PACKET);
|
68
122
|
}
|
69
123
|
|
70
124
|
void BL0942::setup() {
|
71
|
-
|
72
|
-
|
73
|
-
|
125
|
+
// If either current or voltage references are set explicitly by the user,
|
126
|
+
// calculate the power reference from it unless that is also explicitly set.
|
127
|
+
if ((this->current_reference_set_ || this->voltage_reference_set_) && !this->power_reference_set_) {
|
128
|
+
this->power_reference_ = (this->voltage_reference_ * this->current_reference_ * 3537.0 / 305978.0) / 73989.0;
|
129
|
+
this->power_reference_set_ = true;
|
130
|
+
}
|
131
|
+
|
132
|
+
// Similarly for energy reference, if the power reference was set by the user
|
133
|
+
// either implicitly or explicitly.
|
134
|
+
if (this->power_reference_set_ && !this->energy_reference_set_) {
|
135
|
+
this->energy_reference_ = this->power_reference_ * 3600000 / 419430.4;
|
136
|
+
this->energy_reference_set_ = true;
|
74
137
|
}
|
138
|
+
|
139
|
+
this->write_reg_(BL0942_REG_USR_WRPROT, BL0942_REG_USR_WRPROT_MAGIC);
|
140
|
+
if (this->reset_)
|
141
|
+
this->write_reg_(BL0942_REG_SOFT_RESET, BL0942_REG_SOFT_RESET_MAGIC);
|
142
|
+
|
143
|
+
uint32_t mode = BL0942_REG_MODE_DEFAULT;
|
144
|
+
mode |= BL0942_REG_MODE_RMS_UPDATE_SEL; /* 800ms refresh time */
|
145
|
+
if (this->line_freq_ == LINE_FREQUENCY_60HZ)
|
146
|
+
mode |= BL0942_REG_MODE_AC_FREQ_SEL;
|
147
|
+
this->write_reg_(BL0942_REG_MODE, mode);
|
148
|
+
|
149
|
+
this->write_reg_(BL0942_REG_USR_WRPROT, 0);
|
150
|
+
|
151
|
+
if (this->read_reg_(BL0942_REG_MODE) != mode)
|
152
|
+
this->status_set_warning("BL0942 setup failed!");
|
153
|
+
|
75
154
|
this->flush();
|
76
155
|
}
|
77
156
|
|
@@ -82,10 +161,17 @@ void BL0942::received_package_(DataPacket *data) {
|
|
82
161
|
return;
|
83
162
|
}
|
84
163
|
|
164
|
+
// cf_cnt is only 24 bits, so track overflows
|
165
|
+
uint32_t cf_cnt = (uint24_t) data->cf_cnt;
|
166
|
+
cf_cnt |= this->prev_cf_cnt_ & 0xff000000;
|
167
|
+
if (cf_cnt < this->prev_cf_cnt_) {
|
168
|
+
cf_cnt += 0x1000000;
|
169
|
+
}
|
170
|
+
this->prev_cf_cnt_ = cf_cnt;
|
171
|
+
|
85
172
|
float v_rms = (uint24_t) data->v_rms / voltage_reference_;
|
86
173
|
float i_rms = (uint24_t) data->i_rms / current_reference_;
|
87
174
|
float watt = (int24_t) data->watt / power_reference_;
|
88
|
-
uint32_t cf_cnt = (uint24_t) data->cf_cnt;
|
89
175
|
float total_energy_consumption = cf_cnt / energy_reference_;
|
90
176
|
float frequency = 1000000.0f / data->frequency;
|
91
177
|
|
@@ -104,18 +190,25 @@ void BL0942::received_package_(DataPacket *data) {
|
|
104
190
|
if (frequency_sensor_ != nullptr) {
|
105
191
|
frequency_sensor_->publish_state(frequency);
|
106
192
|
}
|
107
|
-
|
193
|
+
this->status_clear_warning();
|
108
194
|
ESP_LOGV(TAG, "BL0942: U %fV, I %fA, P %fW, Cnt %" PRId32 ", ∫P %fkWh, frequency %fHz, status 0x%08X", v_rms, i_rms,
|
109
195
|
watt, cf_cnt, total_energy_consumption, frequency, data->status);
|
110
196
|
}
|
111
197
|
|
112
198
|
void BL0942::dump_config() { // NOLINT(readability-function-cognitive-complexity)
|
113
199
|
ESP_LOGCONFIG(TAG, "BL0942:");
|
200
|
+
ESP_LOGCONFIG(TAG, " Reset: %s", TRUEFALSE(this->reset_));
|
201
|
+
ESP_LOGCONFIG(TAG, " Address: %d", this->address_);
|
202
|
+
ESP_LOGCONFIG(TAG, " Nominal line frequency: %d Hz", this->line_freq_);
|
203
|
+
ESP_LOGCONFIG(TAG, " Current reference: %f", this->current_reference_);
|
204
|
+
ESP_LOGCONFIG(TAG, " Energy reference: %f", this->energy_reference_);
|
205
|
+
ESP_LOGCONFIG(TAG, " Power reference: %f", this->power_reference_);
|
206
|
+
ESP_LOGCONFIG(TAG, " Voltage reference: %f", this->voltage_reference_);
|
114
207
|
LOG_SENSOR("", "Voltage", this->voltage_sensor_);
|
115
208
|
LOG_SENSOR("", "Current", this->current_sensor_);
|
116
209
|
LOG_SENSOR("", "Power", this->power_sensor_);
|
117
210
|
LOG_SENSOR("", "Energy", this->energy_sensor_);
|
118
|
-
LOG_SENSOR("", "
|
211
|
+
LOG_SENSOR("", "Frequency", this->frequency_sensor_);
|
119
212
|
}
|
120
213
|
|
121
214
|
} // namespace bl0942
|