Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the ElectriQ iQ-wifiMOODL RGBW LED controller #7947

Merged
merged 9 commits into from
Mar 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BUILDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
| USE_SM16716 | - | - | x | x | x | - | x |
| USE_SM2135 | - | - | x | x | x | - | x |
| USE_SONOFF_L1 | - | - | x | x | x | - | x |
| USE_ELECTRIQ_MOODL | - | - | - | - | - | - | - |
| | | | | | | | |
| USE_ENERGY_SENSOR | - | x | x | x | x | - | - |
| USE_PZEM004T | - | - | x | x | x | - | - |
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/bg-BG.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/cs-CZ.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/de-DE.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/el-GR.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/en-GB.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/es-ES.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/fr-FR.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/he-HE.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/hu-HU.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/it-IT.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/ko-KO.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/nl-NL.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/pl-PL.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/pt-BR.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/pt-PT.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/ro-RO.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/ru-RU.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "А"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/sk-SK.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/sv-SE.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/tr-TR.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "A"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/uk-UA.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "А"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/zh-CN.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "安"
Expand Down
1 change: 1 addition & 0 deletions tasmota/language/zh-TW.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@
#define D_SENSOR_CC1101_GDO0 "CC1101 GDO0"
#define D_SENSOR_CC1101_GDO2 "CC1101 GDO2"
#define D_SENSOR_HRXL_RX "HRXL Rx"
#define D_SENSOR_ELECTRIQ_MOODL "MOODL Tx"

// Units
#define D_UNIT_AMPERE "安"
Expand Down
1 change: 1 addition & 0 deletions tasmota/my_user_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@
#define USE_SM16716 // Add support for SM16716 RGB LED controller (+0k7 code)
#define USE_SM2135 // Add support for SM2135 RGBCW led control as used in Action LSC (+0k6 code)
#define USE_SONOFF_L1 // Add support for Sonoff L1 led control
#define USE_ELECTRIQ_MOODL // Add support for ElectriQ iQ-wifiMOODL RGBW LED controller

// -- Counter input -------------------------------
#define USE_COUNTER // Enable inputs as counter (+0k8 code)
Expand Down
4 changes: 4 additions & 0 deletions tasmota/tasmota_post.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack
#define USE_SM16716 // Add support for SM16716 RGB LED controller (+0k7 code)
#define USE_SM2135 // Add support for SM2135 RGBCW led control as used in Action LSC (+0k6 code)
#define USE_SONOFF_L1 // Add support for Sonoff L1 led control
//#define USE_ELECTRIQ_MOODL // Add support for ElectriQ iQ-wifiMOODL RGBW LED controller

#define USE_COUNTER // Enable counters
#undef USE_ADC_VCC // Add Analog input on selected devices
Expand Down Expand Up @@ -399,6 +400,7 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack
#undef USE_SM16716 // Disable support for SM16716 RGB LED controller (+0k7 code)
#undef USE_SM2135 // Disable support for SM2135 RGBCW led control as used in Action LSC (+0k6 code)
#undef USE_SONOFF_L1 // Disable support for Sonoff L1 led control
#undef USE_ELECTRIQ_MOODL // Add support for ElectriQ iQ-wifiMOODL RGBW LED controller

#undef USE_ENERGY_SENSOR // Disable energy sensors (-14k code)
#undef USE_PZEM004T // Disable PZEM004T energy sensor
Expand Down Expand Up @@ -512,6 +514,7 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack
#undef USE_SM16716 // Disable support for SM16716 RGB LED controller (+0k7 code)
#undef USE_SM2135 // Disable support for SM2135 RGBCW led control as used in Action LSC (+0k6 code)
#undef USE_SONOFF_L1 // Disable support for Sonoff L1 led control
#undef USE_ELECTRIQ_MOODL // Add support for ElectriQ iQ-wifiMOODL RGBW LED controller

#undef USE_COUNTER // Disable counters
#define USE_ADC_VCC // Display Vcc in Power status. Disable for use as Analog input on selected devices
Expand Down Expand Up @@ -632,6 +635,7 @@ extern "C" void custom_crash_callback(struct rst_info * rst_info, uint32_t stack
#undef USE_SM16716 // Disable support for SM16716 RGB LED controller (+0k7 code)
#undef USE_SM2135 // Disable support for SM2135 RGBCW led control as used in Action LSC (+0k6 code)
#undef USE_SONOFF_L1 // Disable support for Sonoff L1 led control
#undef USE_ELECTRIQ_MOODL // Add support for ElectriQ iQ-wifiMOODL RGBW LED controller

#undef USE_COUNTER // Disable counters
#define USE_ADC_VCC // Display Vcc in Power status. Disable for use as Analog input on selected devices
Expand Down
7 changes: 6 additions & 1 deletion tasmota/tasmota_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ enum UserSelectablePins {
GPIO_CC1101_GDO0, // CC1101 pin for RX
GPIO_CC1101_GDO2, // CC1101 pin for RX
GPIO_HRXL_RX, // Data from MaxBotix HRXL sonar range sensor
GPIO_ELECTRIQ_MOODL_TX, // ElectriQ iQ-wifiMOODL Serial TX
GPIO_SENSOR_END };

// Programmer selectable GPIO functionality
Expand Down Expand Up @@ -310,7 +311,8 @@ const char kSensorNames[] PROGMEM =
D_SENSOR_HM10_RX "|" D_SENSOR_HM10_TX "|"
D_SENSOR_LE01MR_RX "|" D_SENSOR_LE01MR_TX "|"
D_SENSOR_CC1101_GDO0 "|" D_SENSOR_CC1101_GDO2 "|"
D_SENSOR_HRXL_RX
D_SENSOR_HRXL_RX "|"
D_SENSOR_ELECTRIQ_MOODL
;

const char kSensorNamesFixed[] PROGMEM =
Expand Down Expand Up @@ -611,6 +613,9 @@ const uint8_t kGpioNiceList[] PROGMEM = {
#ifdef USE_EXS_DIMMER
GPIO_EXS_ENABLE, // EXS MCU Enable
#endif
#ifdef USE_ELECTRIQ_MOODL
GPIO_ELECTRIQ_MOODL_TX,
#endif
#endif // USE_LIGHT

#if defined(USE_IR_REMOTE) || defined(USE_IR_REMOTE_FULL)
Expand Down
102 changes: 102 additions & 0 deletions tasmota/xlgt_06_electriq_moodl.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/*
xlgt_06_moodlamp.ino - ElectriQ iQ-wifiMOODL LED support for Tasmota

Copyright (C) 2020 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 <http://www.gnu.org/licenses/>.
*/

#ifdef USE_LIGHT
#ifdef USE_ELECTRIQ_MOODL

/*********************************************************************************************\
* ElectriQ iQ-wifiMOODL
* This RGBW mood lamp uses the TYWE3S module to transmit via UART to an unmarked MCU which
* drives 8 MOSFETs. The MCU does not transmit; it only receives commands from the TYWE3S.
* The MCU appears to use a modified/undocumented version of the TuyaMCU protocol.
* The main PCB has 2 daughter boards which hold the RGBW LEDs - an upper deck and a lower deck.
* The same RGBW data is transmitted to the upper and lower decks.
* *********************************************************************************************/

#define XLGT_06 6

/********************************************************************************************/

bool ElectriqMoodLSetChannels(void)
{
uint8_t *col = (uint8_t*)XdrvMailbox.data;
uint8_t checksum = (uint8_t)(0x65 + 0xAA + 0x01 + 0x0A);

Serial.write(0x65); // Fixed header
Serial.write(0xAA);
Serial.write(0x00); // Version
Serial.write(0x01); // Command
Serial.write(0x0A); // Payload length

uint8_t payload[5];
payload[0] = col[0];
payload[1] = col[1];
payload[2] = col[2];
payload[3] = col[3];
payload[4] = 0x0; // Unused

// Send payload for the upper LED deck
for (uint32_t i = 0; i < 5; i++) {
Serial.write(payload[i]);
checksum += payload[i];
}

// Send payload for the lower LED deck
for (uint32_t i = 0; i < 5; i++) {
Serial.write(payload[i]);
checksum += payload[i];
}

Serial.write(checksum);
Serial.flush();

return true;
}

void ElectriqMoodLModuleSelected(void)
{
if (pin[GPIO_ELECTRIQ_MOODL_TX] < 99) {
SetSerial(9600, TS_SERIAL_8N1);
light_type = LT_RGBW;
light_flg = XLGT_06;
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("DBG: ElectriQ Mood Lamp Found"));
}
}

/*********************************************************************************************\
* Interface
\*********************************************************************************************/

bool Xlgt06(uint8_t function)
{
bool result = false;

switch (function) {
case FUNC_SET_CHANNELS:
result = ElectriqMoodLSetChannels();
break;
case FUNC_MODULE_INIT:
ElectriqMoodLModuleSelected();
break;
}
return result;
}

#endif // USE_ELECTRIQ_MOODL
#endif // USE_LIGHT