From 6843f58a91058ed01c8591b7e137b70871f38ff2 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 14 Jul 2020 17:37:14 +0200 Subject: [PATCH] Add support for Schneider Electric iEM3000 Add support for Schneider Electric iEM3000 series Modbus energy meter by Marius Bezuidenhout --- RELEASENOTES.md | 7 ++++--- tasmota/CHANGELOG.md | 1 + tasmota/xdrv_16_tuyamcu.ino | 8 ++++---- tasmota/{xnrg_17_iem3000.ino => xnrg_16_iem3000.ino} | 12 ++++++------ tasmota/xnrg_interface.ino | 2 +- tools/decode-status.py | 4 ++-- 6 files changed, 18 insertions(+), 16 deletions(-) rename tasmota/{xnrg_17_iem3000.ino => xnrg_16_iem3000.ino} (97%) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index fdafb0535..7e0208ef1 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -71,6 +71,7 @@ The following binary downloads have been compiled with ESP8266/Arduino library c - Add command ``Module2`` to configure fallback module on fast reboot (#8464) - Add commands ``LedPwmOn 0..255``, ``LedPwmOff 0..255`` and ``LedPwmMode1 0/1`` to control led brightness by George (#8491) - Add ESP32 ethernet commands ``EthType 0/1``, ``EthAddress 0..31`` and ``EthClockMode 0..3`` +- Add rule trigger ``System#Init`` to allow early rule execution without wifi and mqtt initialized yet - Add support for unique MQTTClient (and inherited fallback topic) by full Mac address using ``mqttclient DVES_%12X`` (#8300) - Add more functionality to ``Switchmode`` 11 and 12 (#8450) - Add wildcard pattern ``?`` for JSON matching in rules @@ -84,14 +85,14 @@ The following binary downloads have been compiled with ESP8266/Arduino library c - Add support for up to two BH1750 sensors controlled by commands ``BH1750Resolution`` and ``BH1750MTime`` (#8139) - Add support for up to eight MCP9808 temperature sensors by device111 (#8594) - Add support for BL0940 energy monitor as used in Blitzwolf BW-SHP10 (#8175) -- Add initial support for Telegram bot (#8619) +- Add support for Telegram bot (#8619) - Add support for HP303B Temperature and Pressure sensor by Robert Jaakke (#8638) -- Add rule trigger ``System#Init`` to allow early rule execution without wifi and mqtt initialized yet - Add 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 - Add Library to be used for decoding Teleinfo (French Metering Smart Meter) -- Add basic support for ESP32 ethernet adding commands ``Wifi 0/1`` and ``Ethernet 0/1`` both default ON +- Add support for ESP32 ethernet adding commands ``Wifi 0/1`` and ``Ethernet 0/1`` both default ON - Add support for single wire LMT01 temperature Sensor by justifiably (#8713) - Add compile time interlock parameters (#8759) - Add compile time user template (#8766) - Add rotary encoder support for light dimmer and optional color temperature if button1 still pressed (#8670) - Add support for switches/relays using an AC detection circuitry e.g. MOES MS-104B or BlitzWolf SS5 (#8606) +- Add support for Schneider Electric iEM3000 series Modbus energy meter by Marius Bezuidenhout diff --git a/tasmota/CHANGELOG.md b/tasmota/CHANGELOG.md index a459c2aac..854969579 100644 --- a/tasmota/CHANGELOG.md +++ b/tasmota/CHANGELOG.md @@ -12,6 +12,7 @@ - Add compile time user template (#8766) - Add rotary encoder support for light dimmer and optional color temperature if button1 still pressed (#8670) - Add support for switches/relays using an AC detection circuitry e.g. MOES MS-104B or BlitzWolf SS5 (#8606) +- Add support for Schneider Electric iEM3000 series Modbus energy meter by Marius Bezuidenhout - Fix exception or watchdog on rule re-entry (#8757) - Change ESP32 USER GPIO template representation decreasing template message size - Change define USE_TASMOTA_SLAVE into USE_TASMOTA_CLIENT diff --git a/tasmota/xdrv_16_tuyamcu.ino b/tasmota/xdrv_16_tuyamcu.ino index fcc6848db..7165126f5 100644 --- a/tasmota/xdrv_16_tuyamcu.ino +++ b/tasmota/xdrv_16_tuyamcu.ino @@ -21,7 +21,7 @@ #ifdef USE_TUYA_MCU #define XDRV_16 16 -#define XNRG_16 16 // Needs to be the last XNRG_xx +#define XNRG_32 32 // Needs to be the last XNRG_xx #ifndef TUYA_DIMMER_ID #define TUYA_DIMMER_ID 0 @@ -455,7 +455,7 @@ void TuyaProcessStatePacket(void) { } else if (Tuya.buffer[dpidStart + 1] == 2) { // Data Type 2 - bool tuya_energy_enabled = (XNRG_16 == energy_flg); + bool tuya_energy_enabled = (XNRG_32 == energy_flg); uint16_t packetValue = Tuya.buffer[dpidStart + 6] << 8 | Tuya.buffer[dpidStart + 7]; if (fnId == TUYA_MCU_FUNC_DIMMER) { AddLog_P2(LOG_LEVEL_DEBUG, PSTR("TYA: RX Dim State=%d"), packetValue); @@ -827,7 +827,7 @@ void TuyaSetTime(void) * Energy Interface \*********************************************************************************************/ -bool Xnrg16(uint8_t function) +bool Xnrg32(uint8_t function) { bool result = false; @@ -840,7 +840,7 @@ bool Xnrg16(uint8_t function) if (TuyaGetDpId(TUYA_MCU_FUNC_VOLTAGE) == 0) { Energy.voltage_available = false; } - energy_flg = XNRG_16; + energy_flg = XNRG_32; } } } diff --git a/tasmota/xnrg_17_iem3000.ino b/tasmota/xnrg_16_iem3000.ino similarity index 97% rename from tasmota/xnrg_17_iem3000.ino rename to tasmota/xnrg_16_iem3000.ino index 040938dbc..807d142e3 100644 --- a/tasmota/xnrg_17_iem3000.ino +++ b/tasmota/xnrg_16_iem3000.ino @@ -1,5 +1,5 @@ /* - xnrg_17_iem3000.ino - Schneider Electric iEM3000 series Modbus energy meter support for Tasmota + xnrg_16_iem3000.ino - Schneider Electric iEM3000 series Modbus energy meter support for Tasmota Copyright (C) 2020 Marius Bezuidenhout @@ -25,7 +25,7 @@ * Important! Set meter Commnication -> Parity to None \*********************************************************************************************/ -#define XNRG_17 17 +#define XNRG_16 16 // can be user defined in my_user_config.h #ifndef IEM3000_SPEED @@ -105,11 +105,11 @@ void IEM3000Every250ms(void) case 0: Energy.current[0] = value; break; - + case 1: Energy.current[1] = value; break; - + case 2: Energy.current[2] = value; break; @@ -178,7 +178,7 @@ void Iem3000SnsInit(void) void Iem3000DrvInit(void) { if (PinUsed(GPIO_IEM3000_RX) && PinUsed(GPIO_IEM3000_TX)) { - energy_flg = XNRG_17; + energy_flg = XNRG_16; } } @@ -186,7 +186,7 @@ void Iem3000DrvInit(void) * Interface \*********************************************************************************************/ -bool Xnrg17(uint8_t function) +bool Xnrg16(uint8_t function) { bool result = false; diff --git a/tasmota/xnrg_interface.ino b/tasmota/xnrg_interface.ino index f6a9a051f..97ab5aec2 100644 --- a/tasmota/xnrg_interface.ino +++ b/tasmota/xnrg_interface.ino @@ -149,7 +149,7 @@ bool (* const xnrg_func_ptr[])(uint8_t) = { // Energy driver Function Pointers &Xnrg31, #endif -#ifdef XNRG_32 +#ifdef XNRG_32 // Reserved for use by xdrv_16_tuyamcu.ino &Xnrg32 #endif }; diff --git a/tools/decode-status.py b/tools/decode-status.py index e6e4138bd..22329c5f6 100755 --- a/tools/decode-status.py +++ b/tools/decode-status.py @@ -209,7 +209,7 @@ a_features = [[ "USE_WINDMETER","USE_OPENTHERM","USE_THERMOSTAT","USE_VEML6075", "USE_VEML7700","USE_MCP9808","USE_BL0940","USE_TELEGRAM", "USE_HP303B","USE_TCP_BRIDGE","USE_TELEINFO","USE_LMT01", - "USE_PROMETHEUS","","","", + "USE_PROMETHEUS","USE_IEM3000","","", "","","","", "","","USE_ETHERNET","USE_WEBCAM" ]] @@ -239,7 +239,7 @@ else: obj = json.load(fp) def StartDecode(): - print ("\n*** decode-status.py v20200704 by Theo Arends and Jacek Ziolkowski ***") + print ("\n*** decode-status.py v20200714 by Theo Arends and Jacek Ziolkowski ***") # print("Decoding\n{}".format(obj))