diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index edb5f2c4e..0b3b15674 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -6,8 +6,8 @@
- [ ] The pull request is done against the latest development branch
- [ ] Only relevant files were touched
- [ ] Only one feature/fix was added per PR and the code change compiles without warnings
- - [ ] The code change is tested and works with Tasmota core ESP8266 V.2.7.7
- - [ ] The code change is tested and works with Tasmota core ESP32 V.3.0.4
+ - [ ] The code change is tested and works with Tasmota core ESP8266 V.2.7.8
+ - [ ] The code change is tested and works with Tasmota core ESP32 V.3.1.0.240926
- [ ] I accept the [CLA](https://github.com/arendst/Tasmota/blob/development/CONTRIBUTING.md#contributor-license-agreement-cla).
_NOTE: The code change must pass CI tests. **Your PR cannot be merged unless tests pass**_
diff --git a/.gitignore b/.gitignore
index 6ef9fd6b5..2b1761446 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,13 +8,17 @@
*.o
*.gcno
*.gcda
+dependencies.lock
## Project files ######
+managed_components
.platformio
.pio
.clang_complete
.gcc-flags.json
.cache
+.dummy
+sdkconfig.*
data
unpacked_fs
unpacked_boards
@@ -42,3 +46,7 @@ lib/libesp32/berry/berry
.vscode/extensions.json
*.bak
*.code-workspace
+
+## Python virtual environments for Platformio ##
+venv
+.venv
diff --git a/BUILDS.md b/BUILDS.md
index db4a723ca..b8f12a5f6 100644
--- a/BUILDS.md
+++ b/BUILDS.md
@@ -104,10 +104,15 @@ Note: the `minimal` variant is not listed as it shouldn't be used outside of the
| | | | | | | |
| **Feature or Sensor** | **l** | **t** | **k** | **s** | **i** | **d** | **Remarks** |
| USE_I2C | - | x / x | x | x | - | x |
+| USE_RTC_CHIPS | - | - / x | - | - | - | - |
+| -USE_DS3231 | - | - / - | - | - | - | - |
+| -USE_BM8563 | - | - / x | - | - | - | - |
+| -USE_PCF85363 | - | - / - | - | - | - | - |
+| -USE_RX8010 | - | - / - | - | - | - | - |
| USE_SHT | - | - / x | - | x | - | - |
| USE_HTU | - | - / x | - | x | - | - |
| USE_BMP | - | - / x | - | x | - | - |
-| USE_BME68X | - | - / x | - | x | - | - |
+| -USE_BME68X | - | - / x | - | x | - | - |
| USE_AMSX915 | - | - / - | - | - | - | - |
| USE_SPL06_007 | - | - / - | - | - | - | - |
| USE_QMP6988 | - | - / - | - | - | - | - |
@@ -139,7 +144,6 @@ Note: the `minimal` variant is not listed as it shouldn't be used outside of the
| USE_ENS16x | - | - / - | - | - | - | - |
| USE_ENS210 | - | - / - | - | - | - | - |
| USE_MPU6050 | - | - / - | - | - | - | - |
-| USE_DS3231 | - | - / - | - | - | - | - |
| USE_MGC3130 | - | - / - | - | - | - | - |
| USE_MAX44009 | - | - / - | - | - | - | - |
| USE_SCD30 | - | - / x | - | x | - | - |
@@ -187,12 +191,10 @@ Note: the `minimal` variant is not listed as it shouldn't be used outside of the
| USE_EZORTD | - | - / - | - | - | - | - |
| USE_SEESAW_SOIL | - | - / - | - | - | - | - |
| USE_TOF10120 | - | - / - | - | - | - | - |
-| USE_BM8563 | - | - / - | - | - | - | - |
| USE_AM2320 | - | - / - | - | - | - | - |
| USE_T67XX | - | - / - | - | - | - | - |
| USE_HM330X | - | - / - | - | - | - | - |
| USE_HDC2010 | - | - / - | - | - | - | - |
-| USE_PCF85363 | - | - / - | - | - | - | - |
| USE_DS3502 | - | - / - | - | - | - | - |
| USE_HYT | - | - / - | - | - | - | - |
| USE_LUXV30B | - | - / - | - | - | - | - |
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 58f6e0d74..423519e01 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,132 @@ All notable changes to this project will be documented in this file.
## [14.2.0] 20240814
- Release Rita
+## [14.2.0.6]
+### Added
+- Support for Sonoff SPM v1.3.0 (#13447)
+- LVGL port `colorwheel` from LVGL 8 (#22244)
+- HASPmota `cpicker` and `msgbox` (#22244)
+- Support for DALI 1 on ESP8266
+
+### Breaking Changed
+
+### 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)
+
+### Fixed
+- ESP32 Range Extender compile error with core 3.0.0 (#22205)
+- HASPmota error when page '1' is not defined (#22220)
+- ESP32-S3 uDisplay force cache writes to RGB display (#22222)
+- ESP32 Dali compile error with core 3.x (#22214)
+- Dali received data decoding
+- ESP32 Ethernet using EthClockMode 3 (#22248)
+
+### Removed
+
+## [14.2.0.5] 20240926
+### Added
+- ESP8266 support for I2C CLK on GPIO16 (#22199)
+- ESP8266 support for one-wire M1601 temperature sensor on DS18x20 GPIO (#21376)
+- Support for BL0906 up to 6 channel energy monitor as used in Athom EM2/EM6 (#22167)
+
+### Changed
+- ESP8266 platform update from 2024.06.00 to 2024.09.00 and Framework (Arduino Core) from v2.7.7 to v2.7.8 (#22199)
+
+### Fixed
+- HASPmota broken `changed` event (#22194)
+
+## [14.2.0.4] 20240924
+### Added
+- HX711 optional calibration precision option on command ``Sensor34 2 `` where `` is 1 to 20 (#13983)
+- Matter support for Zigbee Occupancy and Light 0/1/2 (OnOff / Dimmer / White Color Temperature) (#22110)
+- KNX additional KnxTx functions and define KNX_USE_DPT9 (#22071)
+- Support for I2C M5Unit (Mini)Scales using HX711 driver
+- Berry virtual Energy driver (#22134)
+- Support for RX8010 RTC as used in IOTTIMER (#21376)
+- ESP8266 experimental support for second I2C bus
+- Berry improve `int64` constructor (#22172)
+- MQTT warning if trying to connect without TLS on a port that normally uses TLS (#22175)
+
+### Changed
+- Refactored I2C drivers HTU21, BH1750, SHT3x, iAQ and HYT
+- Add command entered to command error and command unknown message
+- ESP32 platform update from 2024.08.11 to 2024.09.10 and Framework (Arduino Core) from v3.0.4 to v3.0.5 (#22163)
+- SCD30 Lowered I2C clock from 100k to 50k (#15438)
+- Refactor and fix PID sensor (PID_USE_LOCAL_SENSOR) read race condition (#22162)
+
+### Fixed
+- Shutter missing HOLD on shutterbutton (#22108)
+- ModbusBridge request and response logic (#22075)
+- Berry energy missing attributes (#22116)
+- Zigbee flashing CC2562P with latest firmware (#22117)
+- SML trx pin error (#22119)
+- Shutter remaining issues on shutterinvert (#22120)
+- Berry I2C to prepare M5Stack I2C STM32 based devices (#22143)
+- Autoconf prevent 'init.bat' from stopping on empty lines (#22158)
+- Compilation exception when metrics not found (#22170)
+- ESP8266 Exception 3 on tasmota-minimal caused by unaligned PROGMEM (#22169)
+- LVGL compilation of lv_menu (#22188)
+
+## [14.2.0.3] 20240908
+### Added
+- Command ``SetOption69 1`` to enable Serial Bridge inverted Receive (#22000)
+- Support nexus protocol and calculation of separation limit to rc-switch library (#21886)
+- Zigbee Koenkk firmware 20240710 for Sonoff Zigbee ZBPro (#22076)
+- Berry Zigbee improvements to prepare Matter (#22083)
+- Matter support for Zigbee Temperature, Humidity and Pressure sensors (#22084)
+- SML multi TRX line (#22056)
+
+### Breaking Changed
+- Berry make `energy` modules changes from #21887 backwards compatible (#22046)
+
+### Changed
+- ESP32 platform update from 2024.08.10 to 2024.08.11 (#22021)
+- ESP32 LVGL library from v9.1.0 to v9.2.0 (#22031)
+
+### Fixed
+- Matter fixed UI bug when no endpoints configured (#22008)
+- Zigbee extend timeout for MCU reboot from 5s to 10s (#22009)
+- Matter fix when Rules are disabled (#22016)
+- BearSSL panic on ESP8266 in rare conditions (#22017)
+- Crash when calling TasmotaSerial destructor when initialized with incorrect arguments (#22036)
+- LVGL Added OpenHASP icons to font `montserrat-28` (#22048)
+- Matter fail to report Shutter status if no shutter is configured in Tasmota (#22049)
+- Matter fix Waterleak broken after Berry solidification optimisation #21885 (#22052)
+- Berry avoid `readbytes()` from crashing when file is too large (#22057)
+- Zigbee avoid disabling console serial on ESP32 and improved log messages (#22082)
+
+### Removed
+- Berry remove reuse of methods for interface-like code reuse #21500 (#22055)
+
+## [14.2.0.2] 20240823
+### Changed
+- Energy BL09xx command ``CurrentSet`` input changed from Ampere to milliAmpere
+- GPIOViewer from v1.5.5 to v1.5.6
+
+## [14.2.0.1] 20240821
+### Added
+- Energy Log level 4 message when (Calculated) Apparent Power is less than Active Power indicating wrong calibration (#20653)
+- Energy command ``PowerSet 60,230`` to calibrate both Current and Power with known resistive load of 60W at 230V using calibrated Voltage
+- Energy command ``CurrentSet 60,230`` to calibrate both Power and Current with known resistive load of 60W at 230V using calibrated Voltage
+
+### Changed
+- Energy force Apparent Power equals Active Power when (Calculated) Apparent Power is less than Active Power (#20653)
+
+### Fixed
+- Shutter timing registers overflow (#21966)
+- PZEM continue energy monitoring when one phase fails (#21968)
+- Energy calculation (#20653)
+
+### Removed
+- ESP8266 Analog input support using energy driver as only one channel is available
+
+## [Released]
+
+## [14.2.0] 20240814
+- Release Rita
+
## [14.1.0.4] 20240814
### Added
- Support for Sonoff iFan04-H using template (#16402)
@@ -70,12 +196,13 @@ All notable changes to this project will be documented in this file.
- ESP32 platform update from 2024.06.11 to 2024.07.10 (#21745)
- ESP32 platform update from 2024.07.10 to 2024.07.11 (#21765)
- Berry simplified `module persist` (#21812)
+- GPIOViewer from v1.5.4 to v1.5.5 (No functional change)
### Fixed
- Berry `bytes.resize()` for large sizes (#21716)
- On universal display remove default backlight power if a single PWM channel is used for backlight. Regression from 14.0.0.1 (#21726)
- ESP32 I2S fixes (#21770)
-- ESP32 Resistive Touch xpt for 2 spi busses (#21814)
+- ESP32 Resistive Touch xpt for 2 spi buses (#21814)
## [14.1.0.2] 20240627
### Added
@@ -253,8 +380,8 @@ All notable changes to this project will be documented in this file.
- Neopool prevent possible multiple bus requests (#21267)
- Berry `web_add_handler` called before `Webserver` is initialized (#21272)
- Put back wifi IPv6 workaround (#21274)
-- Async HMDI CEC (#21287)
-- Berry `math.inf`, `math.isinf()` and fixed json ouput for `inf` and `nan` (#21304)
+- Async HDMI CEC (#21287)
+- Berry `math.inf`, `math.isinf()` and fixed json output for `inf` and `nan` (#21304)
- Compilation of Ethernet when SPI drivers are disabled (#21321)
- Conflicting log_level definitions in NimBLE (#21337)
- Avoid unwanted OTA upgrade when safeboot starts for the first time (#21360)
@@ -488,7 +615,7 @@ All notable changes to this project will be documented in this file.
- Web file upload response on upload error (#20340)
- ESP32 shutter exception 6 (divide by zero) on ``ShutterMode 4`` (#20524)
- GPIOViewer exception 3
-- Berry assigment to list with negative index (#20537)
+- Berry assignment to list with negative index (#20537)
- Matter support for Alexa (#20545)
- ESP8266 IPv6 support (#20539)
- ESP32 Audio for Core3, MP3Stream and Shine (#20540)
@@ -871,7 +998,7 @@ All notable changes to this project will be documented in this file.
- Shutter bootloop using more than 4 shutters (#18673)
- AIThinker webcam issues (#18652)
- Berry `tasmota.wifi()` would wrongly report wifi as up
-- Inverted shutter now reflect status also in WEBGUI and several minor fixes to make "inverted" consistant (#18701)
+- Inverted shutter now reflect status also in WEBGUI and several minor fixes to make "inverted" consistent (#18701)
- Matter fix fabric provisioning from CASE session for iOS 16.5 (#18709)
- ESP32 SPI initialization for MFRC522 (#18711)
- Freeze BMP readings before deepsleep (#18720)
@@ -891,7 +1018,7 @@ All notable changes to this project will be documented in this file.
- Support for PCA9557 8-bit I/O expander (#18632)
- Matter support for async HTTP for bridged devices (#18656)
- Zigbee support for air sensors (#18665)
-- Command ``I2cScan0`` to scan both busses on ESP32 with one command
+- Command ``I2cScan0`` to scan both buses on ESP32 with one command
### Breaking Changed
- Change command ``FileUpload`` index binary data detection from >199 to >299
@@ -1007,7 +1134,7 @@ All notable changes to this project will be documented in this file.
### Changed
- ADC Range oversample from 2 to 32 (#17975)
- ESP32 Framework (Core) from v2.0.6 to v2.0.7
-- Move #define OTA_URL from user_config.h to board files for better inital support (#18008)
+- Move #define OTA_URL from user_config.h to board files for better initial support (#18008)
- Increase number of (virtual)relays and (virtual)buttons to 32
- LibTeleinfo from v1.1.3 to v1.1.5 (#18050)
@@ -1074,7 +1201,7 @@ All notable changes to this project will be documented in this file.
- Support for PCA9632 4-channel 8-bit PWM driver as light driver by Pascal Heinrich (#17557)
- Berry `bytes()` now evaluates to `false` if empty
- Berry ``crypto.AES_CCM`` (required by Matter protocol)
-- ESP32 support for BMPxxx sensors on two I2C busses (#17643)
+- ESP32 support for BMPxxx sensors on two I2C buses (#17643)
- Berry add implicit ``_class`` parameter to static methods
### Changed
@@ -1386,9 +1513,9 @@ All notable changes to this project will be documented in this file.
## [12.0.2.2] 20220701
### Added
-- Command ``GlobalTemp2 1..250`` to select Global Temperature source indexed from teleperiod occurance data (#15834)
-- Command ``GlobalHum2 1..250`` to select Global Humidity source indexed from teleperiod occurance data (#15834)
-- Command ``GlobalPress2 1..250`` to select Global Pressure source indexed from teleperiod occurance data (#15834)
+- Command ``GlobalTemp2 1..250`` to select Global Temperature source indexed from teleperiod occurrence data (#15834)
+- Command ``GlobalHum2 1..250`` to select Global Humidity source indexed from teleperiod occurrence data (#15834)
+- Command ``GlobalPress2 1..250`` to select Global Pressure source indexed from teleperiod occurrence data (#15834)
## [12.0.2.1] 20220622
### Added
@@ -1459,7 +1586,7 @@ All notable changes to this project will be documented in this file.
- Command ``EnergyExportActive`` to (p)reset energy export active for supported devices. Currently ADE7880 only (#13515)
- Sonoff SPM delayed SetPowerOnState (#13447)
- Command ``SetOption139 0/1`` to switch between pressure unit "mmHg" (0) or "inHg" (1) when ``SO24 1`` (#15350)
-- Support for flowrate meters like YF-DN50 and similary (#15474)
+- Support for flowrate meters like YF-DN50 and similar (#15474)
- Command ``IfxRp ""|`` adds optional InfluxDb Retention Policy (#15513)
- Command ``SetOption140 0/1`` to switch between MQTT Clean Session (0) or Persistent Session (1) (#15530)
@@ -1716,7 +1843,7 @@ All notable changes to this project will be documented in this file.
### Changed
- (Internal) Range conversion edge values
- NimBLE to v.1.3.3
-- MQTT TLS dual mode (CA or fingeprint) in same firmware, ``SetOption132 1`` to force fingerprint
+- MQTT TLS dual mode (CA or fingerprint) in same firmware, ``SetOption132 1`` to force fingerprint
- Toolchains for ESP32x changed from 8.4.0-2021r1 to 8.4.0-2021r2
### Fixed
@@ -1731,7 +1858,7 @@ All notable changes to this project will be documented in this file.
- ESP32 fix leftover GPIO configuration after restart
- ESP32 Proof of Concept Sonoff SPM with limited functionality (switching and energy monitoring) (#13447)
- WS2812 scheme 13 stairs effect (#13595)
-- ESP32 Preliminary support for Tasmota Apps (.tapp extesions)
+- ESP32 Preliminary support for Tasmota Apps (.tapp extensions)
- ESP32 Berry support for neopixel (WS2812, SK6812)
- Command ``IfxPeriod `` to overrule ``Teleperiod`` for Influx messages (#13750)
- ESP32 OTA over HTTPS
@@ -1740,7 +1867,7 @@ All notable changes to this project will be documented in this file.
### Changed
- ESP8266 Gratuitous ARP enabled and set to 60 seconds (#13623)
-- Removed ILI9488 driver in favor of Unversal Display Driver
+- Removed ILI9488 driver in favor of Universal Display Driver
- IRremoteESP8266 library from v2.7.20 to v2.8.0 (#13738)
- Ethernet hostname ending in ``_eth`` to ``-eth`` according to RFC952
- ESP32 core library from v2.0.1 to v2.0.1.1 (#13768)
@@ -1861,7 +1988,7 @@ All notable changes to this project will be documented in this file.
## [9.5.0.6] 20210820
### Added
-- Version bump to monitor possible HTTP issues releated to ``SetOption128``
+- Version bump to monitor possible HTTP issues related to ``SetOption128``
### Changed
- Berry now compiling in ``strict`` mode to catch more bugs
@@ -2516,7 +2643,7 @@ All notable changes to this project will be documented in this file.
- Exception 28 due to device group buffer overflow (#9459)
- Shutter timing problem due to buffer overflow in calibration matrix (#9458)
- Light wakeup exception 0 (divide by zero) when ``WakeupDuration`` is not initialised (#9466)
-- ADC initalization sequence (#9473)
+- ADC initialization sequence (#9473)
- Thermostat sensor status corruption regression from v8.5.0.1 (#9449)
### Removed
@@ -2610,7 +2737,7 @@ All notable changes to this project will be documented in this file.
- Command ``DzSend ,`` to send values or state to Domoticz
- Command ``SetOption100 0/1`` to remove Zigbee ``ZbReceived`` value from ``{"ZbReceived":{xxx:yyy}}`` JSON message
- Command ``SetOption101 0/1`` to add the Zigbee source endpoint as suffix to attributes, ex `Power3` instead of `Power` if sent from endpoint 3
-- Command (``S``)``SerialSend6`` \ (#8937)
+- Command (``S``)``SerialSend6`` \ (#8937)
- Support for Sonoff Zigbee Bridge as module 75 (#8583)
### Changed
@@ -2629,7 +2756,7 @@ All notable changes to this project will be documented in this file.
- Command ``SetOption97 0/1`` to switch between Tuya serial speeds 9600 bps (0) or 115200 bps (1)
- Command ``SetOption98 0/1`` to provide rotary rule triggers (1) instead of controlling light (0)
- Command ``SetOption99 0/1`` to enable zero cross detection on PWM dimmer
-- Support for Energy sensor (Denky) for French Smart Metering meter provided by global Energy Providers, need a adaptater. See dedicated full [blog](http://hallard.me/category/tinfo/) about French teleinformation stuff
+- Support for Energy sensor (Denky) for French Smart Metering meter provided by global Energy Providers, need a adapter. See dedicated full [blog](http://hallard.me/category/tinfo/) about French teleinformation stuff
- Library to be used for decoding Teleinfo (French Metering Smart Meter)
- Support for single wire LMT01 temperature Sensor by justifiably (#8713)
- Compile time interlock parameters (#8759)
@@ -3070,7 +3197,7 @@ All notable changes to this project will be documented in this file.
- Fix Zigbee uses Hardware Serial if GPIO 1/3 or GPIO 13/15 and SerialLog 0 (#7071)
- Fix WS2812 power control (#7090)
- Change light color schemes 2, 3 and 4 from color wheel to Hue driven with user Saturation control
-- Change log buffer size from 520 to 700 characters accomodating full rule text (#7110)
+- Change log buffer size from 520 to 700 characters accommodating full rule text (#7110)
### 7.1.1 20191201
@@ -3432,7 +3559,7 @@ All notable changes to this project will be documented in this file.
- Add user configurable ADC0 to Module and Template configuration compatible with current FLAG options (#5671)
- Add AriLux RF control GPIO option "ALux IrSel" (159) replacing "Led4i" (59) for full LED control (#5709)
- Add LED GPIO option "LedLink" (157) and "LedLinki" (158) to select dedicated link status LED (#5709)
-- Add all 5 PWM channels individually adressable with LEDs. (#5741)
+- Add all 5 PWM channels individually addressable with LEDs. (#5741)
- Add reset of Energy values when connection to sensor is lost for over 4 seconds (#5874, #5881)
- Add checkbox to GUI password field enabling visibility during password entry only (#5934)
@@ -3460,7 +3587,7 @@ All notable changes to this project will be documented in this file.
- Fix mDNS addService (#4938, #4951)
- Fix HAss discovery of MHZ19(B) sensors (#4992)
- Fix some exceptions and watchdogs due to lack of stack space (#5215)
-- Fix GUI wifi password acception starting with asteriks (*) (#5231, #5242)
+- Fix GUI wifi password acception starting with asterisks (*) (#5231, #5242)
- Fix command WebSend intermittent results (#5273, #5304)
- Fix additional characters in fallbacktopic, hostname and mqttclient on core 2.5.0 (#5359, #5417)
- Fix Energy TotalStartTime when commands EnergyReset0 and/or EnergyReset3 used (#5373)
@@ -3710,7 +3837,7 @@ All notable changes to this project will be documented in this file.
- Remove forced restart when sleep command is executed (#3554)
- Fix invalid response using more than 4 switches and domoticz
- Fix sonoff-minimal not using default settings
-- Fix unsecure main webpage update
+- Fix insecure main webpage update
- Fix DHT driver mixing values for different sensors (#1797)
- Fix EnergyReset3 regression not clearing total energy (#2723)
- Fix rules once regression from v6.1.0 (#3198, #3226)
@@ -3785,10 +3912,10 @@ All notable changes to this project will be documented in this file.
- Add CRC to Settings making future upgrades more fail-safe
- Add feature information to Status 4
- Add tools folder with python script decode-status.py for decoding some status fields like SetOption and Features
-- Add Slots on the KNX Web Menu to select Group Addess to receive data to trigger rules
+- Add Slots on the KNX Web Menu to select Group Address to receive data to trigger rules
- Add two rule sets of 511 characters using commands rule1, rule2 and rule3
- Add Console Commands to send KNX Commands and KNX Values
-- Add Slots on the KNX Web Menu to select Group Addess to send data from console commands
+- Add Slots on the KNX Web Menu to select Group Address to send data from console commands
- Add Events to trigger rules when a command or read requests is received from KNX
- Add command SetOption30 to enforce Hass discovery as light group (#1784)
- Add support for BlitzWolf BW-SHP2 (and Homecube, Gosund SP1) Energy Monitoring Smart Socket (#2223)
@@ -3861,8 +3988,8 @@ All notable changes to this project will be documented in this file.
- Change user_config_override usage by providing user_config_override_sample.h (#2228)
- Change MQTT response topic for Energy changes from ENERGY to SENSOR (#2229, #2251)
- Change default Reset configuration time from 4 seconds to 40 seconds on Button hold (#2268)
-- Change ESP8266 Analog JSON message from {"Analog0:123"} to {"ANALOG":{"A0:123"}} to accomodate rules (#2560)
-- Change Counter JSON message from {"Counter1":0,"Counter3":0} to {"COUNTER":{"C1":0,"C3":0}} to accomodate rules
+- Change ESP8266 Analog JSON message from {"Analog0:123"} to {"ANALOG":{"A0:123"}} to accommodate rules (#2560)
+- Change Counter JSON message from {"Counter1":0,"Counter3":0} to {"COUNTER":{"C1":0,"C3":0}} to accommodate rules
- Change ADS1115 JSON message from {"ADS1115":{"Analog0":123,"Analog1":123}} to {"ADS1115":{"A0":123,"A1":123}}
- Fix intermittent exception when dns lookup is used while sleep is enabled
- Fix 5.4.0 regression turning off single press after button hold during 4x hold time
@@ -3870,7 +3997,7 @@ All notable changes to this project will be documented in this file.
- Fix NTP sync to Thu Jan 01 08:00:10 1970 results in uptime 17651+ days (core2.4.1/sdk2.2.1)
- Fix MAX31850 higher temperatures (#1269)
- Fix freeing more code space when emulation is disabled (#1592)
-- Fix providing web page configuratin option for Friendly Name when no device (relay or light) is configured (#1850)
+- Fix providing web page configuration option for Friendly Name when no device (relay or light) is configured (#1850)
- Fix compile error when define HOME_ASSISTANT_DISCOVERY_ENABLE is not set (#1937)
- Fix MQTT TLS fingerprint validation (#2033)
- Fix update temperature on DS18x20 drivers (#2328)
@@ -3934,7 +4061,7 @@ All notable changes to this project will be documented in this file.
- Add multiple color entry support for command Led like Led2 120000 001200 000012 setting led2 as Red, Led3 as Green and Led4 as Blue (#2303)
- Add hexadecimal RGB color entry on RGBCW leds (#2304)
- Add support for SGP30 gas and air quality sensor (#2307)
-- Add optional Sunrise and Sunset timers with commands Latitide and Longitude to be enabled with define USE_SUNRISE in user_config.h (#2317)
+- Add optional Sunrise and Sunset timers with commands Latitude and Longitude to be enabled with define USE_SUNRISE in user_config.h (#2317)
- Add timer sunrise and sunset offset (#2378)
- Add user selectable defines for Sunrise/set Dawn option (#2378)
- Add optional KNX IP Protocol Support (#2402)
@@ -3961,7 +4088,7 @@ All notable changes to this project will be documented in this file.
- Change weblog memory usage (#1730, #1793, #1819)
- Update TasmotaSerial library to 1.1.0
- Update language files Italian (#1594), Dutch (#1723) and Spanish (#1722)
-- Fix Non-English JSON temperature unit attachement
+- Fix Non-English JSON temperature unit attachment
- Fix Arilux RF induced exception by moving interrupt handler to iram on non ESP8266/Arduino lib v2.3.0
- Fix truncated command names and wrong response for DomoticzSwitchIdx (#1571)
- Fix %-sign issue as printf escape character in Humidity and Sonoff SC (#1579)
@@ -4229,7 +4356,7 @@ All notable changes to this project will be documented in this file.
- Add Sonoff T1 support (#582)
- Add AnalogInput0 if configured as Analog Input to webpage (#697, #746)
- Add command SetOption14 0|1 to enable interlock mode (#719, #721)
-- Fix Mitsubishi HVAC IR power controll (#740)
+- Fix Mitsubishi HVAC IR power control (#740)
### 5.5.2 20170808
@@ -4259,9 +4386,9 @@ All notable changes to this project will be documented in this file.
- Smoothing WS2812 animation poll, invert fade speed and max allowed wakeup time down to 3000 seconds
- Fix initial button press detection
- Add support for Sonoff RF Bridge 433 using command RfKey
-- Fix regression from 5.0.7 by increasing message buffer size from 360 to 368 to accomodate 4 x DS18x20 sensors (#637)
+- Fix regression from 5.0.7 by increasing message buffer size from 360 to 368 to accommodate 4 x DS18x20 sensors (#637)
- Add GroupTopic to Topic test when using ButtonTopic/SwitchTopic to send either ON/OFF or TOGGLE (#642)
-- Adjust HLW calibration limits to accomodate HuaFan device and add commands HlwPSet, HlwUSet and HlwISet (#654)
+- Adjust HLW calibration limits to accommodate HuaFan device and add commands HlwPSet, HlwUSet and HlwISet (#654)
### 5.4.0 20170725
@@ -4439,7 +4566,7 @@ All notable changes to this project will be documented in this file.
### 4.1.3 20170410
-- Add user configuarble GPIO to module S20 Socket and Slampher
+- Add user configurable GPIO to module S20 Socket and Slampher
- Add support for Sonoff SC (#112)
- Set PWM frequency from 1000Hz to 910Hz as used on iTead Sonoff Led firmware (#122)
- Set Sonoff Led unconfigured floating outputs to 0 to reduce exceptions due to power supply instabilities (#122)
@@ -4500,7 +4627,7 @@ All notable changes to this project will be documented in this file.
- Add PWM output control with commands PWM1 to PWM5 using user selectable GPIOs (#211)
- Fix exceptions due to low values of commands HlwPCal (10000), HlwUCal (1000) and HlwICal (2500) (#223)
- Add Switch state to sensor status (#227, #233)
-- Add user configuarble GPIO to module Sonoff Touch (#228)
+- Add user configurable GPIO to module Sonoff Touch (#228)
- Add define WEB_PORT to user_config.h to change default web server port from 80 (#232)
- Fix failed Ota Firmware upgrade started from Web page (#235)
@@ -4904,7 +5031,7 @@ All notable changes to this project will be documented in this file.
- Add optional EXPERIMENTAL TLS to MQTT (#49)
- Fix MQTT payload handling (#111)
-- Optimzed WeMo code
+- Optimized WeMo code
### 2.0.21a 20161201
@@ -5000,7 +5127,7 @@ All notable changes to this project will be documented in this file.
### 2.0.8 20161108
- Add initial status after power on
-- Seperate driver files
+- Separate driver files
- Fix hlw code and calibrate Pow
- Move user config defines to user_config.h (#61)
@@ -5063,7 +5190,7 @@ All notable changes to this project will be documented in this file.
- Add more lines to console
- Add timeout and disable MQTT on web upload
-- Add command SAVEDATA to control parameter save (for flash wear afficionados) (#30)
+- Add command SAVEDATA to control parameter save (for flash wear aficionados) (#30)
### 1.0.34 20160926
@@ -5088,7 +5215,7 @@ All notable changes to this project will be documented in this file.
- Fix DS18B20 misread if teleperiod = 2
- Tuned sensor code
-- Updated prefered ElectroDragon connection to Relay 1 and Button 1
+- Updated preferred ElectroDragon connection to Relay 1 and Button 1
- Moved SONOFF and ELECTRO_DRAGON port config to user_config.h
### 1.0.30 20160902
@@ -5219,7 +5346,7 @@ All notable changes to this project will be documented in this file.
### 1.0.14 20160722
-- Seperate user config from sonoff.ino to user_config.h (pucebaboon)
+- Separate user config from sonoff.ino to user_config.h (pucebaboon)
- Change defaults from sidnas2 to domus1
- Add MQTT status message as status 6 (pucebaboon)
- Add status type to message (pucebaboon)
@@ -5264,7 +5391,7 @@ All notable changes to this project will be documented in this file.
- Add UDP syslog support
- Change HOST command to MQTTHOST command
- Add commands SYSLOG, SERIALLOG and LOGHOST
-- Change hostname to lower case to distinguise between open-sdk version
+- Change hostname to lower case to distinguish between open-sdk version
- Add support for ESP-12F used in my modified wkaku power socket switch
- Fix timezone command
- Add RTC month names for future use
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 000000000..0bb697982
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.16.0)
+include($ENV{IDF_PATH}/tools/cmake/project.cmake)
+
+project(tasmota)
+
+if(CONFIG_IDF_TARGET_ESP32C2)
+ include(relinker)
+endif()
diff --git a/CODE_OWNERS.md b/CODE_OWNERS.md
index c6b33cdf6..f70f2b8ff 100644
--- a/CODE_OWNERS.md
+++ b/CODE_OWNERS.md
@@ -86,7 +86,7 @@ In addition to @arendst the following code is mainly owned by:
| xdrv_72_pipsolar | @chefpro
| xdrv_73_lora | @arendst
| xdrv_74 |
-| xdrv_75 |
+| xdrv_75_dali | @eeak, @arendst
| xdrv_76 |
| xdrv_77 |
| xdrv_78 |
@@ -98,7 +98,7 @@ In addition to @arendst the following code is mainly owned by:
| xdrv_86_esp32_sonoff_spm | @arendst
| xdrv_87_esp32_sonoff_tm1621 | @arendst
| xdrv_88_esp32_shelly_pro | @arendst
-| xdrv_89_esp32_dali | @eeak
+| xdrv_89_ |
| xdrv_90_esp32_dingtian_relay | @barbudor
| xdrv_91_ |
| xdrv_92_ |
diff --git a/I2CDEVICES.md b/I2CDEVICES.md
index 53167f88f..d873bbd59 100644
--- a/I2CDEVICES.md
+++ b/I2CDEVICES.md
@@ -126,4 +126,7 @@ Index | Define | Driver | Device | Address(es) | Bus2 | Descrip
86 | USE_AMSX915 | xsns_114 | AMS6915 | 0x28 | | Pressure (absolute/differential) and temperature sensor
87 | USE_SPL06_007 | xsns_25 | SPL06-007 | 0x76 | | Pressure and temperature sensor
88 | USE_QMP6988 | xsns_28 | QMP6988 | 0x56, 0x70 | Yes | Pressure and temperature sensor
+ 89 | USE_HX711_M5SCALES | xsns_34 | M5SCALES | 0x26 | Yes | M5Unit (Mini)Scales(HX711 STM32) U177
+ 90 | USE_RX8010 | xdrv_56 | RX8010 | 0x32 | Yes | RX8010 RTC from IOTTIMER
+
NOTE: Bus2 supported on ESP32 only.
diff --git a/RELEASENOTES.md b/RELEASENOTES.md
index f0f395004..1208bff17 100644
--- a/RELEASENOTES.md
+++ b/RELEASENOTES.md
@@ -34,16 +34,11 @@ While fallback or downgrading is common practice it was never supported due to S
## Supported Core versions
-This release will be supported from ESP8266/Arduino library Core version **2.7.7** due to reported security and stability issues on previous Core version. This will also support gzipped binaries.
+This release will be supported from ESP8266/Arduino library Core version **2.7.8** due to reported security and stability issues on previous Core version. This will also support gzipped binaries.
-This release will be supported from ESP32/Arduino library Core version **3.0.4**.
+This release will be supported from ESP32/Arduino library Core version **v3.1.0.240926**.
-Support of ESP8266 Core versions before 2.7.7 and ESP32 Core versions before 3.0.4 have been removed.
-
-### Known issues with v14.2.0
-
-Due to the change from ESP32 Arduino Core2/IDF4 to Arduino Core3/IDF5 not all functionality has been restored. The following features are known not to work on ESP32:
-- Wifi Range Extender [#21200](https://github.com/arendst/Tasmota/issues/21200)
+Support of ESP8266 Core versions before 2.7.8 and ESP32 Core versions before v3.1.0.240926 have been removed.
## Support of TLS
@@ -60,7 +55,7 @@ Easy initial installation of Tasmota can be performed using the [Tasmota WebInst
## Provided Binary Downloads
### ESP8266 or ESP8285 based
-The following binary downloads have been compiled with ESP8266/Arduino library core version **2.7.7**.
+The following binary downloads have been compiled with ESP8266/Arduino library core version **2.7.8**.
- **tasmota.bin** = The Tasmota version with most drivers for 1M+ flash. **RECOMMENDED RELEASE BINARY**
- **tasmota-4M.bin** = The Tasmota version with most drivers and filesystem for 4M+ flash.
@@ -80,12 +75,12 @@ Latest released binaries can be downloaded from
- http://ota.tasmota.com/tasmota/release
Historical binaries can be downloaded from
-- http://ota.tasmota.com/tasmota/release-14.2.0
+- http://ota.tasmota.com/tasmota/release-14.3.0
The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmota.com/tasmota/release/tasmota.bin.gz``
### ESP32, ESP32-C2, ESP32-C3, ESP32-C6, ESP32-S2 and ESP32-S3 based
-The following binary downloads have been compiled with ESP32/Arduino library core version **3.0.4**.
+The following binary downloads have been compiled with ESP32/Arduino library core version **v3.1.0.240926**.
- **tasmota32.bin** = The Tasmota version with most drivers including additional sensors and KNX for 4M+ flash. **RECOMMENDED RELEASE BINARY**
- **tasmota32solo1.bin** = The Tasmota version with most drivers including additional sensors and KNX for single core ESP32 and 4M+ flash.
@@ -109,7 +104,7 @@ Latest released binaries can be downloaded from
- https://ota.tasmota.com/tasmota32/release
Historical binaries can be downloaded from
-- https://ota.tasmota.com/tasmota32/release-14.2.0
+- https://ota.tasmota.com/tasmota32/release-14.3.0
The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasmota.com/tasmota32/release/tasmota32.bin``
@@ -119,100 +114,83 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
[Complete list](BUILDS.md) of available feature and sensors.
-## Changelog v14.2.0 Rita
+## Changelog v14.3.0 Robert
### Added
-- Command ``AdcGpio `` to better support ADC configuration
-- Support for QMP6988 temperature and pressure sensor
-- Support for Sonoff WTS01 temperature sensor using SerialBridge in ``SSerialMode 3``
-- Support for Sonoff iFan04-H using template [#16402](https://github.com/arendst/Tasmota/issues/16402)
-- Support for Sonoff POWCT Ring [#21131](https://github.com/arendst/Tasmota/issues/21131)
-- Support for Wooliis Hall Effect Coulometer or Battery capacity monitor [#21732](https://github.com/arendst/Tasmota/issues/21732)
-- Analog GPIO ``ADC Input`` with ``AdcGpio ,,,1`` provide direct light control
-- Analog GPIO ``ADC Voltage`` with ``AdcGpio ,,,`` provide energy monitoring with dc voltage
-- Analog GPIO ``ADC Current`` with ``AdcGpio ,,,`` provide energy monitoring with dc voltage
-- Rule and Scripter xdrv sensor polling
-- Skip MQTT response if command is prefixed with underscore [#21740](https://github.com/arendst/Tasmota/issues/21740)
-- Skip MQTT response if commands are executed prefixed with ``Backlog2`` (no delay) or ``Backlog3`` [#21740](https://github.com/arendst/Tasmota/issues/21740)
-- Extend command ``SetOption147 1`` to disable publish of IRReceived MQTT messages [#21574](https://github.com/arendst/Tasmota/issues/21574)
-- NeoPool command `NPSetOption` to enabled/disable data validation/connection statistics [#21850](https://github.com/arendst/Tasmota/issues/21850)
-- NeoPool data validation and communication statistics default enabled for ESP32 only [#21721](https://github.com/arendst/Tasmota/issues/21721)
-- 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 automatic rounding of float to int when calling C mapped functions [#21601](https://github.com/arendst/Tasmota/issues/21601)
-- Berry `math.round` [#21602](https://github.com/arendst/Tasmota/issues/21602)
-- Berry `classof` extended to class methods [#21615](https://github.com/arendst/Tasmota/issues/21615)
-- Berry `tasmota.rtc("config_time")` [#21698](https://github.com/arendst/Tasmota/issues/21698)
-- Berry `math.min()` and `math.max()` [#21705](https://github.com/arendst/Tasmota/issues/21705)
-- Berry `FUNC_ANY_KEY` event calling `any_key()` [#21708](https://github.com/arendst/Tasmota/issues/21708)
-- Berry `FUNC_BUTTON_MULTI_PRESSED` event and make `FUNC_BUTTON_PRESSED` called only on state changes and once per second [#21711](https://github.com/arendst/Tasmota/issues/21711)
-- Berry `int64` added `low32()` and `high32()` methods, used in Matter [#21728](https://github.com/arendst/Tasmota/issues/21728)
-- Berry `webserver_async` [#21836](https://github.com/arendst/Tasmota/issues/21836)
-- Berry cam module and img class [#21743](https://github.com/arendst/Tasmota/issues/21743)
-- Berry new type "addr" to ctypes mapping [#21883](https://github.com/arendst/Tasmota/issues/21883)
-- Berry `file.savecode()` [#21884](https://github.com/arendst/Tasmota/issues/21884)
-- Berry `solidify.nocompact()` and reduce size of Matter UI [#21885](https://github.com/arendst/Tasmota/issues/21885)
-- Berry `zigbee.find()` [#21889](https://github.com/arendst/Tasmota/issues/21889)
-- Berry `zigbee.started()` [#21895](https://github.com/arendst/Tasmota/issues/21895)
-- HASPmota rounds to nearest int values passed as 'real' [#21599](https://github.com/arendst/Tasmota/issues/21599)
-- Matter support for Air Quality sensors [#21559](https://github.com/arendst/Tasmota/issues/21559)
-- Matter support for bridged Air Quality [#21597](https://github.com/arendst/Tasmota/issues/21597)
-- Matter internal debug option [#21634](https://github.com/arendst/Tasmota/issues/21634)
-- Matter Fan support (virtual only) [#21637](https://github.com/arendst/Tasmota/issues/21637)
-- Matter show event name in logs [#21649](https://github.com/arendst/Tasmota/issues/21649)
-- Matter full support of events [#21698](https://github.com/arendst/Tasmota/issues/21698)
-- Matter support for 'Generic Switch' based on Tasmota Buttons [#21731](https://github.com/arendst/Tasmota/issues/21731)
-- Matter improve internal `inspect`for superclasses [#21824](https://github.com/arendst/Tasmota/issues/21824)
-- Matter support for split lights (`SetOption68 1` and `SetOption37 128`) [#21834](https://github.com/arendst/Tasmota/issues/21834)
+- Command ``SetOption69 1`` to enable Serial Bridge inverted Receive [#22000](https://github.com/arendst/Tasmota/issues/22000)
+- HX711 optional calibration precision option on command ``Sensor34 2 `` where `` 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)
+- Support for I2C M5Unit (Mini)Scales using HX711 driver
+- Support for DALI 1 on ESP8266
+- Support for RX8010 RTC as used in IOTTIMER [#21376](https://github.com/arendst/Tasmota/issues/21376)
+- Support for BL0906 up to 6 channel energy monitor as used in Athom EM2/EM6 [#22167](https://github.com/arendst/Tasmota/issues/22167)
+- Support for Sonoff SPM v1.3.0 [#13447](https://github.com/arendst/Tasmota/issues/13447)
+- Energy command ``PowerSet 60,230`` to calibrate both Current and Power with known resistive load of 60W at 230V using calibrated Voltage
+- Energy command ``CurrentSet 60,230`` to calibrate both Power and Current with known resistive load of 60W at 230V using calibrated Voltage
+- ESP8266 experimental support for second I2C bus
+- MQTT warning if trying to connect without TLS on a port that normally uses TLS [#22175](https://github.com/arendst/Tasmota/issues/22175)
+- Energy Log level 4 message when (Calculated) Apparent Power is less than Active Power indicating wrong calibration [#20653](https://github.com/arendst/Tasmota/issues/20653)
+- Support nexus protocol and calculation of separation limit to rc-switch library [#21886](https://github.com/arendst/Tasmota/issues/21886)
+- KNX additional KnxTx functions and define KNX_USE_DPT9 [#22071](https://github.com/arendst/Tasmota/issues/22071)
+- SML multi TRX line [#22056](https://github.com/arendst/Tasmota/issues/22056)
+- Zigbee Koenkk firmware 20240710 for Sonoff Zigbee ZBPro [#22076](https://github.com/arendst/Tasmota/issues/22076)
+- Berry Zigbee improvements to prepare Matter [#22083](https://github.com/arendst/Tasmota/issues/22083)
+- Berry virtual Energy driver [#22134](https://github.com/arendst/Tasmota/issues/22134)
+- Berry improve `int64` constructor [#22172](https://github.com/arendst/Tasmota/issues/22172)
+- LVGL port `colorwheel` from LVGL 8 [#22244](https://github.com/arendst/Tasmota/issues/22244)
+- HASPmota `cpicker` and `msgbox` [#22244](https://github.com/arendst/Tasmota/issues/22244)
+- Matter support for Zigbee Temperature, Humidity and Pressure sensors [#22084](https://github.com/arendst/Tasmota/issues/22084)
+- Matter support for Zigbee Occupancy and Light 0/1/2 (OnOff / Dimmer / White Color Temperature) [#22110](https://github.com/arendst/Tasmota/issues/22110)
### Breaking Changed
-- Berry `energy` module support for 8 phases and move to pseudo-arrays [#21887](https://github.com/arendst/Tasmota/issues/21887)
+- Berry make `energy` modules changes from #21887 backwards compatible [#22046](https://github.com/arendst/Tasmota/issues/22046)
### Changed
-- ESP8266 platform update from 2024.01.01 to 2024.06.00 [#21668](https://github.com/arendst/Tasmota/issues/21668)
-- ESP8266 Framework (Arduino Core) from v2.7.6 to v2.7.7 [#21668](https://github.com/arendst/Tasmota/issues/21668)
-- ESP32 platform update from 2024.05.13 to 2024.08.10 [#21893](https://github.com/arendst/Tasmota/issues/21893)
-- ESP32 Framework (Arduino Core) from v3.0.0 to v3.0.4 [#21893](https://github.com/arendst/Tasmota/issues/21893)
-- Rule and Scripter sensor polling
-- Refactored Analog driver to better support multiple channels
-- GUI name of Analog to ADC
-- Optional MQTT_TELE_RETAIN to Energy Margins message replaced by ``SensorRetain``
-- Display timing splash screen with display modes 1 to 5
-- Allow receive or send using SerialBridge
-- SerialBridge command ``SSerialSend9`` replaced by ``SSerialMode``
-- SML replace vars in descriptor and line [#21622](https://github.com/arendst/Tasmota/issues/21622)
-- NeoPool using temperature as only frequently changing value for NPTeleperiod [#21628](https://github.com/arendst/Tasmota/issues/21628)
-- NeoPool make compiler setting available by `user_config_override.h` [#21645](https://github.com/arendst/Tasmota/issues/21645)
-- ESP32 support for energy margin checks, like ``MaxPower2`` per phase [#21695](https://github.com/arendst/Tasmota/issues/21695)
-- ESP32 MI32 refactoring, bugfixes, generic device scanning [#21603](https://github.com/arendst/Tasmota/issues/21603)
-- ESP32 MI32 improve parser [#21648](https://github.com/arendst/Tasmota/issues/21648)
-- ESP32 TM1621 number overflow from "9999" to "12E3" [#21131](https://github.com/arendst/Tasmota/issues/21131)
-- Zigbee loads device data early before MCU startup [#21917](https://github.com/arendst/Tasmota/issues/21917)
-- Berry updated precompiled Windows binary [#21858](https://github.com/arendst/Tasmota/issues/21858)
-- Berry simplified `module persist` [#21812](https://github.com/arendst/Tasmota/issues/21812)
-- Berry consolidated constants for solidified classes reduces Flash size [#2185](https://github.com/arendst/Tasmota/issues/2185)
-- Matter refactoring of bridged devices [#21575](https://github.com/arendst/Tasmota/issues/21575)
-- Matter filter suffix automatically added for sensors [#21589](https://github.com/arendst/Tasmota/issues/21589)
-- Matter support for Rain sensor [#21633](https://github.com/arendst/Tasmota/issues/21633)
-- Matter refactor reading of multiple attributes to reduce memory pressure [#21675](https://github.com/arendst/Tasmota/issues/21675)
-- Matter improve encoding of attributes to reduce flash size [#21864](https://github.com/arendst/Tasmota/issues/21864)
+- ESP8266 platform update from 2024.06.00 to 2024.09.00 and Framework (Arduino Core) from v2.7.7 to v2.7.8 [#22199](https://github.com/arendst/Tasmota/issues/22199)
+- ESP32 platform update from 2024.08.10 to 2024.09.30 and Framework (Arduino Core) from v3.0.4 to v3.1.0.240926 [#22203](https://github.com/arendst/Tasmota/issues/22203)
+- ESP32 LVGL library from v9.1.0 to v9.2.0 [#22031](https://github.com/arendst/Tasmota/issues/22031)
+- GPIOViewer from v1.5.5 to v1.5.6
+- 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
+- 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)
+- HASPmota `delete` instead of `delete()` [#22245](https://github.com/arendst/Tasmota/issues/22245)
### Fixed
-- On universal display remove default backlight power if a single PWM channel is used for backlight. Regression from 14.0.0.1 [#21726](https://github.com/arendst/Tasmota/issues/21726)
-- Shutter MQTT on inverted shutter [#21663](https://github.com/arendst/Tasmota/issues/21663)
-- Scripter TCP server [#21660](https://github.com/arendst/Tasmota/issues/21660)
-- Filesystem SD MMC free space display [#21869](https://github.com/arendst/Tasmota/issues/21869)
-- ESP32 allow use of UART0 with enabled USB_CDC_CONSOLE [#21496](https://github.com/arendst/Tasmota/issues/21496)
-- ESP32 I2S fixes [#21770](https://github.com/arendst/Tasmota/issues/21770)
-- ESP32 Resistive Touch xpt for 2 spi busses [#21814](https://github.com/arendst/Tasmota/issues/21814)
-- Berry `input()` returns empty string and does not crash [#21565](https://github.com/arendst/Tasmota/issues/21565)
-- Berry `bytes.resize()` for large sizes [#21716](https://github.com/arendst/Tasmota/issues/21716)
-- Berry `light.get` for separate RGB/CT [#21818](https://github.com/arendst/Tasmota/issues/21818)
-- Berry `bytes` setters and getters with negative offsets [#21835](https://github.com/arendst/Tasmota/issues/21835)
-- Berry `file.write()` raises an exception on failure (ex: disk full) [#21849](https://github.com/arendst/Tasmota/issues/21849)
-- Matter interverted attributes 0xFFF9 and 0xFFFB [#21636](https://github.com/arendst/Tasmota/issues/21636)
-- Matter CASE Sigma1 resumption mode for faster reconnection [#21644](https://github.com/arendst/Tasmota/issues/21644)
-- Matter TLV.U8 unsigned encoding [#21672](https://github.com/arendst/Tasmota/issues/21672)
-- Matter resumption final ack [#21673](https://github.com/arendst/Tasmota/issues/21673)
+- Dali received data decoding
+- Compilation exception when metrics not found [#22170](https://github.com/arendst/Tasmota/issues/22170)
+- Crash when calling TasmotaSerial destructor when initialized with incorrect arguments [#22036](https://github.com/arendst/Tasmota/issues/22036)
+- Energy calculation [#20653](https://github.com/arendst/Tasmota/issues/20653)
+- SML trx pin error [#22119](https://github.com/arendst/Tasmota/issues/22119)
+- Shutter timing registers overflow [#21966](https://github.com/arendst/Tasmota/issues/21966)
+- Shutter missing HOLD on shutterbutton [#22108](https://github.com/arendst/Tasmota/issues/22108)
+- Shutter remaining issues on shutterinvert [#22120](https://github.com/arendst/Tasmota/issues/22120)
+- PZEM continue energy monitoring when one phase fails [#21968](https://github.com/arendst/Tasmota/issues/21968)
+- BearSSL panic on ESP8266 in rare conditions [#22017](https://github.com/arendst/Tasmota/issues/22017)
+- ModbusBridge request and response logic [#22075](https://github.com/arendst/Tasmota/issues/22075)
+- Autoconf prevent 'init.bat' from stopping on empty lines [#22158](https://github.com/arendst/Tasmota/issues/22158)
+- Zigbee extend timeout for MCU reboot from 5s to 10s [#22009](https://github.com/arendst/Tasmota/issues/22009)
+- Zigbee avoid disabling console serial on ESP32 and improved log messages [#22082](https://github.com/arendst/Tasmota/issues/22082)
+- Zigbee flashing CC2562P with latest firmware [#22117](https://github.com/arendst/Tasmota/issues/22117)
+- 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)
+- 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)
+- Berry improve `persist` dirty data handling [#22246](https://github.com/arendst/Tasmota/issues/22246)
+- ESP32-S3 uDisplay force cache writes to RGB display [#22222](https://github.com/arendst/Tasmota/issues/22222)
+- LVGL Added OpenHASP icons to font `montserrat-28` [#22048](https://github.com/arendst/Tasmota/issues/22048)
+- LVGL compilation of lv_menu [#22188](https://github.com/arendst/Tasmota/issues/22188)
+- HASPmota broken `changed` event [#22194](https://github.com/arendst/Tasmota/issues/22194)
+- HASPmota error when page '1' is not defined [#22220](https://github.com/arendst/Tasmota/issues/22220)
+- Matter fixed UI bug when no endpoints configured [#22008](https://github.com/arendst/Tasmota/issues/22008)
+- Matter fix when Rules are disabled [#22016](https://github.com/arendst/Tasmota/issues/22016)
+- Matter fail to report Shutter status if no shutter is configured in Tasmota [#22049](https://github.com/arendst/Tasmota/issues/22049)
+- Matter fix Waterleak broken after Berry solidification optimisation #21885 [#22052](https://github.com/arendst/Tasmota/issues/22052)
### Removed
-- Berry internal: remove class from closure to simplify code [#21839](https://github.com/arendst/Tasmota/issues/21839)
+- 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)
diff --git a/boards/esp32-fix.json b/boards/esp32-fix.json
index 96b3828b3..26483926d 100644
--- a/boards/esp32-fix.json
+++ b/boards/esp32-fix.json
@@ -19,7 +19,8 @@
"openocd_target": "esp32.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32 >= 4M Flash, PSRAM with fix, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32.json b/boards/esp32.json
index de9159e94..9fcdeda12 100644
--- a/boards/esp32.json
+++ b/boards/esp32.json
@@ -19,7 +19,8 @@
"openocd_target": "esp32.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32 >= 4M Flash PSRAM, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32_solo1.json b/boards/esp32_solo1.json
index ec76a0504..bbcfb887d 100644
--- a/boards/esp32_solo1.json
+++ b/boards/esp32_solo1.json
@@ -19,7 +19,8 @@
"openocd_target": "esp32-solo-1.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-solo1 >= 4M Flash, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32c2.json b/boards/esp32c2.json
index 71453ec07..124b34936 100644
--- a/boards/esp32c2.json
+++ b/boards/esp32c2.json
@@ -17,7 +17,8 @@
"openocd_target": "esp32c2.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-C2 = 4M Flash, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32c2_2M.json b/boards/esp32c2_2M.json
index b5592743d..2122a0d4e 100644
--- a/boards/esp32c2_2M.json
+++ b/boards/esp32c2_2M.json
@@ -17,7 +17,8 @@
"openocd_target": "esp32c2.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-C2 = 2M Flash, Tasmota 1245kB Code/OTA, 64k FS",
"upload": {
diff --git a/boards/esp32c3.json b/boards/esp32c3.json
index 0dd61b4f9..337692b15 100644
--- a/boards/esp32c3.json
+++ b/boards/esp32c3.json
@@ -17,7 +17,8 @@
"openocd_target": "esp32c3.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-C3 >= 4M Flash, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32c3ser.json b/boards/esp32c3ser.json
index faf5649a7..e2644d1aa 100644
--- a/boards/esp32c3ser.json
+++ b/boards/esp32c3ser.json
@@ -17,7 +17,8 @@
"openocd_target": "esp32c3.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-C3 >= 4M Flash, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32c6.json b/boards/esp32c6.json
index c87d992a8..bbfcfd797 100644
--- a/boards/esp32c6.json
+++ b/boards/esp32c6.json
@@ -17,7 +17,8 @@
"openocd_target": "esp32c6.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-C6 >= 4M Flash, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32c6ser.json b/boards/esp32c6ser.json
index 952b79399..aa3ce1b9b 100644
--- a/boards/esp32c6ser.json
+++ b/boards/esp32c6ser.json
@@ -17,7 +17,8 @@
"openocd_target": "esp32c6.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-C6 >= 4M Flash, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32s2.json b/boards/esp32s2.json
index 0f60f5617..8ee95aa39 100644
--- a/boards/esp32s2.json
+++ b/boards/esp32s2.json
@@ -16,7 +16,8 @@
"openocd_target": "esp32s2.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-S2 >= 4M Flash PSRAM, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32s2cdc.json b/boards/esp32s2cdc.json
index 0d85af692..ab2f0da48 100644
--- a/boards/esp32s2cdc.json
+++ b/boards/esp32s2cdc.json
@@ -16,7 +16,8 @@
"openocd_target": "esp32s2.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-S2 >= 4M Flash PSRAM, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32s3-opi_opi.json b/boards/esp32s3-opi_opi.json
index f8f99cc82..0d82a7790 100644
--- a/boards/esp32s3-opi_opi.json
+++ b/boards/esp32s3-opi_opi.json
@@ -21,7 +21,8 @@
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-S3 >= 4M OPI Flash + PSRAM, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32s3-opi_opi_120.json b/boards/esp32s3-opi_opi_120.json
index 771dc90c0..ddb5f5b5a 100644
--- a/boards/esp32s3-opi_opi_120.json
+++ b/boards/esp32s3-opi_opi_120.json
@@ -23,7 +23,8 @@
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-S3 >= 4M OPI Flash + PSRAM, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32s3-qio_opi.json b/boards/esp32s3-qio_opi.json
index 6f4754ead..850adbc1e 100644
--- a/boards/esp32s3-qio_opi.json
+++ b/boards/esp32s3-qio_opi.json
@@ -21,7 +21,8 @@
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-S3 >= 4M Flash OPI PSRAM, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32s3-qio_opi_120.json b/boards/esp32s3-qio_opi_120.json
index 0a4704a92..91737735a 100644
--- a/boards/esp32s3-qio_opi_120.json
+++ b/boards/esp32s3-qio_opi_120.json
@@ -23,7 +23,8 @@
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-S3 >= 4M QIO Flash + OPI PSRAM, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32s3-qio_qspi.json b/boards/esp32s3-qio_qspi.json
index 6a1e38906..8aa23a54a 100644
--- a/boards/esp32s3-qio_qspi.json
+++ b/boards/esp32s3-qio_qspi.json
@@ -21,7 +21,8 @@
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-S3 >= 4M Flash QSPI PSRAM, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32s3-qio_qspi_120.json b/boards/esp32s3-qio_qspi_120.json
index 1c1968916..52d5b86c5 100644
--- a/boards/esp32s3-qio_qspi_120.json
+++ b/boards/esp32s3-qio_qspi_120.json
@@ -23,7 +23,8 @@
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-S3 >= 4M QIO Flash + QSPI PSRAM, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32s3ser-opi_opi.json b/boards/esp32s3ser-opi_opi.json
index 9069a456e..699ab3ca7 100644
--- a/boards/esp32s3ser-opi_opi.json
+++ b/boards/esp32s3ser-opi_opi.json
@@ -21,7 +21,8 @@
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-S3 >= 4M OPI Flash + PSRAM, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32s3ser-opi_opi_120.json b/boards/esp32s3ser-opi_opi_120.json
index 5d370c746..5f0ac2596 100644
--- a/boards/esp32s3ser-opi_opi_120.json
+++ b/boards/esp32s3ser-opi_opi_120.json
@@ -23,7 +23,8 @@
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-S3 >= 4M OPI Flash + PSRAM, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32s3ser-qio_opi.json b/boards/esp32s3ser-qio_opi.json
index d588b060d..fbf416b9b 100644
--- a/boards/esp32s3ser-qio_opi.json
+++ b/boards/esp32s3ser-qio_opi.json
@@ -21,7 +21,8 @@
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-S3 >= 4M Flash OPI PSRAM, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32s3ser-qio_opi_120.json b/boards/esp32s3ser-qio_opi_120.json
index aea5ff20e..86fcbe804 100644
--- a/boards/esp32s3ser-qio_opi_120.json
+++ b/boards/esp32s3ser-qio_opi_120.json
@@ -23,7 +23,8 @@
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-S3 >= 4M QIO Flash + OPI PSRAM, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/boards/esp32s3ser-qio_qspi.json b/boards/esp32s3ser-qio_qspi.json
index aedf4f3a5..edc93ba00 100644
--- a/boards/esp32s3ser-qio_qspi.json
+++ b/boards/esp32s3ser-qio_qspi.json
@@ -21,7 +21,8 @@
"openocd_target": "esp32s3.cfg"
},
"frameworks": [
- "arduino"
+ "arduino",
+ "espidf"
],
"name": "Espressif Generic ESP32-S3 >= 4M Flash QSPI PSRAM, Tasmota 2880k Code/OTA, 320k FS",
"upload": {
diff --git a/lib/default/TasmotaSerial-3.6.0/src/TasmotaSerial.cpp b/lib/default/TasmotaSerial-3.6.0/src/TasmotaSerial.cpp
index 2200e06ba..ef8f87596 100644
--- a/lib/default/TasmotaSerial-3.6.0/src/TasmotaSerial.cpp
+++ b/lib/default/TasmotaSerial-3.6.0/src/TasmotaSerial.cpp
@@ -123,7 +123,9 @@ void TasmotaSerial::end(void) {
}
TasmotaSerial::~TasmotaSerial(void) {
- end();
+ if (m_valid) {
+ end();
+ }
}
bool TasmotaSerial::isValidGPIOpin(int pin) {
diff --git a/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.h b/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.h
index a40e28f9f..3515ee008 100644
--- a/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.h
+++ b/lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.h
@@ -106,6 +106,7 @@ public:
dim_cb dim_cbp = 0;
LVGL_PARAMS lvgl_param;
int8_t disp_bpp;
+ uint16_t *rgb_fb;
private:
void DrawCharAt(int16_t x, int16_t y, char ascii_char,int16_t colored);
inline void drawFastVLineInternal(int16_t x, int16_t y, int16_t h, uint16_t color) __attribute__((always_inline));
diff --git a/lib/lib_display/UDisplay/uDisplay.cpp b/lib/lib_display/UDisplay/uDisplay.cpp
index 194d85afe..fe32897cb 100755
--- a/lib/lib_display/UDisplay/uDisplay.cpp
+++ b/lib/lib_display/UDisplay/uDisplay.cpp
@@ -2282,14 +2282,11 @@ void uDisplay::pushColors(uint16_t *data, uint16_t len, boolean not_swapped) {
}
}
uint16_t * flush_ptr = rgb_fb + (int32_t)seta_yp1 * _width + seta_xp1;
- esp_cache_msync(flush_ptr, (seta_xp2 - seta_xp1) * 2, 0);
+ Cache_WriteBack_Addr((uint32_t)flush_ptr, (seta_xp2 - seta_xp1) * 2);
fb_y += _width;
seta_yp1++;
if (!lenc) break;
}
- // using esp_cache_msync() to flush the PSRAM cache and ensure that all data is actually written to PSRAM
- // from https://github.com/espressif/esp-idf/blob/636ff35b52f10e1a804a3760a5bd94e68f4b1b71/components/esp_lcd/rgb/esp_lcd_panel_rgb.c#L159
-
}
#endif
return;
diff --git a/lib/lib_display/UDisplay/uDisplay.h b/lib/lib_display/UDisplay/uDisplay.h
index c054bd9c6..ca8de0c5f 100755
--- a/lib/lib_display/UDisplay/uDisplay.h
+++ b/lib/lib_display/UDisplay/uDisplay.h
@@ -396,7 +396,7 @@ class uDisplay : public Renderer {
#if ESP_IDF_VERSION_MAJOR < 5
esp_rgb_panel_t *_rgb_panel;
#endif //ESP_IDF_VERSION_MAJOR < 5
- uint16_t *rgb_fb;
+
esp_lcd_i80_bus_handle_t _i80_bus = nullptr;
diff --git a/lib/lib_rf/rc-switch/src/RCSwitch.cpp b/lib/lib_rf/rc-switch/src/RCSwitch.cpp
index 05d2a8313..4f3940e81 100644
--- a/lib/lib_rf/rc-switch/src/RCSwitch.cpp
+++ b/lib/lib_rf/rc-switch/src/RCSwitch.cpp
@@ -151,8 +151,9 @@ static const RCSwitch::Protocol PROGMEM proto[] = {
{ 340, 0, { 0, 0 }, 1, { 14, 4 }, { 1, 2 }, { 2, 1 }, false, 0 }, // 33 (Dooya Control DC2708L)
{ 120, 0, { 0, 0 }, 1, { 1, 28 }, { 1, 3 }, { 3, 1 }, false, 0 }, // 34 DIGOO SD10 - so as to use this protocol RCSWITCH_SEPARATION_LIMIT must be set to 2600
{ 20, 0, { 0, 0 }, 1, { 239, 78 }, {20, 35 }, {35, 20}, false, 10000},// 35 Dooya 5-Channel blinds remote DC1603
- { 250, 0, { 0, 0 }, 1, { 18, 6 }, { 1, 3 }, { 3, 1 }, false, 0 }, // 36 Dooya remote DC2700AC for Dooya DT82TV curtains motor
- { 200, 0, { 0, 0 }, 0, { 0, 0 }, { 1, 3 }, { 3, 1} , false, 20} // 37 DEWENWILS Power Strip
+ { 250, 0, { 0, 0 }, 1, { 18, 6 }, { 1, 3 }, { 3, 1 }, false, 0 }, // 36 Dooya remote DC2700AC for Dooya DT82TV curtains motor
+ { 200, 0, { 0, 0 }, 0, { 0, 0 }, { 1, 3 }, { 3, 1 }, false, 20 }, // 37 DEWENWILS Power Strip
+ { 500, 0, { 0, 0 }, 1, { 7, 1 }, { 2, 1 }, { 4, 1 }, true, 0 }, // 38 temperature and humidity sensor, various brands, nexus protocol, 36 bits + start impulse
};
enum {
@@ -166,7 +167,7 @@ volatile unsigned int RCSwitch::nReceivedBitlength = 0;
volatile unsigned int RCSwitch::nReceivedDelay = 0;
volatile unsigned int RCSwitch::nReceivedProtocol = 0;
int RCSwitch::nReceiveTolerance = 60;
-const unsigned int RCSwitch::nSeparationLimit = RCSWITCH_SEPARATION_LIMIT;
+unsigned int RCSwitch::nSeparationLimit = RCSWITCH_SEPARATION_LIMIT;
unsigned int RCSwitch::timings[RCSWITCH_MAX_CHANGES];
unsigned int RCSwitch::buftimings[4];
#endif
@@ -238,8 +239,50 @@ void RCSwitch::setReceiveTolerance(int nPercent) {
RCSwitch::nReceiveTolerance = nPercent;
}
-void RCSwitch::setReceiveProtocolMask(unsigned long long mask) {
+bool RCSwitch::setReceiveProtocolMask(unsigned long long mask) {
RCSwitch::nReceiveProtocolMask = mask;
+ return updateSeparationLimit();
+}
+
+bool RCSwitch::updateSeparationLimit()
+{
+ unsigned int longestPulseTime = std::numeric_limits::max();
+ unsigned int shortestPulseTime = 0;
+
+ unsigned long long thisMask = 1;
+ for(unsigned int i = 0; i < numProto; i++) {
+ if (RCSwitch::nReceiveProtocolMask & thisMask) {
+ const unsigned int headerShortPulseCount = std::min(proto[i].Header.high, proto[i].Header.low);
+ const unsigned int headerLongPulseCount = std::max(proto[i].Header.high, proto[i].Header.low);
+
+ // This must be the longest pulse-length of this protocol. nSeparationLimit must of this length or shorter.
+ // This pulse will be used to detect the beginning of a transmission.
+ const unsigned int headerLongPulseTime = proto[i].pulseLength * headerLongPulseCount;
+
+ // nSeparationLimit must be longer than any of the following pulses to avoid detecting a new transmission in the middle of a frame.
+ unsigned int longestDataPulseCount = headerShortPulseCount;
+ longestDataPulseCount = std::max(longestDataPulseCount, proto[i].zero.high);
+ longestDataPulseCount = std::max(longestDataPulseCount, proto[i].zero.low);
+ longestDataPulseCount = std::max(longestDataPulseCount, proto[i].one.high);
+ longestDataPulseCount = std::max(longestDataPulseCount, proto[i].one.low);
+
+ const unsigned int longestDataPulseTime = proto[i].pulseLength * longestDataPulseCount;
+
+ longestPulseTime = std::min(longestPulseTime, headerLongPulseTime);
+ shortestPulseTime = std::max(shortestPulseTime, longestDataPulseTime);
+ }
+ thisMask <<= 1;
+ }
+
+ if (longestPulseTime <= shortestPulseTime) {
+ // incompatible protocols enabled, fall back to default value
+ nSeparationLimit = RCSWITCH_SEPARATION_LIMIT;
+ return false;
+ }
+
+ const unsigned int timeDiff = longestPulseTime - shortestPulseTime;
+ nSeparationLimit = longestPulseTime - (timeDiff / 2);
+ return true;
}
#endif
diff --git a/lib/lib_rf/rc-switch/src/RCSwitch.h b/lib/lib_rf/rc-switch/src/RCSwitch.h
index 6d660c0db..28d946d65 100644
--- a/lib/lib_rf/rc-switch/src/RCSwitch.h
+++ b/lib/lib_rf/rc-switch/src/RCSwitch.h
@@ -57,9 +57,9 @@
#endif
// Number of maximum high/Low changes per packet.
-// We can handle up to (unsigned long) => 32 bit * 2 H/L changes per bit + 2 for sync
+// We can handle up to 36 bit * 2 H/L changes per bit + 2 for sync
// Для keeloq нужно увеличить RCSWITCH_MAX_CHANGES до 23+1+66*2+1=157
-#define RCSWITCH_MAX_CHANGES 67 // default 67
+#define RCSWITCH_MAX_CHANGES 75 // default 75 - longest protocol that requires this buffer size is 38/nexus
// separationLimit: minimum microseconds between received codes, closer codes are ignored.
// according to discussion on issue #14 it might be more suitable to set the separation
@@ -108,7 +108,7 @@ class RCSwitch {
void setRepeatTransmit(int nRepeatTransmit);
#if not defined( RCSwitchDisableReceiving )
void setReceiveTolerance(int nPercent);
- void setReceiveProtocolMask(unsigned long long mask);
+ bool setReceiveProtocolMask(unsigned long long mask);
#endif
/**
@@ -171,6 +171,7 @@ class RCSwitch {
#if not defined( RCSwitchDisableReceiving )
static void handleInterrupt();
static bool receiveProtocol(const int p, unsigned int changeCount);
+ static bool updateSeparationLimit();
int nReceiverInterrupt;
#endif
int nTransmitterPin;
@@ -184,7 +185,7 @@ class RCSwitch {
volatile static unsigned int nReceivedBitlength;
volatile static unsigned int nReceivedDelay;
volatile static unsigned int nReceivedProtocol;
- const static unsigned int nSeparationLimit;
+ static unsigned int nSeparationLimit;
/*
* timings[0] contains sync timing, followed by a number of bits
*/
diff --git a/lib/lib_ssl/bearssl-esp8266/src/ec/ec_prime_i15.c b/lib/lib_ssl/bearssl-esp8266/src/ec/ec_prime_i15.c
index 63d90fcf1..62bf46d05 100644
--- a/lib/lib_ssl/bearssl-esp8266/src/ec/ec_prime_i15.c
+++ b/lib/lib_ssl/bearssl-esp8266/src/ec/ec_prime_i15.c
@@ -465,7 +465,7 @@ run_code(jacobian *P1, const jacobian *P2,
memcpy(t[P1x], P1->c, 3 * I15_LEN * sizeof(uint16_t));
memcpy(t[P2x], P2->c, 3 * I15_LEN * sizeof(uint16_t));
- optimistic_yield(10000);
+ stack_thunk_yield();
/*
* Run formulas.
diff --git a/lib/lib_ssl/bearssl-esp8266/src/rsa/rsa_i15_priv.c b/lib/lib_ssl/bearssl-esp8266/src/rsa/rsa_i15_priv.c
index 6c09a427c..b456a069e 100644
--- a/lib/lib_ssl/bearssl-esp8266/src/rsa/rsa_i15_priv.c
+++ b/lib/lib_ssl/bearssl-esp8266/src/rsa/rsa_i15_priv.c
@@ -141,7 +141,7 @@ br_rsa_i15_private(unsigned char *x, const br_rsa_private_key *sk)
mp = mq + 2 * fwlen;
memmove(mp, t1, fwlen * sizeof *t1);
- optimistic_yield(10000);
+ stack_thunk_yield();
/*
* Compute s2 = x^dq mod q.
@@ -152,7 +152,7 @@ br_rsa_i15_private(unsigned char *x, const br_rsa_private_key *sk)
r &= br_i15_modpow_opt(s2, sk->dq, sk->dqlen, mq, q0i,
mq + 3 * fwlen, TLEN - 3 * fwlen);
- optimistic_yield(10000);
+ stack_thunk_yield();
/*
* Compute s1 = x^dq mod q.
@@ -184,7 +184,7 @@ br_rsa_i15_private(unsigned char *x, const br_rsa_private_key *sk)
br_i15_decode_reduce(t1, sk->iq, sk->iqlen, mp);
br_i15_montymul(t2, s1, t1, mp, p0i);
- optimistic_yield(10000);
+ stack_thunk_yield();
/*
* h is now in t2. We compute the final result:
diff --git a/lib/lib_ssl/bearssl-esp8266/src/t_inner.h b/lib/lib_ssl/bearssl-esp8266/src/t_inner.h
index d5fecd71b..de08990e5 100644
--- a/lib/lib_ssl/bearssl-esp8266/src/t_inner.h
+++ b/lib/lib_ssl/bearssl-esp8266/src/t_inner.h
@@ -2598,16 +2598,16 @@ br_cpuid(uint32_t mask_eax, uint32_t mask_ebx,
#define _debugBearSSL (0)
#ifdef ESP8266
- extern void optimistic_yield(uint32_t);
+ extern void stack_thunk_yield(void);
#else
- #define optimistic_yield(ignored)
+ #define stack_thunk_yield(ignored)
#endif
#ifdef __cplusplus
}
#endif
#else
- #define optimistic_yield(ignored)
+ #define stack_thunk_yield(ignored)
#endif
#ifdef ESP32
diff --git a/lib/lib_ssl/tls_mini/src/StackThunk_light.cpp b/lib/lib_ssl/tls_mini/src/StackThunk_light.cpp
index f41c8df59..098752c88 100644
--- a/lib/lib_ssl/tls_mini/src/StackThunk_light.cpp
+++ b/lib/lib_ssl/tls_mini/src/StackThunk_light.cpp
@@ -35,6 +35,9 @@
extern "C" {
+extern void yield();
+extern bool can_yield();
+
uint32_t *stack_thunk_light_ptr = NULL;
uint32_t *stack_thunk_light_top = NULL;
uint32_t *stack_thunk_light_save = NULL; /* Saved A1 while in BearSSL */
@@ -48,6 +51,25 @@ uint32_t stack_thunk_light_refcnt = 0;
#endif
#define _stackPaint 0xdeadbeef
+void stack_thunk_yield()
+{
+ if (can_yield()) {
+ uint32_t tmp;
+ register uint32_t* save __asm__("a3") = stack_thunk_light_save;
+
+ __asm__ __volatile__ (
+ "mov.n %0, a1\n\t"
+ "mov.n a1, %1\n\t"
+ : "=r"(tmp) : "r"(save) : "memory");
+
+ yield();
+
+ __asm__ __volatile__ (
+ "mov.n a1, %0\n\t"
+ :: "r"(tmp) : "memory");
+ }
+}
+
/* Add a reference, and allocate the stack if necessary */
void stack_thunk_light_add_ref()
{
diff --git a/lib/lib_ssl/tls_mini/src/StackThunk_light.h b/lib/lib_ssl/tls_mini/src/StackThunk_light.h
index 9fa562655..ca6701422 100644
--- a/lib/lib_ssl/tls_mini/src/StackThunk_light.h
+++ b/lib/lib_ssl/tls_mini/src/StackThunk_light.h
@@ -32,6 +32,8 @@
extern "C" {
#endif
+extern void stack_thunk_yield();
+
extern void stack_thunk_light_add_ref();
extern void stack_thunk_light_del_ref();
extern void stack_thunk_light_repaint();
diff --git a/lib/libesp32/berry/berry.exe b/lib/libesp32/berry/berry.exe
index 49b7fca66..a8479ea16 100644
Binary files a/lib/libesp32/berry/berry.exe and b/lib/libesp32/berry/berry.exe differ
diff --git a/lib/libesp32/berry/default/be_modtab.c b/lib/libesp32/berry/default/be_modtab.c
index 153bce872..e4f60edcc 100644
--- a/lib/libesp32/berry/default/be_modtab.c
+++ b/lib/libesp32/berry/default/be_modtab.c
@@ -55,6 +55,7 @@ be_extern_native_module(TFL);
be_extern_native_module(mdns);
#ifdef USE_ZIGBEE
be_extern_native_module(zigbee);
+be_extern_native_module(matter_zigbee);
#endif // USE_ZIGBEE
#ifdef USE_BERRY_CAM
be_extern_native_module(cam);
@@ -171,6 +172,7 @@ BERRY_LOCAL const bntvmodule_t* const be_module_table[] = {
#endif // USE_WEBSERVER
#ifdef USE_ZIGBEE
&be_native_module(zigbee),
+ &be_native_module(matter_zigbee),
#endif // USE_ZIGBEE
&be_native_module(flash),
&be_native_module(partition_core),
diff --git a/lib/libesp32/berry/src/be_byteslib.c b/lib/libesp32/berry/src/be_byteslib.c
index e2f2257e0..460de413e 100644
--- a/lib/libesp32/berry/src/be_byteslib.c
+++ b/lib/libesp32/berry/src/be_byteslib.c
@@ -547,7 +547,7 @@ void m_write_attributes(bvm *vm, int rel_idx, const buf_impl * attr)
}
// buf_impl * bytes_realloc(bvm *vm, buf_impl *oldbuf, int32_t size)
-void bytes_realloc(bvm *vm, buf_impl * attr, int32_t size)
+void bytes_realloc(bvm *vm, buf_impl * attr, size_t size)
{
m_assert_not_readlonly(vm, attr);
if (!attr->fixed && size < 4) { size = 4; }
@@ -1180,7 +1180,7 @@ static int m_item(bvm *vm)
{
int argc = be_top(vm);
buf_impl attr = bytes_check_data(vm, 0); /* we reserve 4 bytes anyways */
- check_ptr_modifiable(vm, &attr);
+ check_ptr(vm, &attr);
if (argc >=2 && be_isint(vm, 2)) { /* single byte */
int index = be_toint(vm,2);
if (index < 0) {
diff --git a/lib/libesp32/berry/src/be_code.c b/lib/libesp32/berry/src/be_code.c
index 4213d54a2..9f7cf1300 100644
--- a/lib/libesp32/berry/src/be_code.c
+++ b/lib/libesp32/berry/src/be_code.c
@@ -307,7 +307,7 @@ static int exp2const(bfuncinfo *finfo, bexpdesc *e)
{
int idx = findconst(finfo, e); /* does the constant already exist? */
if (idx == -1) { /* if not add it */
- bvalue k = {};
+ bvalue k = {0};
switch (e->type) {
case ETINT:
k.type = BE_INT;
@@ -695,7 +695,7 @@ static void setsfxvar(bfuncinfo *finfo, bopcode op, bexpdesc *e1, int src)
/* e1 must be in a register and have a valid idx */
/* if `keep_reg` is true, do not release register */
/* return 1 if assignment was possible, 0 if type is not compatible */
-int be_code_setvar(bfuncinfo *finfo, bexpdesc *e1, bexpdesc *e2, bbool keep_reg, bbool ismethod)
+int be_code_setvar(bfuncinfo *finfo, bexpdesc *e1, bexpdesc *e2, bbool keep_reg)
{
/* free_e2 indicates special case where ETINDEX or ETMEMBER need to be freed if top of registers */
bbool free_e2 = (e2->type == ETINDEX || e2->type == ETMEMBER) && (e2->v.ss.idx != e1->v.idx) && (e2->v.ss.idx == finfo->freereg - 1);
@@ -729,7 +729,7 @@ int be_code_setvar(bfuncinfo *finfo, bexpdesc *e1, bexpdesc *e2, bbool keep_reg,
break;
case ETMEMBER: /* store to member R(A).RK(B) <- RK(C) */
case ETINDEX: /* store to member R(A)[RK(B)] <- RK(C) */
- setsfxvar(finfo, (e1->type == ETMEMBER) ? (ismethod ? OP_SETMET : OP_SETMBR) : OP_SETIDX, e1, src);
+ setsfxvar(finfo, (e1->type == ETMEMBER) ? OP_SETMBR : OP_SETIDX, e1, src);
if (keep_reg && e2->type == ETREG && e1->v.ss.obj >= be_list_count(finfo->local)) {
/* special case of walrus assignemnt when we need to recreate an ETREG */
code_move(finfo, e1->v.ss.obj, src); /* move from ETREG to MEMBER instance*/
@@ -882,7 +882,7 @@ void be_code_index(bfuncinfo *finfo, bexpdesc *c, bexpdesc *k)
void be_code_class(bfuncinfo *finfo, bexpdesc *dst, bclass *c)
{
int src;
- bvalue var = {};
+ bvalue var = {0};
var_setclass(&var, c); /* new var of CLASS type */
src = newconst(finfo, &var); /* allocate a new constant and return kreg */
if (dst->type == ETLOCAL) { /* if target is a local variable, just assign */
@@ -923,7 +923,7 @@ void be_code_import(bfuncinfo *finfo, bexpdesc *m, bexpdesc *v)
codeABC(finfo, OP_IMPORT, dst, src, 0);
m->type = ETREG;
m->v.idx = dst;
- be_code_setvar(finfo, v, m, bfalse, bfalse);
+ be_code_setvar(finfo, v, m, bfalse);
}
}
@@ -965,7 +965,7 @@ void be_code_raise(bfuncinfo *finfo, bexpdesc *e1, bexpdesc *e2)
void be_code_implicit_class(bfuncinfo *finfo, bexpdesc *e, bclass *c)
{
- bvalue k = {};
+ bvalue k = {0};
k.type = BE_CLASS;
k.v.p = c;
int idx = newconst(finfo, &k); /* create new constant */
diff --git a/lib/libesp32/berry/src/be_code.h b/lib/libesp32/berry/src/be_code.h
index 454a1c913..f0ef2e194 100644
--- a/lib/libesp32/berry/src/be_code.h
+++ b/lib/libesp32/berry/src/be_code.h
@@ -16,7 +16,7 @@ int be_code_allocregs(bfuncinfo *finfo, int count);
void be_code_prebinop(bfuncinfo *finfo, int op, bexpdesc *e);
void be_code_binop(bfuncinfo *finfo, int op, bexpdesc *e1, bexpdesc *e2, int dst);
int be_code_unop(bfuncinfo *finfo, int op, bexpdesc *e);
-int be_code_setvar(bfuncinfo *finfo, bexpdesc *e1, bexpdesc *e2, bbool keep_reg, bbool ismethod);
+int be_code_setvar(bfuncinfo *finfo, bexpdesc *e1, bexpdesc *e2, bbool keep_reg);
int be_code_nextreg(bfuncinfo *finfo, bexpdesc *e);
int be_code_jump(bfuncinfo *finfo);
void be_code_jumpto(bfuncinfo *finfo, int dst);
diff --git a/lib/libesp32/berry/src/be_debug.c b/lib/libesp32/berry/src/be_debug.c
index 32cb7fbe4..142c4ea5e 100644
--- a/lib/libesp32/berry/src/be_debug.c
+++ b/lib/libesp32/berry/src/be_debug.c
@@ -62,7 +62,7 @@ void be_print_inst(binstruction ins, int pc, void* fout)
case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV:
case OP_MOD: case OP_LT: case OP_LE: case OP_EQ:
case OP_NE: case OP_GT: case OP_GE: case OP_CONNECT:
- case OP_GETMBR: case OP_SETMBR: case OP_GETMET: case OP_SETMET:
+ case OP_GETMBR: case OP_SETMBR: case OP_GETMET:
case OP_GETIDX: case OP_SETIDX: case OP_AND:
case OP_OR: case OP_XOR: case OP_SHL: case OP_SHR:
logbuf("%s\tR%d\t%c%d\t%c%d", opc2str(op), IGET_RA(ins),
diff --git a/lib/libesp32/berry/src/be_filelib.c b/lib/libesp32/berry/src/be_filelib.c
index cfb882b11..dcf661fde 100644
--- a/lib/libesp32/berry/src/be_filelib.c
+++ b/lib/libesp32/berry/src/be_filelib.c
@@ -10,6 +10,7 @@
#include "be_sys.h"
#include "be_gc.h"
#include "be_bytecode.h"
+#include "be_vm.h"
#include
#define READLINE_STEP 100
@@ -71,12 +72,23 @@ static int i_readbytes(bvm *vm)
void *fh = be_tocomptr(vm, -1);
size_t size = readsize(vm, argc, fh);
if (size) {
+ if (size > vm->bytesmaxsize) {
+ be_raise(vm, "memory_error", "size exceeds maximum allowed for bytes");
+ }
/* avoid double allocation, using directly the internal buffer of bytes() */
be_getbuiltin(vm, "bytes");
be_pushint(vm, size);
be_call(vm, 1); /* call bytes() constructor with pre-sized buffer */
be_pop(vm, 1); /* bytes() instance is at top */
+ /* read back the actual buffer size */
+ be_getmember(vm, -1, ".size");
+ int32_t bytes_size = be_toint(vm, -1);
+ be_pop(vm, 1);
+ if (bytes_size < (int32_t)size) {
+ be_raise(vm, "memory_error", "could not allocated buffer");
+ }
+
be_getmember(vm, -1, "resize");
be_pushvalue(vm, -2);
be_pushint(vm, size);
diff --git a/lib/libesp32/berry/src/be_module.c b/lib/libesp32/berry/src/be_module.c
index 3691ed324..f02b9dedb 100644
--- a/lib/libesp32/berry/src/be_module.c
+++ b/lib/libesp32/berry/src/be_module.c
@@ -355,7 +355,7 @@ int be_module_attr(bvm *vm, bmodule *module, bstring *attr, bvalue *dst)
bbool be_module_setmember(bvm *vm, bmodule *module, bstring *attr, bvalue *src)
{
- assert(src);
+ be_assert(src);
bmap *attrs = module->table;
if (!gc_isconst(attrs)) {
bvalue *v = be_map_findstr(vm, attrs, attr);
diff --git a/lib/libesp32/berry/src/be_opcodes.h b/lib/libesp32/berry/src/be_opcodes.h
index ef80fa254..12c3781e0 100644
--- a/lib/libesp32/berry/src/be_opcodes.h
+++ b/lib/libesp32/berry/src/be_opcodes.h
@@ -54,5 +54,4 @@ OPCODE(CATCH), /* A, B, C | ... */
OPCODE(RAISE), /* A, B, C | RAISE(B,C) B is code, C is description. A==0 only B provided, A==1 B and C are provided, A==2 rethrow with both parameters already on stack */
OPCODE(CLASS), /* Bx | init class in K[Bx] */
OPCODE(GETNGBL), /* A, B | R(A) <- GLOBAL[RK(B)] by name */
-OPCODE(SETNGBL), /* A, B | R(A) -> GLOBAL[RK(B)] by name */
-OPCODE(SETMET), /* A, B, C | R(A).RK(B) <- RK(C) only if R(A) is a class, and RK(C) is marked as non-static */
+OPCODE(SETNGBL) /* A, B | R(A) -> GLOBAL[RK(B)] by name */
diff --git a/lib/libesp32/berry/src/be_parser.c b/lib/libesp32/berry/src/be_parser.c
index 6be271dd8..9737cdf81 100644
--- a/lib/libesp32/berry/src/be_parser.c
+++ b/lib/libesp32/berry/src/be_parser.c
@@ -634,7 +634,7 @@ static bproto* funcbody(bparser *parser, bstring *name, bclass *c, int type)
new_var(parser, parser_newstr(parser, "_class"), &e1); /* new implicit variable '_class' */
init_exp(&e2, ETCONST, 0);
be_code_implicit_class(parser->finfo, &e2, c);
- be_code_setvar(parser->finfo, &e1, &e2, bfalse, bfalse);
+ be_code_setvar(parser->finfo, &e1, &e2, bfalse);
finfo.proto->varg |= BE_VA_STATICMETHOD;
}
stmtlist(parser); /* parse statement without final `end` */
@@ -738,7 +738,7 @@ static void map_nextmember(bparser *parser, bexpdesc *l)
match_token(parser, OptColon); /* ':' */
expr(parser, &e); /* value in `e` */
check_var(parser, &e); /* check if value is correct */
- be_code_setvar(finfo, &v, &e, bfalse, bfalse); /* set suffi INDEX value to e */
+ be_code_setvar(finfo, &v, &e, bfalse); /* set suffi INDEX value to e */
}
static void list_expr(bparser *parser, bexpdesc *e)
@@ -1018,7 +1018,7 @@ static void assign_expr(bparser *parser)
if (check_newvar(parser, &e)) { /* new variable */
new_var(parser, e.v.s, &e);
}
- if (be_code_setvar(parser->finfo, &e, &e1, bfalse, bfalse)) {
+ if (be_code_setvar(parser->finfo, &e, &e1, bfalse)) {
parser->lexer.linenumber = line;
parser_error(parser,
"try to assign constant expressions.");
@@ -1121,7 +1121,7 @@ static void walrus_expr(bparser *parser, bexpdesc *e)
if (check_newvar(parser, &e1)) { /* new variable */
new_var(parser, e1.v.s, &e1);
}
- if (be_code_setvar(parser->finfo, &e1, e, btrue /* do not release register */, bfalse)) {
+ if (be_code_setvar(parser->finfo, &e1, e, btrue /* do not release register */ )) {
parser->lexer.linenumber = line;
parser_error(parser,
"try to assign constant expressions.");
@@ -1254,7 +1254,7 @@ static void for_iter(bparser *parser, bstring *var, bexpdesc *it)
finfo->binfo->beginpc = finfo->pc;
/* itvar = .it() */
init_exp(&e, ETLOCAL, new_localvar(parser, var)); /* new itvar */
- be_code_setvar(finfo, &e, it, bfalse, bfalse); /* code function to variable '.it' */
+ be_code_setvar(finfo, &e, it, bfalse); /* code function to variable '.it' */
be_code_call(finfo, e.v.idx, 0); /* itvar <- call .it() */
stmtlist(parser);
}
@@ -1435,7 +1435,7 @@ static void classvar_stmt(bparser *parser, bclass *c)
}
}
-static void class_static_assignment_expr(bparser *parser, bexpdesc *e, bstring *name, bbool ismethod)
+static void class_static_assignment_expr(bparser *parser, bexpdesc *e, bstring *name)
{
if (match_skip(parser, OptAssign)) { /* '=' */
bexpdesc e1, e2;
@@ -1448,32 +1448,22 @@ static void class_static_assignment_expr(bparser *parser, bexpdesc *e, bstring *
key.v.s = name;
be_code_member(parser->finfo, &e1, &key); /* compute member accessor */
- be_code_setvar(parser->finfo, &e1, &e2, bfalse, ismethod); /* set member */
+ be_code_setvar(parser->finfo, &e1, &e2, bfalse); /* set member */
}
}
-static void classdef_stmt(bparser *parser, bclass *c, bexpdesc *e, bbool is_static)
+static void classdef_stmt(bparser *parser, bclass *c, bbool is_static)
{
- bexpdesc e1;
+ bexpdesc e;
bstring *name;
bproto *proto;
/* 'def' ID '(' varlist ')' block 'end' */
- /* 'def' ID = funcname */
- /* 'def' ID = classname '.' method */
scan_next_token(parser); /* skip 'def' */
- name = func_name(parser, &e1, 1);
- check_class_attr(parser, c, name); /* check that we don't redefine an existing name within the class */
- if (next_type(parser) == OptAssign) {
- /* 'def' ID = funcname */
- /* 'def' ID = classname '.' method */
- be_class_member_bind(parser->vm, c, name, bfalse);
- class_static_assignment_expr(parser, e, name, !is_static);
- } else {
- /* 'def' ID '(' varlist ')' block 'end' */
- proto = funcbody(parser, name, c, is_static ? FUNC_STATIC : FUNC_METHOD);
- be_class_method_bind(parser->vm, c, proto->name, proto, is_static);
- be_stackpop(parser->vm, 1);
- }
+ name = func_name(parser, &e, 1);
+ check_class_attr(parser, c, name);
+ proto = funcbody(parser, name, c, is_static ? FUNC_STATIC : FUNC_METHOD);
+ be_class_method_bind(parser->vm, c, proto->name, proto, is_static);
+ be_stackpop(parser->vm, 1);
}
static void classstaticclass_stmt(bparser *parser, bclass *c_out, bexpdesc *e_out);
@@ -1483,10 +1473,9 @@ static void classstatic_stmt(bparser *parser, bclass *c, bexpdesc *e)
bstring *name;
/* 'static' ['var'] ID ['=' expr] {',' ID ['=' expr] } */
/* 'static' 'def' ID '(' varlist ')' block 'end' */
- /* 'static' 'def' ID '=' func */
scan_next_token(parser); /* skip 'static' */
if (next_type(parser) == KeyDef) { /* 'static' 'def' ... */
- classdef_stmt(parser, c, e, btrue);
+ classdef_stmt(parser, c, btrue);
} else if (next_type(parser) == KeyClass) { /* 'static' 'class' ... */
classstaticclass_stmt(parser, c, e);
} else {
@@ -1496,13 +1485,13 @@ static void classstatic_stmt(bparser *parser, bclass *c, bexpdesc *e)
if (match_id(parser, name) != NULL) {
check_class_attr(parser, c, name);
be_class_member_bind(parser->vm, c, name, bfalse);
- class_static_assignment_expr(parser, e, name, bfalse);
+ class_static_assignment_expr(parser, e, name);
while (match_skip(parser, OptComma)) { /* ',' */
if (match_id(parser, name) != NULL) {
check_class_attr(parser, c, name);
be_class_member_bind(parser->vm, c, name, bfalse);
- class_static_assignment_expr(parser, e, name, bfalse);
+ class_static_assignment_expr(parser, e, name);
} else {
parser_error(parser, "class static error");
}
@@ -1532,7 +1521,7 @@ static void class_block(bparser *parser, bclass *c, bexpdesc *e)
switch (next_type(parser)) {
case KeyVar: classvar_stmt(parser, c); break;
case KeyStatic: classstatic_stmt(parser, c, e); break;
- case KeyDef: classdef_stmt(parser, c, e, bfalse); break;
+ case KeyDef: classdef_stmt(parser, c, bfalse); break;
case OptSemic: scan_next_token(parser); break;
default: push_error(parser,
"unexpected token '%s'", token2str(parser));
@@ -1559,7 +1548,7 @@ static void class_stmt(bparser *parser)
bexpdesc e1; /* if inline class, we add a second local variable for _class */
init_exp(&e1, ETLOCAL, 0);
e1.v.idx = new_localvar(parser, class_str);
- be_code_setvar(parser->finfo, &e1, &e, btrue, bfalse);
+ be_code_setvar(parser->finfo, &e1, &e, btrue);
begin_varinfo(parser, class_str);
@@ -1597,7 +1586,7 @@ static void classstaticclass_stmt(bparser *parser, bclass *c_out, bexpdesc *e_ou
key.v.s = name;
/* assign the class to the static member */
be_code_member(parser->finfo, &e1, &key); /* compute member accessor */
- be_code_setvar(parser->finfo, &e1, &e_class, bfalse, bfalse); /* set member */
+ be_code_setvar(parser->finfo, &e1, &e_class, bfalse); /* set member */
} else {
parser_error(parser, "class name error");
}
@@ -1649,7 +1638,7 @@ static void var_field(bparser *parser)
init_exp(&e2, ETNIL, 0);
}
new_var(parser, name, &e1); /* new variable */
- be_code_setvar(parser->finfo, &e1, &e2, bfalse, bfalse);
+ be_code_setvar(parser->finfo, &e1, &e2, bfalse);
}
static void var_stmt(bparser *parser)
diff --git a/lib/libesp32/berry/src/be_solidifylib.c b/lib/libesp32/berry/src/be_solidifylib.c
index 2afca6095..ecfb75890 100644
--- a/lib/libesp32/berry/src/be_solidifylib.c
+++ b/lib/libesp32/berry/src/be_solidifylib.c
@@ -699,7 +699,7 @@ static void m_compact_class(bvm *vm, bbool str_literal, const bclass *cla, void*
case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV:
case OP_MOD: case OP_LT: case OP_LE: case OP_EQ:
case OP_NE: case OP_GT: case OP_GE: case OP_CONNECT:
- case OP_GETMBR: case OP_SETMBR: case OP_GETMET: case OP_SETMET:
+ case OP_GETMBR: case OP_SETMBR: case OP_GETMET:
case OP_GETIDX: case OP_SETIDX: case OP_AND:
case OP_OR: case OP_XOR: case OP_SHL: case OP_SHR:
case OP_RAISE:
diff --git a/lib/libesp32/berry/src/be_vm.c b/lib/libesp32/berry/src/be_vm.c
index 709b84c9e..78fcc486b 100644
--- a/lib/libesp32/berry/src/be_vm.c
+++ b/lib/libesp32/berry/src/be_vm.c
@@ -994,7 +994,6 @@ newframe: /* a new call frame */
}
dispatch();
}
- opcase(SETMET):
opcase(SETMBR): {
#if BE_USE_PERF_COUNTERS
vm->counter_set++;
@@ -1021,7 +1020,7 @@ newframe: /* a new call frame */
bclass *obj = var_toobj(a);
bstring *attr = var_tostr(b);
bvalue result = *c;
- if (var_isfunction(&result) && (IGET_OP(ins) == OP_SETMBR)) { /* don't mark as static if SETMET was used */
+ if (var_isfunction(&result)) {
var_markstatic(&result);
}
if (!be_class_setmember(vm, obj, attr, &result)) {
diff --git a/lib/libesp32/berry/src/be_vm.h b/lib/libesp32/berry/src/be_vm.h
index c88609bbd..5953a4625 100644
--- a/lib/libesp32/berry/src/be_vm.h
+++ b/lib/libesp32/berry/src/be_vm.h
@@ -110,7 +110,7 @@ struct bvm {
struct bgc gc;
bctypefunc ctypefunc; /* handler to ctype_func */
bbyte compopt; /* compilation options */
- int32_t bytesmaxsize; /* max allowed size for bytes() object, default 32kb but can be increased */
+ size_t bytesmaxsize; /* max allowed size for bytes() object, default 32kb but can be increased */
bobshook obshook;
bmicrosfnct microsfnct; /* fucntion to get time as a microsecond resolution */
#if BE_USE_PERF_COUNTERS
diff --git a/lib/libesp32/berry/tests/int64.be b/lib/libesp32/berry/tests/int64.be
new file mode 100644
index 000000000..695149445
--- /dev/null
+++ b/lib/libesp32/berry/tests/int64.be
@@ -0,0 +1,136 @@
+# tests for int64 support (for int32 internal int representation)
+
+assert(int(int64()) == 0)
+assert(str(int64()) == "0")
+assert(int(int64(10)) == 10)
+assert(str(int64(10)) == "10")
+assert(int(int64(-5)) == -5)
+assert(str(int64(-5)) == "-5")
+
+# extended constructor
+assert(int64(35).tostring() == "35")
+assert(int64(3.5).tostring() == "3")
+assert(int64("35").tostring() == "35")
+assert(int64("20000000000").tostring() == "20000000000")
+assert(int64(true).tostring() == "1")
+assert(int64(false).tostring() == "0")
+assert(int64(int64(42)).tostring() == "42")
+# invalid
+assert(int64("").tostring() == "0")
+assert(int64(nil).tostring() == "0")
+
+# testing large numbers
+assert(str(int64.fromu32(0xFFFFFFFF, 0x7FFFFFFF)) == "9223372036854775807") # max positive number
+assert(str(int64.fromu32(0x00000000, 0x80000000)) == "-9223372036854775808")
+assert(str(int64.fromu32(10,10)) == "42949672970")
+
+# addition
+assert(str(int64(10) + int64(20)) == "30")
+assert(str(int64(10) + int64(-20)) == "-10")
+assert(str(int64() + int64()) == "0")
+assert(str(int64(10) + 0) == "10") # special case, do not crash if null
+
+# substraction
+assert(str(int64(10) - int64(20)) == "-10")
+assert(str(int64(10) - int64(-20)) == "30")
+assert(str(int64() - int64()) == "0")
+assert(str(int64(10) - 0) == "10") # special case, do not crash if null
+
+# neg
+assert(str(-int64(10)) == "-10")
+assert(str(-int64(-10)) == "10")
+assert(str(-int64()) == "0")
+
+# multiplication
+assert(str(int64(10) * int64(20)) == "200")
+assert(str(int64(10) * int64(-20)) == "-200")
+assert(str(int64() * int64()) == "0")
+assert(str(int64(10) * 0) == "0") # special case, do not crash if null
+
+# division
+assert(str(int64(100) / int64(20)) == "5")
+assert(str(int64(100) / int64(-20)) == "-5")
+
+# modulus
+assert(str(int64(102) % int64(10)) == "2")
+
+# equals
+assert((int64(10) == int64(10)) == true)
+assert((int64(10) == int64(20)) == false)
+assert((int64(10) == int64()) == false)
+assert((int64(0) == int64()) == true)
+assert((int64(0) == 0) == true)
+assert((int64(10) == 0) == false)
+
+# unequals
+assert((int64(10) != int64(10)) == false)
+assert((int64(10) != int64(20)) == true)
+assert((int64(10) != int64()) == true)
+assert((int64(0) != int64()) == false)
+assert((int64(0) != 0) == false)
+assert((int64(10) != 0) == true)
+
+# >
+assert((int64(10) > int64(10)) == false)
+assert((int64(10) > int64(20)) == false)
+assert((int64(20) > int64(10)) == true)
+assert((int64(10) > 0) == true)
+# >=
+assert((int64(10) >= int64(10)) == true)
+assert((int64(10) >= int64(20)) == false)
+assert((int64(20) >= int64(10)) == true)
+assert((int64(10) >= 0) == true)
+
+# <
+assert((int64(10) < int64(10)) == false)
+assert((int64(10) < int64(20)) == true)
+assert((int64(20) < int64(10)) == false)
+assert((int64(10) < 0) == false)
+# <=
+assert((int64(10) <= int64(10)) == true)
+assert((int64(10) <= int64(20)) == true)
+assert((int64(20) <= int64(10)) == false)
+assert((int64(10) <= 0) == false)
+
+# tobytes
+assert(int64().tobytes() == bytes("0000000000000000"))
+assert(int64(10).tobytes() == bytes("0A00000000000000"))
+a = int64.fromu32(0xFFFFFFFF, 0x7FFFFFFF) # max positive number
+assert(a.tobytes() == bytes("FFFFFFFFFFFFFF7F"))
+a = int64.fromu32(0x00000000, 0x80000000)
+assert(a.tobytes() == bytes("0000000000000080"))
+assert(int64(-1).tobytes() == bytes("FFFFFFFFFFFFFFFF"))
+
+# frombytes
+assert(int64.frombytes(bytes("0A00000000000000"), 0) == bytes("0A00000000000000")) # with implicit index 0
+assert(int64.frombytes(bytes("0A00000000000000")) == bytes("0A00000000000000"))
+assert(int64.frombytes(bytes("0A00000000000000"), 1) == bytes("0000000000000000")) # index 1 and incomplete (7 bytes)
+
+assert(int64.frombytes(bytes("00FFFFFFFFFFFFFFFF"), 1) == bytes("FFFFFFFFFFFFFFFF")) # index 1 and incomplete (7 bytes)
+assert(int64.frombytes(bytes("00FFFFFFFFFFFFFFFF"), -2) == bytes("FFFF000000000000")) # from end
+assert(int64.frombytes(bytes("")) == bytes("0000000000000000")) # empty
+assert(int64.frombytes(bytes(""),4) == bytes("0000000000000000")) # empty with wrong index
+
+# fromu32
+assert(int64.fromu32(0).tobytes() == bytes("0000000000000000"))
+assert(int64.fromu32(0xFFFFFFFF).tobytes() == bytes("FFFFFFFF00000000"))
+assert(int64.fromu32(0xFFFFFFFF, 1).tobytes() == bytes("FFFFFFFF01000000"))
+assert(int64.fromu32(-1, 1).tobytes() == bytes("FFFFFFFF01000000"))
+assert(int64.fromu32(-1, -1).tobytes() == bytes("FFFFFFFFFFFFFFFF"))
+
+# fromfloat
+assert(int64.fromfloat(3.5).tostring() == "3")
+assert(int64.fromfloat(-3.5).tostring() == "-3")
+assert(int64.fromfloat(2e10).tostring() == "20000000000") # 20000000000 does not fit in 32 bits
+
+# toint64, supports int, float, bool, string, int64
+assert(int64.toint64(35).tostring() == "35")
+assert(int64.toint64(3.5).tostring() == "3")
+assert(int64.toint64("35").tostring() == "35")
+assert(int64.toint64("20000000000").tostring() == "20000000000")
+assert(int64.toint64(true).tostring() == "1")
+assert(int64.toint64(false).tostring() == "0")
+assert(int64.toint64(int64(42)).tostring() == "42")
+# invalid
+assert(int64.toint64("").tostring() == "0")
+assert(int64.toint64(nil) == nil)
diff --git a/lib/libesp32/berry/tests/set_method.be b/lib/libesp32/berry/tests/set_method.be
deleted file mode 100644
index b2fdc5d96..000000000
--- a/lib/libesp32/berry/tests/set_method.be
+++ /dev/null
@@ -1,40 +0,0 @@
-# test setting methods as an external class
-
-class A
- var a
- def init(a)
- self.a = a
- end
- def f0(x) return self end
- def f1(x) return x end
- def f2(x) return self.a end
- static def ff0(x) return _class end
- static def ff1(x) return x end
-end
-
-class B
- var b
- def init(b)
- self.b = b
- end
-end
-
-class C : B
- var a
- def init(a)
- self.a = a
- end
-
- def fc0 = A.f0
- def fc1 = A.f1
- def fc2 = A.f2
- static def ffc0 = A.ff0
- static def ffc1 = A.ff1
-end
-
-c = C(10)
-assert(c.fc0(1) == c)
-assert(c.fc1(1) == 1)
-assert(c.fc2(1) == 10)
-assert(c.ffc0(1) == A)
-assert(c.ffc1(1) == 1)
diff --git a/lib/libesp32/berry_int64/src/be_int64_class.c b/lib/libesp32/berry_int64/src/be_int64_class.c
index 16f8dbbba..91a0a7f2f 100644
--- a/lib/libesp32/berry_int64/src/be_int64_class.c
+++ b/lib/libesp32/berry_int64/src/be_int64_class.c
@@ -32,23 +32,70 @@ static void int64_toa(int64_t num, uint8_t* str) {
}
}
-void* int64_init(bvm *vm, int32_t val) {
- int64_t *i64 = (int64_t*)be_malloc(vm, sizeof(int64_t));
- *i64 = (int64_t) val;
- // serial_debug("int64_init p=%p\n", i64);
- return i64;
+/* constructor*/
+static int int64_init(bvm *vm) {
+ int32_t argc = be_top(vm); // Get the number of arguments
+ int64_t *i64 = NULL;
+ /* did we receive a pre-allocated pointer */
+ if (argc > 1 && be_iscomptr(vm, 2)) {
+ i64 = be_tocomptr(vm, 2);
+ }
+ /* or allocated */
+ if (i64 == NULL) {
+ i64 = (int64_t*)be_malloc(vm, sizeof(int64_t));
+ if (i64 == NULL) { be_raise(vm, "memory_error", "cannot allocate buffer"); }
+ *i64 = 0; // default to zero
+ }
+ bbool invalid_arg = bfalse;
+ if (argc > 1) {
+ if (be_iscomptr(vm, 2) || be_isnil(vm, 2)) {
+ /* keep value */
+ } else if (be_isint(vm, 2)) {
+ *i64 = be_toint(vm, 2);
+ } else if (be_isreal(vm, 2)) {
+ *i64 = (int64_t)be_toreal(vm, 2);
+ } else if (be_isstring(vm, 2)) {
+ const char* s = be_tostring(vm, 2);
+ *i64 = atoll(s);
+ } else if (be_isbool(vm, 2)) {
+ *i64 = be_tobool(vm, 2) ? 1 : 0;
+ } else if (be_isinstance(vm, 2)) {
+ be_getglobal(vm, "int64");
+ if (be_isderived(vm, 2)) {
+ be_getmember(vm, 2, "_p");
+ int64_t *v64 = be_tocomptr(vm, -1);
+ if (v64 != NULL) {
+ *i64 = *v64;
+ }
+ } else {
+ invalid_arg = btrue;
+ }
+ } else {
+ invalid_arg = btrue;
+ }
+ }
+ if (invalid_arg) {
+ be_free(vm, i64, sizeof(int64_t));
+ be_raise(vm, "TypeError", "unsupported argument type");
+ }
+ be_pushcomptr(vm, i64);
+ be_setmember(vm, 1, "_p");
+ be_return_nil(vm);
}
-BE_FUNC_CTYPE_DECLARE(int64_init, "+_p", "@[i]")
-void int64_deinit(bvm *vm, int64_t *i64) {
- // serial_debug("int64_deinit p=%p\n", i64);
- be_free(vm, i64, sizeof(int64_t));
+/* destructor */
+static int int64_deinit(bvm *vm) {
+ be_getmember(vm, 1, "_p");
+ int64_t *i64 = be_tocomptr(vm, -1);
+ if (i64 != NULL) {
+ be_free(vm, i64, sizeof(int64_t));
+ }
+ be_return_nil(vm);
}
-BE_FUNC_CTYPE_DECLARE(int64_deinit, "", "@.")
char* int64_tostring(int64_t *i64) {
static char s[24]; /* enough to hold max value */
- int64_toa(*i64, s);
+ int64_toa(*i64, (uint8_t*)s);
return s;
}
BE_FUNC_CTYPE_DECLARE(int64_tostring, "s", ".")
@@ -80,6 +127,13 @@ int64_t* int64_fromu32(bvm *vm, uint32_t low, uint32_t high) {
}
BE_FUNC_CTYPE_DECLARE(int64_fromu32, "int64", "@i[i]")
+int64_t* int64_fromfloat(bvm *vm, float f) {
+ int64_t* r64 = (int64_t*)be_malloc(vm, sizeof(int64_t));
+ *r64 = (int64_t)f;
+ return r64;
+}
+BE_FUNC_CTYPE_DECLARE(int64_fromfloat, "int64", "@f")
+
int64_t* int64_add(bvm *vm, int64_t *i64, int64_t *j64) {
int64_t* r64 = (int64_t*)be_malloc(vm, sizeof(int64_t));
// it's possible that arg j64 is nullptr, since class type does allow NULLPTR to come through.
@@ -203,7 +257,7 @@ int64_t* int64_frombytes(bvm *vm, uint8_t* ptr, size_t len, int32_t idx) {
int64_t* r64 = (int64_t*)be_malloc(vm, sizeof(int64_t));
if (idx < 0) { idx = len + idx; } // support negative index, counting from the end
if (idx < 0) { idx = 0; } // sanity check
- if (idx > len) { idx = len; }
+ if (idx > (int32_t)len) { idx = len; }
uint32_t usable_len = len - idx;
if (usable_len > sizeof(int64_t)) { usable_len = sizeof(int64_t); }
*r64 = 0; // start with 0
@@ -224,10 +278,9 @@ BE_FUNC_CTYPE_DECLARE(int64_high32, "i", "(int64)")
/*
-def toint64(i)
- if (type(i) == 'int') return int64.fromu32(i) end
- if (type(i) == 'instance') && isinstance(i, int64) return i end
- return nil
+def toint64(v)
+ if (v == nil) return nil end
+ return int64(v)
end
*/
@@ -237,7 +290,7 @@ end
********************************************************************/
be_local_closure(toint64, /* name */
be_nested_proto(
- 4, /* nstack */
+ 3, /* nstack */
1, /* argc */
0, /* varg */
0, /* has upvals */
@@ -245,38 +298,21 @@ be_local_closure(toint64, /* name */
0, /* has sup protos */
NULL, /* no sub protos */
1, /* has constants */
- ( &(const bvalue[ 4]) { /* constants */
- /* K0 */ be_nested_str(int),
- /* K1 */ be_nested_str(int64),
- /* K2 */ be_nested_str(fromu32),
- /* K3 */ be_nested_str(instance),
+ ( &(const bvalue[ 1]) { /* constants */
+ /* K0 */ be_nested_str(int64),
}),
- &be_const_str_to64,
+ &be_const_str_toint64,
&be_const_str_solidified,
- ( &(const binstruction[23]) { /* code */
- 0x60040004, // 0000 GETGBL R1 G4
- 0x5C080000, // 0001 MOVE R2 R0
- 0x7C040200, // 0002 CALL R1 1
- 0x1C040300, // 0003 EQ R1 R1 K0
- 0x78060004, // 0004 JMPF R1 #000A
- 0xB8060200, // 0005 GETNGBL R1 K1
- 0x8C040302, // 0006 GETMET R1 R1 K2
- 0x5C0C0000, // 0007 MOVE R3 R0
- 0x7C040400, // 0008 CALL R1 2
- 0x80040200, // 0009 RET 1 R1
- 0x60040004, // 000A GETGBL R1 G4
- 0x5C080000, // 000B MOVE R2 R0
- 0x7C040200, // 000C CALL R1 1
- 0x1C040303, // 000D EQ R1 R1 K3
- 0x78060005, // 000E JMPF R1 #0015
- 0x6004000F, // 000F GETGBL R1 G15
- 0x5C080000, // 0010 MOVE R2 R0
- 0xB80E0200, // 0011 GETNGBL R3 K1
- 0x7C040400, // 0012 CALL R1 2
- 0x78060000, // 0013 JMPF R1 #0015
- 0x80040000, // 0014 RET 1 R0
- 0x4C040000, // 0015 LDNIL R1
- 0x80040200, // 0016 RET 1 R1
+ ( &(const binstruction[ 9]) { /* code */
+ 0x4C040000, // 0000 LDNIL R1
+ 0x1C040001, // 0001 EQ R1 R0 R1
+ 0x78060001, // 0002 JMPF R1 #0005
+ 0x4C040000, // 0003 LDNIL R1
+ 0x80040200, // 0004 RET 1 R1
+ 0xB8060000, // 0005 GETNGBL R1 K0
+ 0x5C080000, // 0006 MOVE R2 R0
+ 0x7C040200, // 0007 CALL R1 1
+ 0x80040200, // 0008 RET 1 R1
})
)
);
@@ -288,9 +324,10 @@ be_local_closure(toint64, /* name */
/* @const_object_info_begin
class be_class_int64 (scope: global, name: int64) {
_p, var
- init, ctype_func(int64_init)
- deinit, ctype_func(int64_deinit)
+ init, func(int64_init)
+ deinit, func(int64_deinit)
fromu32, static_ctype_func(int64_fromu32)
+ fromfloat, static_ctype_func(int64_fromfloat)
toint64, static_closure(toint64_closure)
tostring, ctype_func(int64_tostring)
diff --git a/lib/libesp32/berry_int64/tests/int64.be b/lib/libesp32/berry_int64/tests/int64.be
index 311b0f72c..695149445 100644
--- a/lib/libesp32/berry_int64/tests/int64.be
+++ b/lib/libesp32/berry_int64/tests/int64.be
@@ -7,6 +7,18 @@ assert(str(int64(10)) == "10")
assert(int(int64(-5)) == -5)
assert(str(int64(-5)) == "-5")
+# extended constructor
+assert(int64(35).tostring() == "35")
+assert(int64(3.5).tostring() == "3")
+assert(int64("35").tostring() == "35")
+assert(int64("20000000000").tostring() == "20000000000")
+assert(int64(true).tostring() == "1")
+assert(int64(false).tostring() == "0")
+assert(int64(int64(42)).tostring() == "42")
+# invalid
+assert(int64("").tostring() == "0")
+assert(int64(nil).tostring() == "0")
+
# testing large numbers
assert(str(int64.fromu32(0xFFFFFFFF, 0x7FFFFFFF)) == "9223372036854775807") # max positive number
assert(str(int64.fromu32(0x00000000, 0x80000000)) == "-9223372036854775808")
@@ -83,10 +95,9 @@ assert((int64(10) <= 0) == false)
# tobytes
assert(int64().tobytes() == bytes("0000000000000000"))
assert(int64(10).tobytes() == bytes("0A00000000000000"))
-a = int64()
-a.set(0x7FFFFFFF,0xFFFFFFFF) # max positive number
+a = int64.fromu32(0xFFFFFFFF, 0x7FFFFFFF) # max positive number
assert(a.tobytes() == bytes("FFFFFFFFFFFFFF7F"))
-a.set(0x80000000,0x00000000)
+a = int64.fromu32(0x00000000, 0x80000000)
assert(a.tobytes() == bytes("0000000000000080"))
assert(int64(-1).tobytes() == bytes("FFFFFFFFFFFFFFFF"))
@@ -106,3 +117,20 @@ assert(int64.fromu32(0xFFFFFFFF).tobytes() == bytes("FFFFFFFF00000000"))
assert(int64.fromu32(0xFFFFFFFF, 1).tobytes() == bytes("FFFFFFFF01000000"))
assert(int64.fromu32(-1, 1).tobytes() == bytes("FFFFFFFF01000000"))
assert(int64.fromu32(-1, -1).tobytes() == bytes("FFFFFFFFFFFFFFFF"))
+
+# fromfloat
+assert(int64.fromfloat(3.5).tostring() == "3")
+assert(int64.fromfloat(-3.5).tostring() == "-3")
+assert(int64.fromfloat(2e10).tostring() == "20000000000") # 20000000000 does not fit in 32 bits
+
+# toint64, supports int, float, bool, string, int64
+assert(int64.toint64(35).tostring() == "35")
+assert(int64.toint64(3.5).tostring() == "3")
+assert(int64.toint64("35").tostring() == "35")
+assert(int64.toint64("20000000000").tostring() == "20000000000")
+assert(int64.toint64(true).tostring() == "1")
+assert(int64.toint64(false).tostring() == "0")
+assert(int64.toint64(int64(42)).tostring() == "42")
+# invalid
+assert(int64.toint64("").tostring() == "0")
+assert(int64.toint64(nil) == nil)
diff --git a/lib/libesp32/berry_mapping/src/be_class_wrapper.c b/lib/libesp32/berry_mapping/src/be_class_wrapper.c
index 0e06ec1de..40d442ae4 100644
--- a/lib/libesp32/berry_mapping/src/be_class_wrapper.c
+++ b/lib/libesp32/berry_mapping/src/be_class_wrapper.c
@@ -34,15 +34,15 @@ typedef intptr_t (*fn_any_callable)(intptr_t p0, intptr_t p1, intptr_t p2, intpt
* On ESP32, int=32bits, real=float (32bits)
\*********************************************************************************************/
static intptr_t realasint(breal v) {
- intptr_t i;
- i = *((intptr_t*) &v);
- return i;
+ union { breal f; bint i; } u;
+ u.f = v;
+ return (intptr_t)u.i;
}
static breal intasreal(intptr_t v) {
- breal r;
- r = *((breal*) &v);
- return r;
+ union { breal f; bint i; } u;
+ u.i = (bint)v;
+ return (breal)u.f;
}
/*********************************************************************************************\
diff --git a/lib/libesp32/berry_matter/src/be_matter_module.c b/lib/libesp32/berry_matter/src/be_matter_module.c
index d2c4051f6..02db643b3 100644
--- a/lib/libesp32/berry_matter/src/be_matter_module.c
+++ b/lib/libesp32/berry_matter/src/be_matter_module.c
@@ -233,6 +233,7 @@ extern const bclass be_class_Matter_TLV; // need to declare it upfront because
#include "solidify/solidified_Matter_Plugin_0.h"
#include "solidify/solidified_Matter_z_Commissioning.h"
#include "solidify/solidified_Matter_z_Autoconf.h"
+#include "solidify/solidified_Matter_z_Zigbee.h"
#include "solidify/solidified_Matter_Base38.h"
#include "solidify/solidified_Matter_UI.h"
#include "solidify/solidified_Matter_Profiler.h"
@@ -295,6 +296,13 @@ extern const bclass be_class_Matter_TLV; // need to declare it upfront because
#include "solidify/solidified_Matter_Plugin_8_Bridge_Sensor_Air_Quality.h"
#include "solidify/solidified_Matter_Plugin_8_Bridge_Sensor_Rain.h"
#include "solidify/solidified_Matter_Plugin_8_Bridge_Sensor_Waterleak.h"
+#include "solidify/solidified_Matter_Plugin_9_Zigbee_Light0.h"
+#include "solidify/solidified_Matter_Plugin_9_Zigbee_Light1.h"
+#include "solidify/solidified_Matter_Plugin_9_Zigbee_Light2.h"
+#include "solidify/solidified_Matter_Plugin_9_Zigbee_Temperature.h"
+#include "solidify/solidified_Matter_Plugin_9_Zigbee_Pressure.h"
+#include "solidify/solidified_Matter_Plugin_9_Zigbee_Humidity.h"
+#include "solidify/solidified_Matter_Plugin_9_Zigbee_Occupancy.h"
#include "solidify/solidified_Matter_Plugin_z_All.h"
#include "solidify/solidified_Matter_zz_Device.h"
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_IM.be b/lib/libesp32/berry_matter/src/embedded/Matter_IM.be
index 52949177b..c4810ff99 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_IM.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_IM.be
@@ -735,7 +735,7 @@ class Matter_IM
var ep_str = (q.endpoint != nil) ? f"{q.endpoint:02X}" : "**"
var cl_str = (q.cluster != nil) ? f"{q.cluster:04X}" : "****"
var ev_str = (q.event != nil) ? f"{q.event:02X}" : "**"
- var event_no_min_str = (event_no_min != nil) ? f" (>{event_no_min})" : ""
+ var event_no_min_str = (event_no_min != nil) ? f" (event>{event_no_min})" : ""
log(f"MTR: >Read_Event({msg.session.local_session_id:6i}) [{ep_str}]{cl_str}/{ev_str} {event_name}{event_no_min_str}", 3)
end
end
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_0.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_0.be
index e40a37b5e..2183fc09f 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_0.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_0.be
@@ -35,6 +35,7 @@ class Matter_Plugin
static var UPDATE_TIME = 5000 # default is every 5 seconds
static var VIRTUAL = false # set to true only for virtual devices
static var BRIDGE = false # set to true only for bridged devices (ESP8266 or OpenBK)
+ static var ZIGBEE = false # set to true only when mapped to a zigbee device
var update_next # next timestamp for update
# Configuration of the plugin: clusters and type
static var CLUSTERS = matter.consolidate_clusters(_class, {
@@ -258,6 +259,13 @@ matter_device.events.dump()
#
# we limit to 3 commands (to we need more?)
def publish_command(key1, value1, key2, value2, key3, value3)
+ # if zigbee, decompose simple commands
+ if self.ZIGBEE && self.zigbee_mapper && self.zigbee_mapper.resolve_zb_device()
+ self.zigbee_mapper.zb_single_command(key1, value1)
+ self.zigbee_mapper.zb_single_command(key2, value2)
+ self.zigbee_mapper.zb_single_command(key3, value3)
+ end
+
import json
var payload = f"{json.dump(key1)}:{json.dump(value1)}"
if key2 != nil
@@ -536,7 +544,7 @@ matter_device.events.dump()
# key: key name in the JSON payload to read from, do nothing if key does not exist or content is `null`
# old_val: previous value, used to detect a change or return the value unchanged
# type_func: type enforcer for value, typically `int`, `bool`, `str`, `number`, `real`
- # cluster/attribute: in case the value has change, publish a change to cluster/attribute
+ # cluster/attribute: in case the value has change, publish a change to cluster/attribute. Don't publish if they are `nil`
#
# Returns:
# `old_val` if key does not exist, JSON value is `null`, or value is unchanged
@@ -546,7 +554,7 @@ matter_device.events.dump()
var val = payload.find(key)
if (val != nil)
val = type_func(val)
- if (val != old_val)
+ if (val != old_val) && (cluster != nil) && (attribute != nil)
self.attribute_updated(cluster, attribute)
end
return val
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_1_Device.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_1_Device.be
index edae4f064..6a7a6668e 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_1_Device.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_1_Device.be
@@ -55,6 +55,12 @@ class Matter_Plugin_Device : Matter_Plugin
#############################################################
# Constructor
def init(device, endpoint, arguments)
+ # Zigbee code, activated only when `ZIGBEE` is true
+ # attribute `zigbee_mapper` needs to be defined for classes with `ZIGBEE` true
+ if self.ZIGBEE
+ self.zigbee_mapper = device.create_zb_mapper(self) # needs to exist before `parse_configuration()` is called
+ end
+
super(self).init(device, endpoint, arguments)
if self.BRIDGE
@@ -64,6 +70,35 @@ class Matter_Plugin_Device : Matter_Plugin
end
end
+ #############################################################
+ # parse_configuration
+ #
+ # Parse configuration map, handling case of Zigbee configuration
+ def parse_configuration(config)
+ # super(self).parse_configuration(config) # not necessary because the superclass does nothing
+ if self.ZIGBEE && self.zigbee_mapper
+ self.zigbee_mapper.parse_configuration(config)
+ end
+ end
+
+ #############################################################
+ # Called when the value changed compared to shadow value
+ #
+ # This must be overriden.
+ # This is where you call `self.attribute_updated(, )`
+ def value_changed()
+ # self.attribute_updated(0x0402, 0x0000)
+ end
+
+ #############################################################
+ # Pre-process value
+ #
+ # This must be overriden.
+ # This allows to convert the raw sensor value to the target one, typically int
+ def pre_value(val)
+ return val
+ end
+
#############################################################
# read an attribute
#
@@ -438,5 +473,31 @@ class Matter_Plugin_Device : Matter_Plugin
return old_val
end
+ #############################################################
+ # For Zigbee devices
+ #############################################################
+ #############################################################
+ # attributes_refined
+ #
+ # Filtered to only events for this endpoint
+ #
+ # Can be called only if `self.ZIGBEE` is true
+ def zigbee_received(frame, attr_list)
+ import math
+ log(f"MTR: zigbee_received Ox{self.zigbee_mapper.shortaddr:04X} {attr_list=} {type(attr_list)=}", 3)
+ var idx = 0
+ while (idx < size(attr_list))
+ var entry = attr_list[idx]
+ if (entry.key == self.ZIGBEE_NAME)
+ var val = self.pre_value(entry.val)
+ var update_list = { self.JSON_NAME : val } # Matter temperature is 1/100th of degrees
+ self.update_virtual(update_list)
+ log(f"MTR: [{self.endpoint:02X}] {self.JSON_NAME} updated {update_list}", 3)
+ return nil
+ end
+ idx += 1
+ end
+ end
+
end
matter.Plugin_Device = Matter_Plugin_Device
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Light0.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Light0.be
index 48747460f..76b206c72 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Light0.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Light0.be
@@ -25,7 +25,7 @@ import matter
class Matter_Plugin_Light0 : Matter_Plugin_Device
static var TYPE = "light0" # name of the plug-in in json
- static var DISPLAY_NAME = "Light 0 On" # display name of the plug-in
+ static var DISPLAY_NAME = "Light 0 OnOff" # display name of the plug-in
static var ARG = "relay" # additional argument name (or empty if none)
static var ARG_TYPE = / x -> int(x) # function to convert argument to the right type
static var ARG_HINT = "Relay number"
@@ -63,6 +63,7 @@ class Matter_Plugin_Light0 : Matter_Plugin_Device
#
# Parse configuration map
def parse_configuration(config)
+ super(self).parse_configuration(config)
# with Light0 we always need relay number but we don't for Light1/2/3 so self.tasmota_relay_index may be `nil`
self.tasmota_relay_index = int(config.find(self.ARG #-'relay'-#, nil))
if (self.tasmota_relay_index != nil && self.tasmota_relay_index <= 0) self.tasmota_relay_index = 1 end
@@ -174,6 +175,40 @@ class Matter_Plugin_Light0 : Matter_Plugin_Device
super(self).update_virtual(payload)
end
+ #############################################################
+ # For Zigbee devices
+ #############################################################
+ #############################################################
+ # attributes_refined
+ #
+ # Filtered to only events for this endpoint
+ # Contains common code for Light 0/1/2/3 to avoid code duplication
+ #
+ # Can be called only if `self.ZIGBEE` is true
+ def zigbee_received(frame, attr_list)
+ import math
+ log(f"MTR: zigbee_received Ox{self.zigbee_mapper.shortaddr:04X} {attr_list=} {type(attr_list)=}", 3)
+ var idx = 0
+ var update_list = {}
+ while (idx < size(attr_list))
+ var entry = attr_list[idx]
+ if (entry.key == "Power")
+ update_list['Power'] = int(entry.val)
+ end
+ if (entry.key == "Dimmer")
+ update_list['Dimmer'] = int(entry.val)
+ end
+ if (entry.key == "CT")
+ update_list['CT'] = int(entry.val)
+ end
+ idx += 1
+ end
+ if (size(update_list) > 0)
+ self.update_virtual(update_list)
+ log(f"MTR: [{self.endpoint:02X}] Light2 updated {update_list}", 3)
+ end
+ end
+
#############################################################
# For Bridge devices
#############################################################
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor.be
index 7ea57693e..d25a0c8bd 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor.be
@@ -57,6 +57,7 @@ class Matter_Plugin_Sensor : Matter_Plugin_Device
#
# Parse configuration map
def parse_configuration(config)
+ super(self).parse_configuration(config)
self.tasmota_sensor_filter = config.find(self.ARG#-'filter'-#)
if self.tasmota_sensor_filter
self.tasmota_sensor_matcher = tasmota.Rule_Matcher.parse(self.tasmota_sensor_filter)
@@ -84,24 +85,6 @@ class Matter_Plugin_Sensor : Matter_Plugin_Device
end
end
- #############################################################
- # Called when the value changed compared to shadow value
- #
- # This must be overriden.
- # This is where you call `self.attribute_updated(, )`
- def value_changed()
- # self.attribute_updated(0x0402, 0x0000)
- end
-
- #############################################################
- # Pre-process value
- #
- # This must be overriden.
- # This allows to convert the raw sensor value to the target one, typically int
- def pre_value(val)
- return val
- end
-
#############################################################
# update_virtual
#
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Air_Quality.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Air_Quality.be
index 35ad21d85..b110c61a3 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Air_Quality.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Air_Quality.be
@@ -77,6 +77,7 @@ class Matter_Plugin_Sensor_Air_Quality : Matter_Plugin_Device
#
# Parse configuration map
def parse_configuration(config)
+ super(self).parse_configuration(config)
self.prefix = str(config.find(self.ARG))
end
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Boolean.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Boolean.be
index 06d65baa8..632b839e4 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Boolean.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_Boolean.be
@@ -46,6 +46,7 @@ class Matter_Plugin_Sensor_Boolean : Matter_Plugin_Device
#
# Parse configuration map
def parse_configuration(config)
+ super(self).parse_configuration(config)
self.tasmota_switch_index = int(config.find(self.ARG #-'switch'-#, 1))
if self.tasmota_switch_index <= 0 self.tasmota_switch_index = 1 end
end
@@ -79,6 +80,16 @@ class Matter_Plugin_Sensor_Boolean : Matter_Plugin_Device
def value_updated()
end
+ #############################################################
+ # update_virtual
+ #
+ # Update internal state for virtual devices
+ def update_virtual(payload)
+ self.shadow_bool_value = self._parse_update_virtual(payload, self.JSON_NAME, self.shadow_bool_value, bool, nil, nil) # publishing cluster/attr is delegated to `value_updated()`
+ self.value_updated()
+ super(self).update_virtual(payload)
+ end
+
#############################################################
# For Bridge devices
#############################################################
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_GenericSwitch_Btn.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_GenericSwitch_Btn.be
index 377259cca..6a1058612 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_GenericSwitch_Btn.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Sensor_GenericSwitch_Btn.be
@@ -46,6 +46,7 @@ class Matter_Plugin_Sensor_GenericSwitch_Btn : Matter_Plugin_Device
#
# Parse configuration map
def parse_configuration(config)
+ super(self).parse_configuration(config)
self.tasmota_switch_index = int(config.find(self.ARG #-'relay'-#, 1))
if self.tasmota_switch_index <= 0 self.tasmota_switch_index = 1 end
end
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Shutter.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Shutter.be
index d0fadc4a2..d17717fe5 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Shutter.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_2_Shutter.be
@@ -49,6 +49,7 @@ class Matter_Plugin_Shutter : Matter_Plugin_Device
#
# Parse configuration map
def parse_configuration(config)
+ super(self).parse_configuration(config)
self.tasmota_shutter_index = config.find(self.ARG #-'relay'-#)
if self.tasmota_shutter_index == nil self.tasmota_shutter_index = 0 end
self.shadow_shutter_inverted = -1
@@ -110,22 +111,29 @@ class Matter_Plugin_Shutter : Matter_Plugin_Device
elif attribute == 0x000D # ---------- EndProductType / u8 ----------
return tlv_solo.set(TLV.U1, 0xFF) # 0xFF = unknown type of shutter
elif attribute == 0x000E # ---------- CurrentPositionLiftPercent100ths / u16 ----------
- if self.shadow_shutter_inverted == 0
- matter_position = (100 - self.shadow_shutter_pos) * 100
- else
- matter_position = self.shadow_shutter_pos * 100
+ if self.shadow_shutter_pos != nil
+ if self.shadow_shutter_inverted == 0
+ matter_position = (100 - self.shadow_shutter_pos) * 100
+ else
+ matter_position = self.shadow_shutter_pos * 100
+ end
end
- return tlv_solo.set(TLV.U2, matter_position)
+ return tlv_solo.set_or_nil(TLV.U2, matter_position)
elif attribute == 0x000A # ---------- OperationalStatus / u8 ----------
- var op = self.shadow_shutter_direction == 0 ? 0 : (self.shadow_shutter_direction > 0 ? 1 : 2)
- return tlv_solo.set(TLV.U1, op)
- elif attribute == 0x000B # ---------- TargetPositionLiftPercent100ths / u16 ----------
- if self.shadow_shutter_inverted == 0
- matter_position = (100 - self.shadow_shutter_target) * 100
- else
- matter_position = self.shadow_shutter_target * 100
+ var op
+ if self.shadow_shutter_direction != nil
+ op = self.shadow_shutter_direction == 0 ? 0 : (self.shadow_shutter_direction > 0 ? 1 : 2)
end
- return tlv_solo.set(TLV.U2, matter_position)
+ return tlv_solo.set_or_nil(TLV.U1, op)
+ elif attribute == 0x000B # ---------- TargetPositionLiftPercent100ths / u16 ----------
+ if self.shadow_shutter_target != nil
+ if self.shadow_shutter_inverted == 0
+ matter_position = (100 - self.shadow_shutter_target) * 100
+ else
+ matter_position = self.shadow_shutter_target * 100
+ end
+ end
+ return tlv_solo.set_or_nil(TLV.U2, matter_position)
elif attribute == 0x0017 # ---------- Mode / u8 ----------
return tlv_solo.set(TLV.U1, 0) # normal mode
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light1.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light1.be
index 501c11c60..fcc77db3b 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light1.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Light1.be
@@ -63,6 +63,7 @@ class Matter_Plugin_Light1 : Matter_Plugin_Light0
#
# Parse configuration map
def parse_configuration(config)
+ super(self).parse_configuration(config)
# with Light0 we always need relay number but we don't for Light1/2/3 so self.tasmota_relay_index may be `nil`
if self.BRIDGE
self.tasmota_relay_index = int(config.find(self.ARG #-'relay'-#, nil))
@@ -207,7 +208,7 @@ class Matter_Plugin_Light1 : Matter_Plugin_Light0
var onoff = bri_254 > 0
self.set_bri(bri_254, onoff)
ctx.log = "bri:"+str(bri_254)
- self.publish_command('Bri', bri_254, 'Dimmer', tasmota.scale_uint(bri_254, 0, 254, 0, 100), 'Power', onoff ? 1 : 0)
+ self.publish_command('Power', onoff ? 1 : 0, 'Bri', bri_254, 'Dimmer', tasmota.scale_uint(bri_254, 0, 254, 0, 100))
return true
elif command == 0x0005 # ---------- MoveWithOnOff ----------
# TODO, we don't really support it
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Contact.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Contact.be
index abb2fa7f7..c62822b45 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Contact.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Contact.be
@@ -30,6 +30,7 @@ class Matter_Plugin_Sensor_Contact : Matter_Plugin_Sensor_Boolean
# static var ARG_HINT = "Switch number"
# static var ARG_TYPE = / x -> int(x) # function to convert argument to the right type
# static var UPDATE_TIME = 750 # update every 750ms
+ static var JSON_NAME = "Contact" # Name of the sensor attribute in JSON payloads
static var UPDATE_COMMANDS = matter.UC_LIST(_class, "Contact")
static var CLUSTERS = matter.consolidate_clusters(_class, {
0x0045: [0], # Boolean State p.70 - no writable
@@ -66,15 +67,6 @@ class Matter_Plugin_Sensor_Contact : Matter_Plugin_Sensor_Boolean
return super(self).read_attribute(session, ctx, tlv_solo)
end
- #############################################################
- # update_virtual
- #
- # Update internal state for virtual devices
- def update_virtual(payload)
- self.shadow_bool_value = self._parse_update_virtual(payload, "Contact", self.shadow_bool_value, bool, 0x0045, 0x0000)
- super(self).update_virtual(payload)
- end
-
#############################################################
# For Bridge devices
#############################################################
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Occupancy.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Occupancy.be
index c30193c9e..7720dbcaa 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Occupancy.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Occupancy.be
@@ -30,6 +30,7 @@ class Matter_Plugin_Sensor_Occupancy : Matter_Plugin_Sensor_Boolean
# static var ARG_HINT = "Switch number"
# static var ARG_TYPE = / x -> int(x) # function to convert argument to the right type
# static var UPDATE_TIME = 750 # update every 750ms
+ static var JSON_NAME = "Occupancy" # Name of the sensor attribute in JSON payloads
static var UPDATE_COMMANDS = matter.UC_LIST(_class, "Occupancy")
static var CLUSTERS = matter.consolidate_clusters(_class, {
0x0406: [0,1,2], # Occupancy Sensing p.105 - no writable
@@ -70,15 +71,6 @@ class Matter_Plugin_Sensor_Occupancy : Matter_Plugin_Sensor_Boolean
return super(self).read_attribute(session, ctx, tlv_solo)
end
- #############################################################
- # update_virtual
- #
- # Update internal state for virtual devices
- def update_virtual(payload)
- self.shadow_bool_value = self._parse_update_virtual(payload, "Occupancy", self.shadow_bool_value, bool, 0x0406, 0x0000)
- super(self).update_virtual(payload)
- end
-
#############################################################
# For Bridge devices
#############################################################
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_OnOff.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_OnOff.be
index ae736e5bd..4dd87ef7d 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_OnOff.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_OnOff.be
@@ -28,6 +28,8 @@ class Matter_Plugin_Sensor_OnOff : Matter_Plugin_Sensor_Boolean
# static var ARG_HINT = "Switch number"
# static var ARG_TYPE = / x -> int(x) # function to convert argument to the right type
# static var UPDATE_TIME = 750 # update every 750ms
+ static var JSON_NAME = "OnOff" # Name of the sensor attribute in JSON payloads
+ static var UPDATE_COMMANDS = matter.UC_LIST(_class, "OnOff")
static var CLUSTERS = matter.consolidate_clusters(_class, {
0x0006: [0], # On/Off 1.5 p.48
})
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Rain.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Rain.be
index 970be52b8..92730e54a 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Rain.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Rain.be
@@ -30,6 +30,7 @@ class Matter_Plugin_Sensor_Rain : Matter_Plugin_Sensor_Boolean
# static var ARG_HINT = "Switch number"
# static var ARG_TYPE = / x -> int(x) # function to convert argument to the right type
# static var UPDATE_TIME = 750 # update every 750ms
+ static var JSON_NAME = "Rain" # Name of the sensor attribute in JSON payloads
static var UPDATE_COMMANDS = matter.UC_LIST(_class, "Rain")
static var CLUSTERS = matter.consolidate_clusters(_class, {
0x0045: [0], # Boolean State p.70 - no writable
@@ -67,15 +68,6 @@ class Matter_Plugin_Sensor_Rain : Matter_Plugin_Sensor_Boolean
return super(self).read_attribute(session, ctx, tlv_solo)
end
- #############################################################
- # update_virtual
- #
- # Update internal state for virtual devices
- def update_virtual(payload)
- self.shadow_bool_value = self._parse_update_virtual(payload, "Rain", self.shadow_bool_value, bool, 0x0045, 0x0000)
- super(self).update_virtual(payload)
- end
-
#############################################################
# For Bridge devices
#############################################################
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Waterleak.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Waterleak.be
index 4a140e27e..14e55ec8f 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Waterleak.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_3_Sensor_Waterleak.be
@@ -30,6 +30,7 @@ class Matter_Plugin_Sensor_Waterleak : Matter_Plugin_Sensor_Boolean
# static var ARG_HINT = "Switch number"
# static var ARG_TYPE = / x -> int(x) # function to convert argument to the right type
# static var UPDATE_TIME = 750 # update every 750ms
+ static var JSON_NAME = "Waterleak" # Name of the sensor attribute in JSON payloads
static var UPDATE_COMMANDS = matter.UC_LIST(_class, "Waterleak")
static var CLUSTERS = matter.consolidate_clusters(_class, {
0x0045: [0], # Boolean State p.70 - no writable
@@ -45,22 +46,28 @@ class Matter_Plugin_Sensor_Waterleak : Matter_Plugin_Sensor_Boolean
#
# This is triggered when a new value is changed, for subscription
# This method is meant to be overloaded and maximize shared code
- def value_updated = Matter_Plugin_Sensor_Rain.value_updated
+ def value_updated()
+ self.attribute_updated(0x0045, 0x0000)
+ end
#############################################################
# read an attribute
#
- def read_attribute = Matter_Plugin_Sensor_Rain.read_attribute
+ def read_attribute(session, ctx, tlv_solo)
+ var TLV = matter.TLV
+ var cluster = ctx.cluster
+ var attribute = ctx.attribute
- #############################################################
- # update_virtual
- #
- # Update internal state for virtual devices
- def update_virtual(payload)
- self.shadow_bool_value = self._parse_update_virtual(payload, "Waterleak", self.shadow_bool_value, bool, 0x0045, 0x0000)
- super(self).update_virtual(payload)
+ # ====================================================================================================
+ if cluster == 0x0045 # ========== Boolean State ==========
+ if attribute == 0x0000 # ---------- StateValue / bool ----------
+ return tlv_solo.set(TLV.BOOL, self.shadow_bool_value)
+ end
+
+ end
+ return super(self).read_attribute(session, ctx, tlv_solo)
end
-
+
#############################################################
# For Bridge devices
#############################################################
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_8_Bridge_Light0.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_8_Bridge_Light0.be
index e8c444908..0439803ba 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_8_Bridge_Light0.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_8_Bridge_Light0.be
@@ -26,7 +26,7 @@ import matter
class Matter_Plugin_Bridge_Light0 : Matter_Plugin_Light0
static var BRIDGE = true # flag as bridged device
static var TYPE = "http_light0" # name of the plug-in in json
- # static var DISPLAY_NAME = "Light 0 On" # display name of the plug-in
+ # static var DISPLAY_NAME = "Light 0 OnOff" # display name of the plug-in
static var UPDATE_TIME = 3000 # update every 3s
end
matter.Plugin_Bridge_Light0 = Matter_Plugin_Bridge_Light0
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Virt_Light0.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Virt_Light0.be
index 65eb8988b..683da0af7 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Virt_Light0.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Virt_Light0.be
@@ -25,7 +25,7 @@ import matter
class Matter_Plugin_Virt_Light0 : Matter_Plugin_Light0
static var TYPE = "v_light0" # name of the plug-in in json
- static var DISPLAY_NAME = "v.Light 0 On" # display name of the plug-in
+ static var DISPLAY_NAME = "v.Light 0 OnOff" # display name of the plug-in
static var ARG = "" # no arg for virtual device
static var ARG_HINT = "_Not used_" # Hint for entering the Argument (inside 'placeholder')
static var VIRTUAL = true # virtual device
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Humidity.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Humidity.be
new file mode 100644
index 000000000..393f68555
--- /dev/null
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Humidity.be
@@ -0,0 +1,38 @@
+#
+# Matter_Plugin_9_Zigbee_Humidity.be - implements the behavior for a Zigbee Humidity sensor
+#
+# Copyright (C) 2023 Stephan Hadinger & Theo Arends
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+
+import matter
+
+# Matter plug-in for core behavior
+
+#@ solidify:Matter_Plugin_Zigbee_Humidity,weak
+
+class Matter_Plugin_Zigbee_Humidity : Matter_Plugin_Sensor_Humidity
+ static var ZIGBEE = true
+ static var TYPE = "z_humidity" # name of the plug-in in json
+ static var DISPLAY_NAME = "Zig Humidity" # display name of the plug-in
+ static var ZIGBEE_NAME = "Humidity" # name of zigbee attribute with sensor reported
+ static var ARG = "zigbee_device" # zigbee device
+ static var ARG_TYPE = / x -> str(x) # function to convert argument to the right type
+ static var ARG_HINT = "Device" # Hint for entering the Argument (inside 'placeholder')
+ static var VIRTUAL = true # virtual device, necessary for Zigbee mapping
+ var zigbee_mapper # required for zigbee device
+
+end
+matter.Plugin_Zigbee_Humidity = Matter_Plugin_Zigbee_Humidity
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Light0.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Light0.be
new file mode 100644
index 000000000..a00accf19
--- /dev/null
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Light0.be
@@ -0,0 +1,38 @@
+#
+# Matter_Plugin_9_Zigbee_Temperature.be - implements the behavior for a Zigbee Light0
+#
+# Copyright (C) 2023 Stephan Hadinger & Theo Arends
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+
+import matter
+
+# Matter plug-in for core behavior
+
+#@ solidify:Matter_Plugin_Zigbee_Light0,weak
+
+class Matter_Plugin_Zigbee_Light0 : Matter_Plugin_Light0
+ static var ZIGBEE = true
+ static var TYPE = "z_light0" # name of the plug-in in json
+ static var DISPLAY_NAME = "Zig Light 0 OnOff" # display name of the plug-in
+ static var ZIGBEE_NAME = "Power" # name of zigbee attribute with sensor reported
+ static var ARG = "zigbee_device" # zigbee device
+ static var ARG_TYPE = / x -> str(x) # function to convert argument to the right type
+ static var ARG_HINT = "Device" # Hint for entering the Argument (inside 'placeholder')
+ static var VIRTUAL = true # virtual device, necessary for Zigbee mapping
+ var zigbee_mapper # required for zigbee device
+
+end
+matter.Plugin_Zigbee_Light0 = Matter_Plugin_Zigbee_Light0
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Light1.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Light1.be
new file mode 100644
index 000000000..4f9d1f34a
--- /dev/null
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Light1.be
@@ -0,0 +1,37 @@
+#
+# Matter_Plugin_9_Zigbee_Temperature.be - implements the behavior for a Zigbee Light1
+#
+# Copyright (C) 2023 Stephan Hadinger & Theo Arends
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+
+import matter
+
+# Matter plug-in for core behavior
+
+#@ solidify:Matter_Plugin_Zigbee_Light1,weak
+
+class Matter_Plugin_Zigbee_Light1 : Matter_Plugin_Light1
+ static var ZIGBEE = true
+ static var TYPE = "z_light1" # name of the plug-in in json
+ static var DISPLAY_NAME = "Zig Light 1 Dimmer" # display name of the plug-in
+ static var ARG = "zigbee_device" # zigbee device
+ static var ARG_TYPE = / x -> str(x) # function to convert argument to the right type
+ static var ARG_HINT = "Device" # Hint for entering the Argument (inside 'placeholder')
+ static var VIRTUAL = true # virtual device, necessary for Zigbee mapping
+ var zigbee_mapper # required for zigbee device
+
+end
+matter.Plugin_Zigbee_Light1 = Matter_Plugin_Zigbee_Light1
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Light2.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Light2.be
new file mode 100644
index 000000000..8b30b96a5
--- /dev/null
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Light2.be
@@ -0,0 +1,37 @@
+#
+# Matter_Plugin_9_Zigbee_Temperature.be - implements the behavior for a Zigbee Light2
+#
+# Copyright (C) 2023 Stephan Hadinger & Theo Arends
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+
+import matter
+
+# Matter plug-in for core behavior
+
+#@ solidify:Matter_Plugin_Zigbee_Light2,weak
+
+class Matter_Plugin_Zigbee_Light2 : Matter_Plugin_Light2
+ static var ZIGBEE = true
+ static var TYPE = "z_light2" # name of the plug-in in json
+ static var DISPLAY_NAME = "Zig Light 2 CT" # display name of the plug-in
+ static var ARG = "zigbee_device" # zigbee device
+ static var ARG_TYPE = / x -> str(x) # function to convert argument to the right type
+ static var ARG_HINT = "Device" # Hint for entering the Argument (inside 'placeholder')
+ static var VIRTUAL = true # virtual device, necessary for Zigbee mapping
+ var zigbee_mapper # required for zigbee device
+
+end
+matter.Plugin_Zigbee_Light2 = Matter_Plugin_Zigbee_Light2
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Occupancy.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Occupancy.be
new file mode 100644
index 000000000..7ad70e281
--- /dev/null
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Occupancy.be
@@ -0,0 +1,38 @@
+#
+# Matter_Plugin_9_Zigbee_Occupancy.be - implements the behavior for a Zigbee Occupancy sensor
+#
+# Copyright (C) 2023 Stephan Hadinger & Theo Arends
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+
+import matter
+
+# Matter plug-in for core behavior
+
+#@ solidify:Matter_Plugin_Zigbee_Occupancy,weak
+
+class Matter_Plugin_Zigbee_Occupancy : Matter_Plugin_Sensor_Occupancy
+ static var ZIGBEE = true
+ static var TYPE = "z_occupancy" # name of the plug-in in json
+ static var DISPLAY_NAME = "Zig Occupancy" # display name of the plug-in
+ static var ZIGBEE_NAME = "Occupancy" # name of zigbee attribute with sensor reported
+ static var ARG = "zigbee_device" # zigbee device
+ static var ARG_TYPE = / x -> str(x) # function to convert argument to the right type
+ static var ARG_HINT = "Device" # Hint for entering the Argument (inside 'placeholder')
+ static var VIRTUAL = true # virtual device, necessary for Zigbee mapping
+ var zigbee_mapper # required for zigbee device
+
+end
+matter.Plugin_Zigbee_Occupancy = Matter_Plugin_Zigbee_Occupancy
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Pressure.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Pressure.be
new file mode 100644
index 000000000..a98501000
--- /dev/null
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Pressure.be
@@ -0,0 +1,38 @@
+#
+# Matter_Plugin_9_Zigbee_Pressure.be - implements the behavior for a Zigbee Pressure sensor
+#
+# Copyright (C) 2023 Stephan Hadinger & Theo Arends
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+
+import matter
+
+# Matter plug-in for core behavior
+
+#@ solidify:Matter_Plugin_Zigbee_Pressure,weak
+
+class Matter_Plugin_Zigbee_Pressure : Matter_Plugin_Sensor_Pressure
+ static var ZIGBEE = true
+ static var TYPE = "z_pressure" # name of the plug-in in json
+ static var DISPLAY_NAME = "Zig Pressure" # display name of the plug-in
+ static var ZIGBEE_NAME = "Pressure" # name of zigbee attribute with sensor reported
+ static var ARG = "zigbee_device" # zigbee device
+ static var ARG_TYPE = / x -> str(x) # function to convert argument to the right type
+ static var ARG_HINT = "Device" # Hint for entering the Argument (inside 'placeholder')
+ static var VIRTUAL = true # virtual device, necessary for Zigbee mapping
+ var zigbee_mapper # required for zigbee device
+
+end
+matter.Plugin_Zigbee_Pressure = Matter_Plugin_Zigbee_Pressure
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Temperature.be b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Temperature.be
new file mode 100644
index 000000000..4f0be645c
--- /dev/null
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_Plugin_9_Zigbee_Temperature.be
@@ -0,0 +1,38 @@
+#
+# Matter_Plugin_9_Zigbee_Temperature.be - implements the behavior for a Zigbee Temperature sensor
+#
+# Copyright (C) 2023 Stephan Hadinger & Theo Arends
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+
+import matter
+
+# Matter plug-in for core behavior
+
+#@ solidify:Matter_Plugin_Zigbee_Temperature,weak
+
+class Matter_Plugin_Zigbee_Temperature : Matter_Plugin_Sensor_Temp
+ static var ZIGBEE = true
+ static var TYPE = "z_temp" # name of the plug-in in json
+ static var DISPLAY_NAME = "Zig Temperature" # display name of the plug-in
+ static var ZIGBEE_NAME = "Temperature" # name of zigbee attribute with sensor reported
+ static var ARG = "zigbee_device" # zigbee device
+ static var ARG_TYPE = / x -> str(x) # function to convert argument to the right type
+ static var ARG_HINT = "Device" # Hint for entering the Argument (inside 'placeholder')
+ static var VIRTUAL = true # virtual device, necessary for Zigbee mapping
+ var zigbee_mapper # required for zigbee device
+
+end
+matter.Plugin_Zigbee_Temperature = Matter_Plugin_Zigbee_Temperature
diff --git a/lib/libesp32/berry_matter/src/embedded/Matter_UI.be b/lib/libesp32/berry_matter/src/embedded/Matter_UI.be
index d2acce51e..7117500d2 100644
--- a/lib/libesp32/berry_matter/src/embedded/Matter_UI.be
+++ b/lib/libesp32/berry_matter/src/embedded/Matter_UI.be
@@ -32,11 +32,13 @@ import matter
# WebUI for the partition manager
#################################################################################
class Matter_UI
- static var _CLASSES_TYPES = "|relay|light0|light1|light2|light3|shutter|shutter+tilt"
+ static var _CLASSES_TYPES_STD =
+ "|relay|light0|light1|light2|light3|shutter|shutter+tilt"
"|gensw_btn"
"|temperature|pressure|illuminance|humidity|occupancy|onoff|contact|flow|rain|waterleak"
"|airquality"
- "|-virtual|v_relay|v_light0|v_light1|v_light2|v_light3"
+ static var _CLASSES_TYPES_VIRTUAL =
+ "-virtual|v_relay|v_light0|v_light1|v_light2|v_light3"
"|v_fan"
"|v_temp|v_pressure|v_illuminance|v_humidity|v_occupancy|v_contact|v_flow|v_rain|v_waterleak"
"|v_airquality"
@@ -45,6 +47,7 @@ class Matter_UI
"|http_occupancy|http_contact|http_flow|http_rain|http_waterleak"
"|http_airquality"
var device
+ var matter_enabled
# ####################################################################################################
# Static function to compare two maps (shallow compare)
@@ -64,8 +67,9 @@ class Matter_UI
# ####################################################################################################
# Constructor
- def init(device)
+ def init(device, matter_enabled)
self.device = device
+ self.matter_enabled = matter_enabled
tasmota.add_driver(self)
end
@@ -81,13 +85,6 @@ class Matter_UI
webserver.content_send(" Configure Matter
")
end
- #- ---------------------------------------------------------------------- -#
- #- Is Matter enabled?
- #- ---------------------------------------------------------------------- -#
- def matter_enabled()
- return bool(tasmota.get_option(matter.MATTER_OPTION))
- end
-
#- ---------------------------------------------------------------------- -#
#- Show commissioning information and QR Code
#
@@ -102,11 +99,11 @@ class Matter_UI
"