mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 11:16:34 +00:00
Merge branch 'development' into release
This commit is contained in:
commit
efc444f729
@ -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 | - | - | x | x | x | - | x |
|
||||
| | | | | | | | |
|
||||
| USE_ENERGY_SENSOR | - | x | x | x | x | - | - |
|
||||
| USE_PZEM004T | - | - | x | x | x | - | - |
|
||||
|
@ -124,3 +124,4 @@ The following binary downloads have been compiled with ESP8266/Arduino library c
|
||||
- Add support for Jarolift rollers by Keeloq algorithm
|
||||
- Add support for MaxBotix HRXL-MaxSonar ultrasonic range finders by Jon Little (#7814)
|
||||
- Add support for HDC1080 Temperature and Humidity sensor by Luis Teixeira (#7888)
|
||||
- Add support for ElectriQ iQ-wifiMOODL RGBW light by ianbyte (#7947)
|
||||
|
@ -8,13 +8,14 @@
|
||||
|
||||
### 8.1.0.11 20200313
|
||||
|
||||
- Change Zigbee simplification of devices probing, saving Flash and memory
|
||||
- Add HAss Discovery support for Button and Switch triggers by Federico Leoni (#7901)
|
||||
- Add support for HDC1080 Temperature and Humidity sensor by Luis Teixeira (#7888)
|
||||
- Add commands ``SwitchMode 13`` PushOn and ``SwitchMode 14`` PushOnInverted (#7912)
|
||||
- Add command ``HumOffset -10.0 .. 10.0`` to set global humidity sensor offset (#7934)
|
||||
- Add Zigbee support for Hue emulation by Stefan Hadinger
|
||||
- Add Dew Point to Temperature and Humidity sensors
|
||||
- Change Zigbee simplification of devices probing, saving Flash and memory
|
||||
- Add support for ElectriQ iQ-wifiMOODL RGBW light by ianbyte (#7947)
|
||||
|
||||
### 8.1.0.10 20200227
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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 "А"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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 "А"
|
||||
|
@ -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 "安"
|
||||
|
@ -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 "安"
|
||||
|
@ -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 (+0k3 code)
|
||||
|
||||
// -- Counter input -------------------------------
|
||||
#define USE_COUNTER // Enable inputs as counter (+0k8 code)
|
||||
|
@ -135,6 +135,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
|
||||
@ -400,6 +401,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
|
||||
@ -513,6 +515,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
|
||||
@ -633,6 +636,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
|
||||
|
@ -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
|
||||
@ -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 =
|
||||
@ -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)
|
||||
|
@ -23,30 +23,31 @@
|
||||
|
||||
// List of sensors ready for discovery
|
||||
const char kHAssJsonSensorTypes[] PROGMEM =
|
||||
D_JSON_TEMPERATURE "|" D_JSON_PRESSURE "|" D_JSON_PRESSUREATSEALEVEL "|"
|
||||
D_JSON_TEMPERATURE "|" D_JSON_DEWPOINT "|" D_JSON_PRESSURE "|" D_JSON_PRESSUREATSEALEVEL "|"
|
||||
D_JSON_APPARENT_POWERUSAGE "|Battery|" D_JSON_CURRENT "|" D_JSON_DISTANCE "|" D_JSON_FREQUENCY "|" D_JSON_HUMIDITY "|" D_JSON_ILLUMINANCE "|"
|
||||
D_JSON_MOISTURE "|PB0.3|PB0.5|PB1|PB2.5|PB5|PB10|PM1|PM2.5|PM10|" D_JSON_POWERFACTOR "|" D_JSON_POWERUSAGE "|"
|
||||
D_JSON_REACTIVE_POWERUSAGE "|" D_JSON_TODAY "|" D_JSON_TOTAL "|" D_JSON_VOLTAGE "|" D_JSON_WEIGHT "|" D_JSON_YESTERDAY
|
||||
D_JSON_CO2 "|" D_JSON_ECO2 "|" D_JSON_TVOC;
|
||||
D_JSON_REACTIVE_POWERUSAGE "|" D_JSON_TODAY "|" D_JSON_TOTAL "|" D_JSON_VOLTAGE "|" D_JSON_WEIGHT "|" D_JSON_YESTERDAY "|"
|
||||
D_JSON_CO2 "|" D_JSON_ECO2 "|" D_JSON_TVOC "|";
|
||||
const char kHAssJsonSensorUnits[] PROGMEM =
|
||||
"|||"
|
||||
"||||"
|
||||
"VA|%|A|Cm|Hz|%|LX|"
|
||||
"%|ppd|ppd|ppd|ppd|ppd|ppd|µg/m³|µg/m³|µg/m³|Cos φ|W|"
|
||||
"VAr|kWh|kWh|V|Kg|kWh|"
|
||||
"ppm|ppm|ppb|";
|
||||
const char kHAssJsonSensorDevCla[] PROGMEM =
|
||||
"dev_cla\":\"temperature|dev_cla\":\"pressure|dev_cla\":\"pressure|"
|
||||
"dev_cla\":\"temperature|ic\":\"mdi:weather-rainy|dev_cla\":\"pressure|dev_cla\":\"pressure|"
|
||||
"dev_cla\":\"power|dev_cla\":\"battery|ic\":\"mdi:alpha-a-circle-outline|ic\":\"mdi:leak|ic\":\"mdi:current-ac|dev_cla\":\"humidity|dev_cla\":\"illuminance|"
|
||||
"ic\":\"mdi:cup-water|ic\":\"mdi:flask|ic\":\"mdi:flask|ic\":\"mdi:flask|ic\":\"mdi:flask|ic\":\"mdi:flask|ic\":\"mdi:flask|"
|
||||
"ic\":\"mdi:air-filter|ic\":\"mdi:air-filter|ic\":\"mdi:air-filter|ic\":\"mdi:alpha-f-circle-outline|dev_cla\":\"power|"
|
||||
"dev_cla\":\"power|dev_cla\":\"power|dev_cla\":\"power|ic\":\"mdi:alpha-v-circle-outline|ic\":\"mdi:scale|dev_cla\":\"power"
|
||||
"ic\":\"mdi:periodic-table-co2|ic\":\"mdi:air-filter|ic\":\"mdi:periodic-table-co2";
|
||||
"dev_cla\":\"power|dev_cla\":\"power|dev_cla\":\"power|ic\":\"mdi:alpha-v-circle-outline|ic\":\"mdi:scale|dev_cla\":\"power|"
|
||||
"ic\":\"mdi:periodic-table-co2|ic\":\"mdi:air-filter|ic\":\"mdi:periodic-table-co2|";
|
||||
//"ic\":\"mdi:weather-windy|ic\":\"mdi:weather-windy|ic\":\"mdi:weather-windy|ic\":\"mdi:weather-windy|"
|
||||
// List of sensors ready for discovery
|
||||
|
||||
const char HASS_DISCOVER_SENSOR[] PROGMEM =
|
||||
",\"unit_of_meas\":\"%s\",\"%s\"," // unit of measure and class (or icon)
|
||||
"\"frc_upd\":true," // force update for better graph representation
|
||||
"\"val_tpl\":\"{{value_json['%s']['%s']"; // "COUNTER":{"C1":0} -> {{ value_json['COUNTER'].['C1']
|
||||
"\"val_tpl\":\"{{value_json['%s']['%s']"; // "COUNTER":{"C1":0} -> {{ value_json['COUNTER']['C1']
|
||||
|
||||
const char HASS_DISCOVER_BASE[] PROGMEM =
|
||||
"{\"name\":\"%s\"," // dualr2 1
|
||||
@ -369,6 +370,8 @@ void HAssAnnounceSwitches(void)
|
||||
// INV (not available) CLEAR (not available)
|
||||
// 12 PUSHHOLDMULTI_INV NO TOGGLE (button_short_press) NONE CLEAR (button_long_press) 1,0
|
||||
// INV (not available) INC_DEC (not available)
|
||||
// 13 PUSHON YES NONE NONE NONE 0,0
|
||||
// 14 PUSHON_INV YES NONE NONE NONE 0,0
|
||||
// Please note: SwitchMode11 and 12 will register just TOGGLE (button_short_press)
|
||||
|
||||
// Trigger types: "0 = none | 1 = button_short_press | 2 = button_long_press | 3 = button_double_press";
|
||||
@ -469,17 +472,20 @@ void HAssAnnounceButtons(void)
|
||||
}
|
||||
}
|
||||
|
||||
void HAssAnnounceSensor(const char *sensorname, const char *subsensortype, const char *MultiSubName, uint8_t subqty, uint8_t subidx)
|
||||
void HAssAnnounceSensor(const char *sensorname, const char *subsensortype, const char *MultiSubName, uint8_t subqty, uint8_t subidx, uint8_t nested, const char* SubKey)
|
||||
{
|
||||
char stopic[TOPSZ];
|
||||
char stemp1[TOPSZ];
|
||||
char stemp2[TOPSZ];
|
||||
char unique_id[30];
|
||||
char subname[20];
|
||||
|
||||
mqtt_data[0] = '\0'; // Clear retained message
|
||||
// Clear or Set topic
|
||||
snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_%s_%s"), ESP.getChipId(), sensorname, MultiSubName);
|
||||
snprintf_P(stopic, sizeof(stopic), PSTR(HOME_ASSISTANT_DISCOVERY_PREFIX "/sensor/%s/config"), unique_id);;
|
||||
|
||||
// Clear or Set topic
|
||||
NoAlNumToUnderscore(subname, MultiSubName); //Replace all non alphaumeric characters to '_' to avoid topic name issues
|
||||
snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_%s_%s"), ESP.getChipId(), sensorname, subname);
|
||||
snprintf_P(stopic, sizeof(stopic), PSTR(HOME_ASSISTANT_DISCOVERY_PREFIX "/sensor/%s/config"), unique_id);
|
||||
|
||||
if (Settings.flag.hass_discovery)
|
||||
{ // SetOption19 - Control Home Assistantautomatic discovery (See SetOption59)
|
||||
@ -497,28 +503,44 @@ void HAssAnnounceSensor(const char *sensorname, const char *subsensortype, const
|
||||
|
||||
|
||||
char jname[32];
|
||||
int sensor_index = GetCommandCode(jname, sizeof(jname), subsensortype, kHAssJsonSensorTypes);
|
||||
int sensor_index = GetCommandCode(jname, sizeof(jname), SubKey, kHAssJsonSensorTypes);
|
||||
if (sensor_index > -1) {
|
||||
|
||||
char param1[20];
|
||||
GetTextIndexed(param1, sizeof(param1), sensor_index, kHAssJsonSensorUnits);
|
||||
switch (sensor_index) {
|
||||
case 0: // Temperature
|
||||
case 0: // Temperature and DewPoint
|
||||
case 1:
|
||||
snprintf_P(param1, sizeof(param1), PSTR("°%c"),TempUnit()); // C or F
|
||||
break;
|
||||
case 1: // Pressure
|
||||
case 2:
|
||||
case 2: // Pressure and Sea Level Pressure
|
||||
case 3:
|
||||
snprintf_P(param1, sizeof(param1), PSTR("%s"), PressureUnit().c_str());
|
||||
break;
|
||||
}
|
||||
// case 4: // Speed. Default to km/h if not set to have a graph representation under HAss
|
||||
// case 5:
|
||||
// case 6:
|
||||
// case 7:
|
||||
// if (Settings.flag2.speed_conversion == 0) {
|
||||
// snprintf_P(param1, sizeof(param1), PSTR("km/h"));
|
||||
// } else {
|
||||
// snprintf_P(param1, sizeof(param1), PSTR("%s"), SpeedUnit().c_str());
|
||||
// }
|
||||
// break;
|
||||
}
|
||||
char param2[50];
|
||||
GetTextIndexed(param2, sizeof(param2), sensor_index, kHAssJsonSensorDevCla);
|
||||
TryResponseAppend_P(HASS_DISCOVER_SENSOR, param1, param2, sensorname, subsensortype);
|
||||
|
||||
if (subidx) {
|
||||
TryResponseAppend_P(PSTR("[%d]"), subqty -1);
|
||||
}
|
||||
} else {
|
||||
TryResponseAppend_P(HASS_DISCOVER_SENSOR, " ", "ic\":\"mdi:eye", sensorname, subsensortype);
|
||||
}
|
||||
if (nested) {
|
||||
TryResponseAppend_P(PSTR("['%s']"), SubKey);
|
||||
}
|
||||
TryResponseAppend_P(PSTR("}}\"}"));
|
||||
}
|
||||
MqttPublish(stopic, true);
|
||||
@ -527,8 +549,6 @@ void HAssAnnounceSensor(const char *sensorname, const char *subsensortype, const
|
||||
void HAssAnnounceSensors(void)
|
||||
{
|
||||
uint8_t hass_xsns_index = 0;
|
||||
bool is_sensor = true;
|
||||
uint8_t subqty = 0;
|
||||
do
|
||||
{
|
||||
mqtt_data[0] = '\0';
|
||||
@ -545,7 +565,8 @@ void HAssAnnounceSensors(void)
|
||||
sensordata[0] = '{';
|
||||
snprintf_P(sensordata, sizeof(sensordata), PSTR("%s}"), sensordata); // {"INA219":{"Voltage":4.494,"Current":0.020,"Power":0.089}}
|
||||
// USE THE FOLLOWING LINE TO TEST JSON
|
||||
//snprintf_P(sensordata, sizeof(sensordata), PSTR("{\"HX711\":{\"Weight\":[22,34,1023.4], \"Battery\":25}}"));
|
||||
//snprintf_P(sensordata, sizeof(sensordata), PSTR("{\"HX711\":{\"Weight\":[22,34,1023.4]}}"));
|
||||
//snprintf_P(sensordata, sizeof(sensordata), PSTR("{\"TX23\":{\"Speed\":{\"Act\":8.6,\"Avg\":8.2,\"Min\":0,\"Max\":15.8},\"Dir\":{\"Card\":\"SSO\",\"Deg\":157.5,\"Avg\":145.5,\"AvgCard\":\"SO\",\"Min\":112.5,\"Max\":292.5,\"Range\":180}}}"));
|
||||
|
||||
StaticJsonBuffer<500> jsonBuffer;
|
||||
JsonObject &root = jsonBuffer.parseObject(sensordata);
|
||||
@ -563,19 +584,29 @@ void HAssAnnounceSensors(void)
|
||||
AddLog_P2(LOG_LEVEL_ERROR, PSTR("HASS: JsonObject failed to parse '%s'"), sensordata);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (auto subsensor : sensors)
|
||||
{
|
||||
// If there is more than a value on sensor data, 'n' entitites will be created
|
||||
if (subsensor.value.is<JsonArray&>()) {
|
||||
if (subsensor.value.is<JsonObject&>()) {
|
||||
// If there is a nested json on sensor data, second level entitites will be created
|
||||
char NestedName[20];
|
||||
char NewSensorName[20];
|
||||
snprintf_P(NestedName, sizeof(NestedName), PSTR("%s"), subsensor.key);
|
||||
JsonObject& subsensors = subsensor.value.as<JsonObject>();
|
||||
for (auto subsensor : subsensors) {
|
||||
snprintf_P(NewSensorName, sizeof(NewSensorName), PSTR("%s %s"), NestedName, subsensor.key);
|
||||
HAssAnnounceSensor(sensorname, NestedName, NewSensorName, 0, 0, 1, subsensor.key);
|
||||
}
|
||||
} else if (subsensor.value.is<JsonArray&>()) {
|
||||
// If there is more than a value on sensor data, 'n' entitites will be created
|
||||
JsonArray& subsensors = subsensor.value.as<JsonArray&>();
|
||||
subqty = subsensors.size();
|
||||
uint8_t subqty = subsensors.size();
|
||||
char MultiSubName[20];
|
||||
for (int i = 1; i <= subqty; i++) {
|
||||
snprintf_P(MultiSubName, sizeof(MultiSubName), PSTR("%s_%d"), subsensor.key, i);
|
||||
HAssAnnounceSensor(sensorname, subsensor.key, MultiSubName, i, 1);
|
||||
|
||||
snprintf_P(MultiSubName, sizeof(MultiSubName), PSTR("%s %d"), subsensor.key, i);
|
||||
HAssAnnounceSensor(sensorname, subsensor.key, MultiSubName, i, 1, 0, subsensor.key);
|
||||
}
|
||||
} else { HAssAnnounceSensor(sensorname, subsensor.key, subsensor.key, 0, 0);}
|
||||
} else { HAssAnnounceSensor(sensorname, subsensor.key, subsensor.key, 0, 0, 0, subsensor.key);}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
101
tasmota/xlgt_06_electriq_moodl.ino
Normal file
101
tasmota/xlgt_06_electriq_moodl.ino
Normal file
@ -0,0 +1,101 @@
|
||||
/*
|
||||
xlgt_06_moodlamp.ino - ElectriQ iQ-wifiMOODL LED support for Tasmota
|
||||
|
||||
Copyright (C) 2020 ianbyte and 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("LGT: 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
|
Loading…
x
Reference in New Issue
Block a user