Merge branch 'development' into prerelease-14.3.0

This commit is contained in:
Theo Arends 2024-10-11 11:58:25 +02:00
commit 6cb623930b
10 changed files with 183 additions and 83 deletions

View File

@ -12,11 +12,13 @@ All notable changes to this project will be documented in this file.
- LVGL port `colorwheel` from LVGL 8 (#22244)
- HASPmota `cpicker` and `msgbox` (#22244)
- Support for DALI 1 on ESP8266
- Command ``DaliWeb 1`` to enable light control for Dali broadcast address
### Changed
- ESP32 platform update from 2024.09.10 to 2024.09.30 and Framework (Arduino Core) from v3.0.5 to v3.1.0.240926 (#22203)
- Berry improve `persist` dirty data handling (#22246)
- HASPmota `delete` instead of `delete()` (#22245)
- Command ``DaliDimmer`` range from 0..254 to 0..100
### Fixed
- ESP32 Range Extender compile error with core 3.0.0 (#22205)
@ -25,6 +27,10 @@ All notable changes to this project will be documented in this file.
- ESP32 Dali compile error with core 3.x (#22214)
- Dali received data decoding
- ESP32 Ethernet using EthClockMode 3 (#22248)
- ESP32 disable SPI DMA for uDisplay (broken since esp-idf 5.3 (core 3.1.0)) (#22264)
### Removed
- Berry Zigbee removed test code (#22263)
## [14.2.0.5] 20240926
### Added

View File

@ -117,6 +117,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
## Changelog v14.3.0 Robert
### Added
- Command ``SetOption69 1`` to enable Serial Bridge inverted Receive [#22000](https://github.com/arendst/Tasmota/issues/22000)
- Command ``DaliWeb 1`` to enable light control for Dali broadcast address
- HX711 optional calibration precision option on command ``Sensor34 2 <weight in gram> <precision>`` where `<precision>` is 1 to 20 [#13983](https://github.com/arendst/Tasmota/issues/13983)
- ESP8266 support for one-wire M1601 temperature sensor on DS18x20 GPIO [#21376](https://github.com/arendst/Tasmota/issues/21376)
- ESP8266 support for I2C CLK on GPIO16 [#22199](https://github.com/arendst/Tasmota/issues/22199)
@ -153,6 +154,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- Add command entered to command error and command unknown message
- Refactored I2C drivers HTU21, BH1750, SHT3x, iAQ and HYT
- Energy BL09xx command ``CurrentSet`` input changed from Ampere to milliAmpere
- Command ``DaliDimmer`` range from 0..254 to 0..100
- Energy force Apparent Power equals Active Power when (Calculated) Apparent Power is less than Active Power [#20653](https://github.com/arendst/Tasmota/issues/20653)
- Refactor and fix PID sensor (PID_USE_LOCAL_SENSOR) read race condition [#22162](https://github.com/arendst/Tasmota/issues/22162)
- SCD30 Lowered I2C clock from 100k to 50k [#15438](https://github.com/arendst/Tasmota/issues/15438)
@ -177,6 +179,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
- ESP32 Range Extender compile error with core 3.x [#22205](https://github.com/arendst/Tasmota/issues/22205)
- ESP32 Dali compile error with core 3.x [#22214](https://github.com/arendst/Tasmota/issues/22214)
- ESP32 Ethernet using EthClockMode 3 [#22248](https://github.com/arendst/Tasmota/issues/22248)
- ESP32 disable SPI DMA for uDisplay (broken since esp-idf 5.3 (core 3.1.0)) [#22264](https://github.com/arendst/Tasmota/issues/22264)
- Berry avoid `readbytes()` from crashing when file is too large [#22057](https://github.com/arendst/Tasmota/issues/22057)
- Berry energy missing attributes [#22116](https://github.com/arendst/Tasmota/issues/22116)
- Berry I2C to prepare M5Stack I2C STM32 based devices [#22143](https://github.com/arendst/Tasmota/issues/22143)
@ -194,3 +197,4 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
### Removed
- ESP8266 Analog input support using energy driver as only one channel is available
- Berry remove reuse of methods for interface-like code reuse #21500 [#22055](https://github.com/arendst/Tasmota/issues/22055)
- Berry Zigbee removed test code [#22263](https://github.com/arendst/Tasmota/issues/22263)

View File

@ -5,7 +5,7 @@
# Templates
Find below the available templates as of August 2024. More template information can be found in the [Tasmota Device Templates Repository](http://blakadder.github.io/templates)
Find below the available templates as of October 2024. More template information can be found in the [Tasmota Device Templates Repository](http://blakadder.github.io/templates)
## Adapter Board
```
@ -97,7 +97,7 @@ Iotton 9W 700lm {"NAME":"Iotton Light","GPIO":[0,0,0,0,416,417,0,0,
iQtech 10W 900lm {"NAME":"iQ-Tech CCT 10W 900LM","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":18}
iView 10W 1050lm {"NAME":"iView ISB1000-D","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":18}
Kogan 10W Cool & Warm White 1050lm {"NAME":"Kogan 10W CCT","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":48}
Kogan 4.5W 330lm 110 {"NAME":"Kogan White/Wa","GPIO":[0,0,0,0,0,416,0,0,417,0,0,0,0,0],"FLAG":0,"BASE":18}
Kogan 4.5W 330lm 110° {"NAME":"Kogan White/Wa","GPIO":[0,0,0,0,0,416,0,0,417,0,0,0,0,0],"FLAG":0,"BASE":18}
Kogan 5W {"NAME":"Kogan Co/Wa","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":18}
Kruidvat A60 9W 806lm {"NAME":"Kruidvat E27 806 Lumens","GPIO":[0,0,0,0,416,449,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":48}
Laser 10W 1000lm {"NAME":"Laser 10W CCT","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":48}
@ -131,7 +131,7 @@ Nedis C10 350lm {"NAME":"WIFILW10WTE14","GPIO":[0,0,0,0,0,416,0,0,0
Nedis G125 5.5W 350lm Twisted Filament {"NAME":"WIFILF10GDG125","GPIO":[0,0,0,0,0,0,0,0,417,0,416,0,0,0],"FLAG":0,"BASE":18}
Nedis PAR16 330lm {"NAME":"Nedis WIFILW30","GPIO":[0,0,0,0,0,416,0,0,417,0,0,0,0,0],"FLAG":0,"BASE":18}
Nedis PAR16 4,5W 380lm {"NAME":"Nedis WIFILW10WTGU10","GPIO":[0,0,0,0,0,416,0,0,417,0,0,0,0,0],"FLAG":0,"BASE":18}
Nedis PAR16 4.5W 330lm 110 {"NAME":"WIFILW30","GPIO":[0,0,0,0,0,416,0,0,417,0,0,0,0,0],"FLAG":0,"BASE":18}
Nedis PAR16 4.5W 330lm 110° {"NAME":"WIFILW30","GPIO":[0,0,0,0,0,416,0,0,417,0,0,0,0,0],"FLAG":0,"BASE":18}
Nous P2 {"NAME":"NOUS-P2","GPIO":[0,0,0,0,0,416,0,0,417,0,0,0,0,0],"FLAG":0,"BASE":37}
Philips Zhirui Candle 250lm {"NAME":"Xiaomi Philips","GPIO":[0,0,0,0,0,0,0,0,417,0,0,416,0,0],"FLAG":0,"BASE":48}
Phillips Zhirui 450lm {"NAME":"Xiaomi Philips","GPIO":[0,0,0,0,0,0,0,0,417,0,0,416,0,0],"FLAG":0,"BASE":48}
@ -150,7 +150,7 @@ Sulion Morgan C37 5W 470lm {"NAME":"Sulion Bombilla C37","GPIO":[0,0,0,0,0,0,0
Swisstone 806lm {"NAME":"SwisstoneSH330","GPIO":[0,0,0,0,2912,416,0,0,417,2976,2944,0,0,0],"FLAG":0,"BASE":18}
Swisstone SH 310 {"NAME":"Swisstone SH 310","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":18}
Treatlife A19 9W 800lm {"NAME":"Treatlife SL20","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":18}
V-Tac PAR16 4.5W 300lm 110 {"NAME":"V-TAC VT-5174","GPIO":[0,0,0,0,0,0,0,0,417,0,416,0,0,0],"FLAG":0,"BASE":18}
V-Tac PAR16 4.5W 300lm 110° {"NAME":"V-TAC VT-5174","GPIO":[0,0,0,0,0,0,0,0,417,0,416,0,0,0],"FLAG":0,"BASE":18}
Vestaiot BR30 800lm {"NAME":"Vesta BR30 CCT","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":18}
Wipro Garnet NS9100 810lm {"NAME":"Wipro 9W CCT","GPIO":[0,0,0,0,0,416,0,0,0,417,0,0,0,0],"FLAG":0,"BASE":48}
Wyze A19 800lm {"NAME":"Wyze Bulb","GPIO":[5728,0,0,0,0,0,0,0,0,416,417,0,0,0],"FLAG":0,"BASE":48}
@ -395,7 +395,7 @@ Nedis A60 Warm White 9W 800lm {"NAME":"WIFILW11WTE27","GPIO":[0,0,0,0,0,416,0,0
Nedis G125 Filament {"NAME":"WIFILF10GDG125","GPIO":[0,0,0,0,0,0,0,0,0,0,416,0,0,0],"FLAG":0,"BASE":18}
Nedis PAR16 330lm {"NAME":"Nedis WIFILW31","GPIO":[0,0,0,0,0,416,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":18}
Nedis ST64 5W 500lm Filament {"NAME":"WIFILF10GDST64","GPIO":[0,0,0,0,0,0,0,0,0,0,416,0,0,0],"FLAG":0,"BASE":18}
Positivo Smart Lampada Retro {"NAME":"POSITIVO SMART LAMPADA RETRO","GPIO":[0,0,0,0,0,0,0,0,0,0,416,0,0,0],"FLAG":0,"BASE":18}
Positivo Smart Lâmpada Retrô {"NAME":"POSITIVO SMART LAMPADA RETRO","GPIO":[0,0,0,0,0,0,0,0,0,0,416,0,0,0],"FLAG":0,"BASE":18}
Sealight Vintage Edison A19 {"NAME":"SealightEdison","GPIO":[0,0,0,0,0,416,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":18}
Shelly Vintage 4W 260lm 2700k {"NAME":"Shelly Vintage","GPIO":[0,0,0,0,416,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":18}
Shelly Vintage 7W 750lm 2700k {"NAME":"Shelly Vintage","GPIO":[0,0,0,0,416,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":18}
@ -558,7 +558,7 @@ Goldair SleepSmart GCPF315 {"NAME":"Goldair Fan","GPIO":[0,0,0,0,0,0,0,0,0,230
Holmes 36" Oscillating Tower {"NAME":"Generic","GPIO":[1,1,1,1,1,1,1,1,1,1,1,1,1,1],"FLAG":0,"BASE":54,"CMND":"TuyaMcu 11,1 | TuyaMcu 12,5 | WebButton1 Power | WebButton2 Oscillation "}
Lucci Connect Remote Control {"NAME":"Lucci Fan","GPIO":[0,0,0,0,0,0,0,0,0,2304,0,2272,0,0],"FLAG":0,"BASE":54}
QuietCool Gable Mount Attic {"NAME":"QuietCool-AFG-SMT-PRO-2.0","GPIO":[0,0,0,0,0,224,0,0,0,0,0,0,0,0,640,608,0,0,0,225,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":1,"CMND":"Interlock 1|WebButton1 Low|WebButton2 High|SO8 1"}
Sichler Haushaltsgeraete Column {"NAME":"Sichler Fan","GPIO":[0,2272,0,2304,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54}
Sichler Haushaltsgeräte Column {"NAME":"Sichler Fan","GPIO":[0,2272,0,2304,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54}
Technical Pro {"NAME":"FXA16 Fan","GPIO":[0,2272,0,2304,0,0,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":54,"CMND":"TuyaMCU 12,8"}
Zemismart Bladeless {"NAME":"Bladeless Fan","GPIO":[1,2272,1,2304,1,1,0,0,1,1,1,1,1,0],"FLAG":0,"BASE":54}
```
@ -927,7 +927,7 @@ Zemismart Updated RF Remote Roller Shade {"NAME":"Zemismart M515EGB","GPIO":[1,
## Other
```
Kogan SmarterHome 1.9L Pet Water Fountain {"NAME":"WaterFountain","GPIO":[257,0,259,0,576,32,0,0,224,161,0,480,226,4704],"FLAG":0,"BASE":18}
Tetra Connect Automatic Feeder {"NAME":"Tetra Connect","GPIO":[0,0,0,0,224,288,0,0,98,96,97,0,289,0],"FLAG":0,"BASE":18}
Tetra® Connect Automatic Feeder {"NAME":"Tetra Connect","GPIO":[0,0,0,0,224,288,0,0,98,96,97,0,289,0],"FLAG":0,"BASE":18}
```
## Outdoor Plug
@ -2037,7 +2037,7 @@ Teckin SB53 1300lm {"NAME":"Teckin SB53","GPIO":[0,0,0,0,416,419,0,0,4
Treatlife A19 8W 650lm {"NAME":"Treatlife RGBW","GPIO":[0,0,0,0,417,416,0,0,420,418,419,0,0,0],"FLAG":0,"BASE":18}
V-TAC 10W 806lm {"NAME":"V-TAC VT-5119","GPIO":[0,0,0,0,4032,0,0,0,0,0,4064,0,0,0],"FLAG":0,"BASE":18}
V-Tac A60 10W 806lm {"NAME":"V-Tac A60","GPIO":[0,0,0,0,416,417,0,0,418,419,420,0,0,0],"FLAG":0,"BASE":18,"CMND":"SetOption37 13"}
V-Tac PAR16 4.5W 400lm 100 {"NAME":"V-TAC VT5164","GPIO":[0,0,0,0,0,0,0,0,4064,0,4032,0,0,0],"FLAG":0,"BASE":18}
V-Tac PAR16 4.5W 400lm 100° {"NAME":"V-TAC VT5164","GPIO":[0,0,0,0,0,0,0,0,4064,0,4032,0,0,0],"FLAG":0,"BASE":18}
Vizia 5W GU10 {"NAME":"Vizia RGBWW","GPIO":[0,0,0,0,419,420,0,0,417,418,416,0,0,1],"FLAG":0,"BASE":18}
WdtPro 8W 800lm {"NAME":"WdtPro","GPIO":[0,0,0,0,419,420,0,0,417,418,416,0,0,0],"FLAG":0,"BASE":18}
Wipro Garnet 9W 810lm {"NAME":"Wipro","GPIO":[0,0,0,0,416,419,0,0,417,420,418,0,0,0],"FLAG":0,"BASE":18}
@ -2140,7 +2140,7 @@ Kainsy 600lm {"NAME":"KAINSY","GPIO":[32,0,0,0,3008,3040,0,0,0,0
Kkmoon 9W 800lm {"NAME":"KKMOON V21","GPIO":[0,0,0,0,419,0,0,0,417,418,416,0,0,0],"FLAG":0,"BASE":18}
Koaanw 650lm {"NAME":"KOAANW Bulb","GPIO":[0,0,0,0,3008,3040,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":27}
Kogan 10W Ambient 1050lm {"NAME":"Kogan RGB","GPIO":[0,0,0,0,2912,416,0,0,0,0,2944,0,0,0],"FLAG":0,"BASE":18}
Kogan 4.5W 330lm 110 {"NAME":"Kogan_GU10","GPIO":[0,0,0,0,418,419,0,0,416,0,417,0,0,0],"FLAG":0,"BASE":18}
Kogan 4.5W 330lm 110° {"NAME":"Kogan_GU10","GPIO":[0,0,0,0,418,419,0,0,416,0,417,0,0,0],"FLAG":0,"BASE":18}
Kogan Ambient Candle {"NAME":"Kogan_E14","GPIO":[0,0,0,0,416,419,0,0,417,0,418,0,0,0],"FLAG":0,"BASE":18}
Kuled 800lm {"NAME":"KULED 60W RGB","GPIO":[0,0,0,0,418,419,0,0,416,0,417,0,0,4704],"FLAG":0,"BASE":18}
Laideyi 7W {"NAME":"7W-E14-RGBW-La","GPIO":[0,0,0,0,417,416,0,0,418,0,419,0,0,0],"FLAG":0,"BASE":18}
@ -2590,7 +2590,7 @@ Nedis Dual {"NAME":"SM-SW102U-2","GPIO":[576,0,0,33,225,0,0,0,
NEO Coolcam 2Ch Touch Light {"NAME":"Neo NAS-SC01W-2","GPIO":[0,0,0,0,225,0,0,0,32,224,33,0,544,0],"FLAG":0,"BASE":18}
Nexete DS-123 {"NAME":"DS-123","GPIO":[544,321,1,32,224,33,0,0,1,225,320,1,1,0],"FLAG":0,"BASE":18}
Nexete DS-123 Single {"NAME":"DS-123","GPIO":[544,0,1,33,0,32,0,0,1,224,320,1,1,0],"FLAG":0,"BASE":18}
Novadigital Interruptor Touch Led 1 Boto {"NAME":"Nova Digital Switch 1 Gang","GPIO":[544,0,0,32,224,0,0,0,0,0,288,0,0,0],"FLAG":0,"BASE":18}
Novadigital Interruptor Touch Led 1 Botão {"NAME":"Nova Digital Switch 1 Gang","GPIO":[544,0,0,32,224,0,0,0,0,0,288,0,0,0],"FLAG":0,"BASE":18}
PNI SmartHome 1 Key {"NAME":"Tuya Switch 1 key","GPIO":[544,1,1,32,224,1,1,1,1,1,288,1,1,1],"FLAG":0,"BASE":18}
PNI SmartHome 2 Keys {"NAME":"Tuya switch 2 key","GPIO":[544,0,289,0,0,32,0,0,33,225,0,224,288,0],"FLAG":0,"BASE":18}
Prosto {"NAME":"Prosto WFS-T10","GPIO":[0,0,0,0,0,224,0,0,320,0,64,0,0,0],"FLAG":0,"BASE":18}
@ -2739,7 +2739,7 @@ ZUCZUG 3 Gang {"NAME":"2ph105626a x3","GPIO":[0,288,0,32,34,33,0,
## Switch Module
```
2 CH Smart Switch {"NAME":"Generic","GPIO":[32,1,1,1,1,225,33,1,224,288,1,1,1,1],"FLAG":0,"BASE":18}
AGL Modulo Relay 01 Canal {"NAME":"AGL-Basic","GPIO":[0,1,0,0,224,32,0,0,0,0,320,0,0,0],"FLAG":0,"BASE":18}
AGL Módulo Relé 01 Canal {"NAME":"AGL-Basic","GPIO":[0,1,0,0,224,32,0,0,0,0,320,0,0,0],"FLAG":0,"BASE":18}
Albohes 2 Channel {"NAME":"Albohes SH-08","GPIO":[0,3200,33,3232,321,320,0,0,224,544,32,0,225,1],"FLAG":0,"BASE":18}
Athom 10A {"NAME":"CB01-TAS-1","GPIO":[0,0,0,32,320,0,0,0,0,224,0,0,0,1],"FLAG":0,"BASE":18}
Athom 2Ch Inching/Self-locking {"NAME":"Athom R02","GPIO":[1,1,1,1,225,224,1,1,1,1,1,1,576,0],"FLAG":0,"BASE":18}

View File

@ -599,6 +599,12 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) {
case 'B':
lvgl_param.flushlines = next_val(&lp1);
lvgl_param.data = next_val(&lp1);
// temporary fix to disable DMA due to a problem in esp-idf 5.3
#ifdef ESP32
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 3, 0)
lvgl_param.use_dma = false;
#endif
#endif
break;
case 'M':
rotmap_xmin = next_val(&lp1);

View File

@ -127,8 +127,8 @@ class be_class_zb_coord_ntv (scope: global, name: zb_coord_ntv, strings: weak) {
abort, ctype_func(zc_abort)
test_attr, func(zigbee_test_attr)
test_msg, func(zigbee_test_msg)
// test_attr, func(zigbee_test_attr)
// test_msg, func(zigbee_test_msg)
}
@const_object_info_end */

View File

@ -289,7 +289,7 @@ typedef union {
uint32_t influxdb_sensor : 1; // bit 10 (v11.0.0.5) - CMND_IFXSENSOR - Enable sensor support in addition to teleperiod support
uint32_t ex_serbridge_console : 1; // bit 11 (v11.1.0.4) - (v14.1.0.2) Replaced by CMND_SSERIALMODE
uint32_t telegram_disable_af : 1; // bit 12 (v14.0.0.2) - CMND_TMSTATE 6/7 - Disable Telegram auto-fingerprint fix
uint32_t spare13 : 1; // bit 13
uint32_t dali_web : 1; // bit 13 (v14.2.0.6) - CMND_DALIWEB - Enable Dali web controls
uint32_t spare14 : 1; // bit 14
uint32_t spare15 : 1; // bit 15
uint32_t spare16 : 1; // bit 16

View File

@ -18,8 +18,10 @@
#endif // ESP8266
#ifdef ESP32
#if SOC_HP_I2C_NUM > 1
#define USE_I2C_BUS2
#endif
#endif // SOC_HP_I2C_NUM
#endif // ESP32
const uint8_t I2C_RETRY_COUNTER = 3;

View File

@ -29,11 +29,16 @@
* 3 PWM3 RGB no (H801, MagicHome and Arilux LC01)
* 4 PWM4 RGBW no (H801, MagicHome and Arilux)
* 5 PWM5 RGBCW yes (H801, Arilux LC11)
* 9 reserved no
* 10 reserved yes
* 6 PWM6
* 7 PWM7
* 8 reserved
* 9 SERIAL1 no
* 10 SERIAL2 yes
* 11 +WS2812 RGB no (One WS2812 RGB or RGBW ledstrip)
* 12 AiLight RGBW no
* 13 Sonoff B1 RGBCW yes
* 14 reserved
* 15 reserved
*
* light_scheme WS2812 3+ Colors 1+2 Colors Effect
* ------------ ------ --------- ---------- -----------------

View File

@ -601,38 +601,38 @@ extern "C" {
}
extern "C" {
int zigbee_test_attr(struct bvm *vm) {
int32_t mode = be_toint(vm, 2);
if (mode < 10) {
//
} else {
Z_attribute *a = new Z_attribute();
if (mode == 10) {
a->setKeyId(1111, 2222);
a->setUInt(1337);
} else if (mode == 11) {
a->setKeyName("super_attribute");
a->key_suffix = 2;
a->setFloat(3.14);
} else if (mode == 12) {
a->setKeyName("array");
a->newJsonArray();
a->val.arrval->add((int32_t)-1);
a->val.arrval->addStr("foo");
a->val.arrval->addStr("bar");
a->val.arrval->addStr("bar\"baz\'toto");
} else if (mode == 13) {
a->setKeyName("list");
a->newAttrList();
Z_attribute &subattr1 = a->val.objval->addAttribute(10,20);
subattr1.setStr("sub1");
Z_attribute &subattr2 = a->val.objval->addAttribute(11,21);
subattr2.setStr("sub2");
}
zat_zcl_attribute(vm, a);
}
be_return(vm);
}
// int zigbee_test_attr(struct bvm *vm) {
// int32_t mode = be_toint(vm, 2);
// if (mode < 10) {
// //
// } else {
// Z_attribute *a = new Z_attribute();
// if (mode == 10) {
// a->setKeyId(1111, 2222);
// a->setUInt(1337);
// } else if (mode == 11) {
// a->setKeyName("super_attribute");
// a->key_suffix = 2;
// a->setFloat(3.14);
// } else if (mode == 12) {
// a->setKeyName("array");
// a->newJsonArray();
// a->val.arrval->add((int32_t)-1);
// a->val.arrval->addStr("foo");
// a->val.arrval->addStr("bar");
// a->val.arrval->addStr("bar\"baz\'toto");
// } else if (mode == 13) {
// a->setKeyName("list");
// a->newAttrList();
// Z_attribute &subattr1 = a->val.objval->addAttribute(10,20);
// subattr1.setStr("sub1");
// Z_attribute &subattr2 = a->val.objval->addAttribute(11,21);
// subattr2.setStr("sub2");
// }
// zat_zcl_attribute(vm, a);
// }
// be_return(vm);
// }
// Creates a zcl_attributes from Z_attribute_list
@ -651,18 +651,18 @@ extern "C" {
}
}
int zigbee_test_msg(struct bvm *vm) {
Z_attribute_list attr_list;
// int zigbee_test_msg(struct bvm *vm) {
// Z_attribute_list attr_list;
attr_list.lqi = 250;
Z_attribute &subattr1 = attr_list.addAttribute(10,20);
subattr1.setStr("sub1");
Z_attribute &subattr2 = attr_list.addAttribute(11,21);
subattr2.setStr("sub2");
// attr_list.lqi = 250;
// Z_attribute &subattr1 = attr_list.addAttribute(10,20);
// subattr1.setStr("sub1");
// Z_attribute &subattr2 = attr_list.addAttribute(11,21);
// subattr2.setStr("sub2");
zat_zcl_attribute_list(vm, 100, &attr_list);
be_return(vm);
}
// zat_zcl_attribute_list(vm, 100, &attr_list);
// be_return(vm);
// }
}
#endif // USE_ZIGBEE

View File

@ -19,6 +19,8 @@
--------------------------------------------------------------------------------------------
Version yyyymmdd Action Description
--------------------------------------------------------------------------------------------
0.1.0.3 20241010 update - Change DaliDimmer range from 0..254 to 0..100
- Add command DaliWeb 0|1 to enable persistent Web light controls
0.1.0.2 20241008 update - Better receive error detection
0.1.0.1 20241007 update - To stablizie communication send Dali datagram twice like Busch-Jaeger does
- Change DaliPower 0..2 to act like Tasmota Power (Off, On, Toggle)
@ -53,16 +55,24 @@
#define DALI_DEBUG_PIN 4
#endif
#define BROADCAST_DP 0b11111110 // 0xFE = 254
#define DALI_BROADCAST_DP 0b11111110 // 0xFE = 254
#define DALI_TOPIC "DALI"
#define D_PRFX_DALI "Dali"
const char kDALICommands[] PROGMEM = D_PRFX_DALI "|" // Prefix
"|" D_CMND_POWER "|" D_CMND_DIMMER;
"|" D_CMND_POWER
#ifdef USE_LIGHT
"|Web"
#endif // USE_LIGHT
"|" D_CMND_DIMMER ;
void (* const DALICommand[])(void) PROGMEM = {
&CmndDali, &CmndDaliPower, &CmndDaliDimmer };
&CmndDali, &CmndDaliPower,
#ifdef USE_LIGHT
&CmndDaliWeb,
#endif // USE_LIGHT
&CmndDaliDimmer };
struct DALI {
uint32_t bit_time;
@ -73,7 +83,7 @@ struct DALI {
uint8_t command;
uint8_t dimmer;
bool power;
bool input_ready;
bool available;
} *Dali = nullptr;
/*********************************************************************************************\
@ -92,7 +102,7 @@ void DaliDisableRxInterrupt(void) {
void IRAM_ATTR DaliReceiveData(void); // Fix ESP8266 ISR not in IRAM! exception
void DaliReceiveData(void) {
if (Dali->input_ready) { return; } // Skip if last input is not yet handled
if (Dali->available) { return; } // Skip if last input is not yet handled
uint32_t wait = ESP.getCycleCount() + (Dali->bit_time / 2);
int bit_state = 0;
bool dali_read;
@ -117,7 +127,7 @@ void DaliReceiveData(void) {
if (abs(bit_state) <= 2) { // Valid Manchester encoding including start and stop bits
if (Dali->received_dali_data != received_dali_data) { // Skip duplicates
Dali->received_dali_data = received_dali_data;
Dali->input_ready = true; // Valid data received
Dali->available = true; // Valid data received
}
}
}
@ -147,7 +157,7 @@ void DaliSendDataOnce(uint16_t send_dali_data) {
void DaliSendData(uint8_t firstByte, uint8_t secondByte) {
Dali->address = firstByte;
Dali->command = secondByte;
if (BROADCAST_DP == firstByte) {
if (DALI_BROADCAST_DP == firstByte) {
Dali->power = (secondByte); // State
if (Dali->power) {
Dali->dimmer = secondByte; // Value
@ -166,14 +176,15 @@ void DaliSendData(uint8_t firstByte, uint8_t secondByte) {
}
void DaliPower(uint8_t val) {
DaliSendData(BROADCAST_DP, val);
DaliSendData(DALI_BROADCAST_DP, val);
}
/***********************************************************/
void ResponseAppendDali(void) {
uint8_t dimmer = changeUIntScale(Dali->dimmer, 0, 254, 0, 100);
ResponseAppend_P(PSTR("\"" D_PRFX_DALI "\":{\"Power\":\"%s\",\"Dimmer\":%d,\"Address\":%d,\"Command\":%d}"),
GetStateText(Dali->power), Dali->dimmer, Dali->address, Dali->command);
GetStateText(Dali->power), dimmer, Dali->address, Dali->command);
}
void ResponseDali(void) {
@ -183,29 +194,54 @@ void ResponseDali(void) {
}
void DaliInput(void) {
if (Dali->input_ready) {
if (Dali->available) {
Dali->address = Dali->received_dali_data >> 8;
Dali->command = Dali->received_dali_data;
if (BROADCAST_DP == Dali->address) {
#ifdef USE_LIGHT
if (DALI_BROADCAST_DP == Dali->address) {
uint8_t dimmer_old = changeUIntScale(Dali->dimmer, 0, 254, 0, 100);
uint8_t power_old = Dali->power;
Dali->power = (Dali->command); // State
if (Dali->power) {
Dali->dimmer = Dali->command; // Value
}
if (Settings->sbflag1.dali_web) { // DaliWeb 1
uint8_t dimmer_new = changeUIntScale(Dali->dimmer, 0, 254, 0, 100);
if (power_old != Dali->power) {
ExecuteCommandPower(LightDevice(), Dali->power, SRC_SWITCH);
}
else if (dimmer_old != dimmer_new) {
char scmnd[20];
snprintf_P(scmnd, sizeof(scmnd), PSTR(D_CMND_DIMMER " %d"), dimmer_new);
ExecuteCommand(scmnd, SRC_SWITCH);
}
}
}
if (!Settings->sbflag1.dali_web) { // DaliWeb 0
ResponseDali();
MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_PRFX_DALI));
}
#else
if (DALI_BROADCAST_DP == Dali->address) {
Dali->power = (Dali->command); // State
if (Dali->power) {
Dali->dimmer = Dali->command; // Value
}
}
// AddLog(LOG_LEVEL_DEBUG, PSTR("DLI: Received 0x%04X"), Dali->received_dali_data);
ResponseDali();
MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_TELE, PSTR(D_PRFX_DALI));
#endif // USE_LIGHT
Dali->input_ready = false;
Dali->available = false;
}
}
void DaliInit(void) {
if (!PinUsed(GPIO_DALI_TX) || !PinUsed(GPIO_DALI_RX)) { return; }
bool DaliInit(void) {
if (!PinUsed(GPIO_DALI_TX) || !PinUsed(GPIO_DALI_RX)) { return false; }
Dali = (DALI*)calloc(sizeof(DALI), 1);
if (!Dali) { return; }
if (!Dali) { return false; }
Dali->pin_rx = Pin(GPIO_DALI_RX);
Dali->pin_tx = Pin(GPIO_DALI_TX);
@ -224,8 +260,31 @@ void DaliInit(void) {
Dali->bit_time = ESP.getCpuFreqMHz() * 1000000 / 2400; // Manchester twice 1200 bps = 2400 bps = 417 ms
DaliEnableRxInterrupt();
#ifdef USE_LIGHT
if (!Settings->sbflag1.dali_web) { // DaliWeb 0
return false;
}
UpdateDevicesPresent(1);
TasmotaGlobal.light_type = LT_SERIAL1; // Single channel
return true;
#else
return false;
#endif // USE_LIGHT
}
#ifdef USE_LIGHT
bool DaliSetChannels(void) {
if (Settings->sbflag1.dali_web) { // DaliWeb 1
uint8_t value = ((uint8_t*)XdrvMailbox.data)[0];
if (255 == value) { value = 254; } // Max Dali value
DaliPower(value);
}
return true;
}
#endif // USE_LIGHT
/*********************************************************************************************\
* Experimental - Not functioning
\*********************************************************************************************/
@ -263,7 +322,7 @@ bool DaliMqtt(void) {
int DALIindex = 0;
int ADRindex = 0;
int CMDindex = 0;
uint8_t DALIaddr = BROADCAST_DP;
uint8_t DALIaddr = DALI_BROADCAST_DP;
if (strcasecmp_P(items[cnt - 3], PSTR(DALI_TOPIC)) != 0) { // dali
// cmnd
@ -320,7 +379,7 @@ bool DaliJsonParse(void) {
int DALIindex = 0;
int ADRindex = 0;
int8_t DALIdim = -1;
uint8_t DALIaddr = BROADCAST_DP;
uint8_t DALIaddr = DALI_BROADCAST_DP;
JsonParserToken val = root[PSTR("cmd")];
if (val) {
@ -383,13 +442,26 @@ void CmndDaliPower(void) {
}
void CmndDaliDimmer(void) {
// DaliDimmer 0..254 - Set power off or dimmer state
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 254)) {
DaliPower(XdrvMailbox.payload);
// DaliDimmer 0..100 - Set power off or dimmer state
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 100)) {
uint8_t dimmer = changeUIntScale(XdrvMailbox.payload, 0, 100, 0, 254);
DaliPower(dimmer);
}
ResponseDali();
}
#ifdef USE_LIGHT
void CmndDaliWeb(void) {
// DaliWeb 0 - Disable GUI light controls
// DaliWeb 1 - Enable GUI light controls
if (XdrvMailbox.data_len > 0) {
Settings->sbflag1.dali_web = XdrvMailbox.payload &1;
TasmotaGlobal.restart_flag = 2;
}
ResponseCmndStateText(Settings->sbflag1.dali_web);
}
#endif // USE_LIGHT
/*********************************************************************************************\
* Presentation
\*********************************************************************************************/
@ -408,8 +480,8 @@ void DaliShow(bool json) {
bool Xdrv75(uint32_t function) {
bool result = false;
if (FUNC_INIT == function) {
DaliInit();
if (FUNC_MODULE_INIT == function) {
result = DaliInit();
}
else if (Dali) {
switch (function) {
@ -419,6 +491,11 @@ bool Xdrv75(uint32_t function) {
case FUNC_MQTT_DATA:
result = DaliMqtt();
break;
#ifdef USE_LIGHT
case FUNC_SET_CHANNELS:
result = DaliSetChannels();
break;
#endif // USE_LIGHT
case FUNC_JSON_APPEND:
DaliShow(true);
break;