Add Support for Sonoff POWCT Ring (#21131)

This commit is contained in:
Theo Arends 2024-07-03 16:31:43 +02:00
parent 9b537d81e0
commit 59fc68026b
4 changed files with 27 additions and 6 deletions

View File

@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
- Berry `math.min()` and `math.max()` (#21705) - Berry `math.min()` and `math.max()` (#21705)
- Berry `FUNC_ANY_KEY` event calling `any_key()` (#21708) - Berry `FUNC_ANY_KEY` event calling `any_key()` (#21708)
- Berry `FUNC_BUTTON_MULTI_PRESSED` event and make `FUNC_BUTTON_PRESSED` called only on state changes and once per second (#21711) - Berry `FUNC_BUTTON_MULTI_PRESSED` event and make `FUNC_BUTTON_PRESSED` called only on state changes and once per second (#21711)
- Support for Sonoff POWCT Ring (#21131)
### Breaking Changed ### Breaking Changed

View File

@ -123,6 +123,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
### Added ### Added
- Support for QMP6988 temperature and pressure sensor - Support for QMP6988 temperature and pressure sensor
- Support for Sonoff WTS01 temperature sensor using SerialBridge in ``SSerialMode 3`` - Support for Sonoff WTS01 temperature sensor using SerialBridge in ``SSerialMode 3``
- Support for Sonoff POWCT Ring [#21131](https://github.com/arendst/Tasmota/issues/21131)
- Extend command ``SetOption147 1`` to disable publish of IRReceived MQTT messages [#21574](https://github.com/arendst/Tasmota/issues/21574) - Extend command ``SetOption147 1`` to disable publish of IRReceived MQTT messages [#21574](https://github.com/arendst/Tasmota/issues/21574)
- ESP32 support for power and energy limit checks, like ``MaxEnergy2`` per phase [#21695](https://github.com/arendst/Tasmota/issues/21695) - ESP32 support for power and energy limit checks, like ``MaxEnergy2`` per phase [#21695](https://github.com/arendst/Tasmota/issues/21695)
- Berry solidification of `bytes` instances [#21558](https://github.com/arendst/Tasmota/issues/21558) - Berry solidification of `bytes` instances [#21558](https://github.com/arendst/Tasmota/issues/21558)

View File

@ -17,6 +17,7 @@
* {"NAME":"Sonoff THR316D GPIO26","GPIO":[32,0,0,0,225,9280,0,0,0,321,0,576,320,9184,9216,0,0,224,0,9248,0,1,1,3840,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1} * {"NAME":"Sonoff THR316D GPIO26","GPIO":[32,0,0,0,225,9280,0,0,0,321,0,576,320,9184,9216,0,0,224,0,9248,0,1,1,3840,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1}
* {"NAME":"Sonoff THR320D","GPIO":[32,0,0,0,226,9280,0,0,0,321,0,576,320,9184,9216,9312,0,0,9313,9248,0,1,0,3840,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1} * {"NAME":"Sonoff THR320D","GPIO":[32,0,0,0,226,9280,0,0,0,321,0,576,320,9184,9216,9312,0,0,9313,9248,0,1,0,3840,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1}
* {"NAME":"Sonoff THR320D GPIO26","GPIO":[32,0,0,0,226,9280,0,0,0,321,0,576,320,9184,9216,9312,0,0,9313,9248,0,1,1,3840,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1} * {"NAME":"Sonoff THR320D GPIO26","GPIO":[32,0,0,0,226,9280,0,0,0,321,0,576,320,9184,9216,9312,0,0,9313,9248,0,1,1,3840,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1}
* {"NAME":"Sonoff POWCT","GPIO":[32,0,0,0,0,9280,0,0,0,320,0,576,0,9184,9216,0,0,224,0,9248,0,7329,7296,0,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1}
* *
* DspSpeed 2..127 = Display rotation speed in seconds if more than one value is requested * DspSpeed 2..127 = Display rotation speed in seconds if more than one value is requested
* DspLine<1|2> <index>,<unit>,<index>,<unit>,... = Display specific JSON value and rotate between them * DspLine<1|2> <index>,<unit>,<index>,<unit>,... = Display specific JSON value and rotate between them
@ -51,12 +52,14 @@
#define TM1621_BIAS 0x29 // 0b00101001 = LCD 1/3 bias 4 commons option #define TM1621_BIAS 0x29 // 0b00101001 = LCD 1/3 bias 4 commons option
#define TM1621_IRQ_DIS 0x80 // 0b100x0xxx #define TM1621_IRQ_DIS 0x80 // 0b100x0xxx
enum Tm1621Device { TM1621_USER, TM1621_POWR316D, TM1621_THR316D }; enum Tm1621Device { TM1621_USER, TM1621_POWR316D, TM1621_THR316D, TM1621_POWCT };
const char tm1621_device PROGMEM[] = "User|PowR3|THR3|PowCT";
enum Tm1621Units { TM1621_NONE, TM1621_TEMPERATURE, TM1621_HUMIDITY, TM1621_VOLTAGE_CURRENT, TM1621_ENERGY_POWER }; enum Tm1621Units { TM1621_NONE, TM1621_TEMPERATURE, TM1621_HUMIDITY, TM1621_VOLTAGE_CURRENT, TM1621_ENERGY_POWER };
const uint8_t tm1621_commands[] = { TM1621_SYS_EN, TM1621_LCD_ON, TM1621_BIAS, TM1621_TIMER_DIS, TM1621_WDT_DIS, TM1621_TONE_OFF, TM1621_IRQ_DIS }; const uint8_t tm1621_commands[] = { TM1621_SYS_EN, TM1621_LCD_ON, TM1621_BIAS, TM1621_TIMER_DIS, TM1621_WDT_DIS, TM1621_TONE_OFF, TM1621_IRQ_DIS };
const char tm1621_kchar[] PROGMEM = { " |0|1|2|3|4|5|6|7|8|9|-|E" }; const char tm1621_kchar[] PROGMEM = " |0|1|2|3|4|5|6|7|8|9|-|E";
// b0 --- // b0 ---
// b1 / / b4 // b1 / / b4
// --- b5 // --- b5
@ -307,7 +310,18 @@ void TM1621SendRows(void) {
void TM1621PreInit(void) { void TM1621PreInit(void) {
if (!PinUsed(GPIO_TM1621_CS) || !PinUsed(GPIO_TM1621_WR) || !PinUsed(GPIO_TM1621_RD) || !PinUsed(GPIO_TM1621_DAT)) { return; } if (!PinUsed(GPIO_TM1621_CS) || !PinUsed(GPIO_TM1621_WR) || !PinUsed(GPIO_TM1621_RD) || !PinUsed(GPIO_TM1621_DAT)) { return; }
Tm1621.device = (14 == Pin(GPIO_TM1621_DAT)) ? TM1621_POWR316D : (5 == Pin(GPIO_TM1621_DAT)) ? TM1621_THR316D : TM1621_USER; Tm1621.device = TM1621_USER;
uint32_t pin_tm1621_dat = Pin(GPIO_TM1621_DAT);
if (5 == Pin(GPIO_TM1621_DAT)) {
if (25 == Pin(GPIO_CSE7761_RX, 1)) {
Tm1621.device = TM1621_POWCT;
} else {
Tm1621.device = TM1621_THR316D;
}
}
else if (14 == Pin(GPIO_TM1621_DAT)) {
Tm1621.device = TM1621_POWR316D;
}
Tm1621.present = true; Tm1621.present = true;
Tm1621.pin_da = Pin(GPIO_TM1621_DAT); Tm1621.pin_da = Pin(GPIO_TM1621_DAT);
Tm1621.pin_cs = Pin(GPIO_TM1621_CS); Tm1621.pin_cs = Pin(GPIO_TM1621_CS);
@ -326,7 +340,9 @@ void TM1621PreInit(void) {
Tm1621.state = 200; Tm1621.state = 200;
AddLog(LOG_LEVEL_INFO, PSTR("DSP: TM1621")); char stemp[8];
AddLog(LOG_LEVEL_INFO, PSTR("DSP: TM1621 for %s"),
GetTextIndexed(stemp, sizeof(stemp), Tm1621.device, tm1621_device));
} }
void TM1621Init(void) { void TM1621Init(void) {
@ -452,7 +468,8 @@ void TM1621Show(void) {
} }
#ifdef USE_ENERGY_SENSOR #ifdef USE_ENERGY_SENSOR
if (TM1621_POWR316D == Tm1621.device) { if ((TM1621_POWR316D == Tm1621.device) ||
(TM1621_POWCT == Tm1621.device)) {
if (0 == Tm1621.display_rotate) { if (0 == Tm1621.display_rotate) {
ext_snprintf_P(Tm1621.row[0], sizeof(Tm1621.row[0]), PSTR("%1_f"), &Energy->voltage[0]); ext_snprintf_P(Tm1621.row[0], sizeof(Tm1621.row[0]), PSTR("%1_f"), &Energy->voltage[0]);
ext_snprintf_P(Tm1621.row[1], sizeof(Tm1621.row[1]), PSTR("%1_f"), &Energy->current[0]); ext_snprintf_P(Tm1621.row[1], sizeof(Tm1621.row[1]), PSTR("%1_f"), &Energy->current[0]);

View File

@ -20,7 +20,7 @@
#ifdef USE_ENERGY_SENSOR #ifdef USE_ENERGY_SENSOR
#ifdef USE_CSE7761 #ifdef USE_CSE7761
/*********************************************************************************************\ /*********************************************************************************************\
* CSE7761 - Energy (Sonoff Dual R3 Pow and Pox CT) * CSE7761 - Energy (Sonoff Dual R3 and Pow CT)
* *
* Without zero-cross detection * Without zero-cross detection
* {"NAME":"Sonoff Dual R3","GPIO":[32,0,0,0,0,0,0,0,0,576,225,0,0,0,0,0,0,0,0,0,0,7296,7328,224,0,0,0,0,160,161,0,0,0,0,0,0],"FLAG":0,"BASE":1} * {"NAME":"Sonoff Dual R3","GPIO":[32,0,0,0,0,0,0,0,0,576,225,0,0,0,0,0,0,0,0,0,0,7296,7328,224,0,0,0,0,160,161,0,0,0,0,0,0],"FLAG":0,"BASE":1}
@ -28,6 +28,8 @@
* With zero-cross detection * With zero-cross detection
* {"NAME":"Sonoff Dual R3 (ZCD)","GPIO":[32,0,0,0,7552,0,0,0,0,576,225,0,0,0,0,0,0,0,0,0,0,7296,7328,224,0,0,0,0,160,161,0,0,0,0,0,0],"FLAG":0,"BASE":1} * {"NAME":"Sonoff Dual R3 (ZCD)","GPIO":[32,0,0,0,7552,0,0,0,0,576,225,0,0,0,0,0,0,0,0,0,0,7296,7328,224,0,0,0,0,160,161,0,0,0,0,0,0],"FLAG":0,"BASE":1}
* *
* {"NAME":"Sonoff POWCT","GPIO":[32,0,0,0,0,9280,0,0,0,320,0,576,0,9184,9216,0,0,224,0,9248,0,7329,7296,0,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1}
*
* Based on datasheet from ChipSea and analysing serial data * Based on datasheet from ChipSea and analysing serial data
* See https://github.com/arendst/Tasmota/discussions/10793 * See https://github.com/arendst/Tasmota/discussions/10793
* https://goldenrelay.en.alibaba.com/product/62119012875-811845870/GOLDEN_GI_1A_5LH_SPST_5V_5A_10A_250VAC_NO_18_5_10_5_15_3mm_sealed_type_all_certificate_compliances_class_F_SPDT_Form_available.html * https://goldenrelay.en.alibaba.com/product/62119012875-811845870/GOLDEN_GI_1A_5LH_SPST_5V_5A_10A_250VAC_NO_18_5_10_5_15_3mm_sealed_type_all_certificate_compliances_class_F_SPDT_Form_available.html