mirror of https://github.com/arendst/Tasmota.git
parent
71e2ec4cc9
commit
0fc019e418
|
@ -63,6 +63,7 @@ The following devices are supported:
|
|||
- [iTead Sonoff Led](https://www.itead.cc/sonoff-led.html)<img src="https://github.com/arendst/arendst.github.io/blob/master/media/sonoff4chpror2.jpg" height="250" align="right" />
|
||||
- [iTead Sonoff BN-SZ01 Ceiling Led](https://www.itead.cc/bn-sz01.html)
|
||||
- [iTead Sonoff B1](https://www.itead.cc/sonoff-b1.html)
|
||||
- [iTead Sonoff iFan02](https://www.itead.cc/sonoff-ifan02-wifi-smart-ceiling-fan-with-light.html)
|
||||
- [iTead Sonoff RF Bridge 433](https://www.itead.cc/sonoff-rf-bridge-433.html)
|
||||
- [iTead Sonoff Dev](https://www.itead.cc/sonoff-dev.html)
|
||||
- [iTead 1 Channel Switch 5V / 12V](https://www.itead.cc/smart-home/inching-self-locking-wifi-wireless-switch.html)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
/* 6.0.0b
|
||||
* Add initial support for Sonoff iFan02 - Module 44 - Command FanSpeed 0..3 - Webpage will only allow Toggle1 (#2839)
|
||||
* Add support for Sonoff S26 Smart Socket (#2808)
|
||||
* Add command SetOption30 to enforce Hass discovery as light group (#1784)
|
||||
* Add decimal values support for commands ADD, SUB, MULT and SCALE (#3083, #3089)
|
||||
|
|
|
@ -166,6 +166,7 @@
|
|||
#define D_STATUS11_STATUS "STS"
|
||||
#define D_CMND_STATE "State"
|
||||
#define D_CMND_POWER "Power"
|
||||
#define D_CMND_FANSPEED "FanSpeed"
|
||||
#define D_CMND_POWERONSTATE "PowerOnState"
|
||||
#define D_CMND_PULSETIME "PulseTime"
|
||||
#define D_CMND_BLINKTIME "BlinkTime"
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
#include "settings.h"
|
||||
|
||||
enum TasmotaCommands {
|
||||
CMND_BACKLOG, CMND_DELAY, CMND_POWER, CMND_STATUS, CMND_STATE, CMND_POWERONSTATE, CMND_PULSETIME,
|
||||
CMND_BACKLOG, CMND_DELAY, CMND_POWER, CMND_FANSPEED, CMND_STATUS, CMND_STATE, CMND_POWERONSTATE, CMND_PULSETIME,
|
||||
CMND_BLINKTIME, CMND_BLINKCOUNT, CMND_SENSOR, CMND_SAVEDATA, CMND_SETOPTION, CMND_TEMPERATURE_RESOLUTION, CMND_HUMIDITY_RESOLUTION,
|
||||
CMND_PRESSURE_RESOLUTION, CMND_POWER_RESOLUTION, CMND_VOLTAGE_RESOLUTION, CMND_CURRENT_RESOLUTION, CMND_ENERGY_RESOLUTION, CMND_MODULE, CMND_MODULES,
|
||||
CMND_GPIO, CMND_GPIOS, CMND_PWM, CMND_PWMFREQUENCY, CMND_PWMRANGE, CMND_COUNTER, CMND_COUNTERTYPE,
|
||||
|
@ -86,7 +86,7 @@ enum TasmotaCommands {
|
|||
CMND_TELEPERIOD, CMND_RESTART, CMND_RESET, CMND_TIMEZONE, CMND_TIMESTD, CMND_TIMEDST, CMND_ALTITUDE, CMND_LEDPOWER, CMND_LEDSTATE,
|
||||
CMND_I2CSCAN, CMND_SERIALSEND, CMND_BAUDRATE, CMND_SERIALDELIMITER };
|
||||
const char kTasmotaCommands[] PROGMEM =
|
||||
D_CMND_BACKLOG "|" D_CMND_DELAY "|" D_CMND_POWER "|" D_CMND_STATUS "|" D_CMND_STATE "|" D_CMND_POWERONSTATE "|" D_CMND_PULSETIME "|"
|
||||
D_CMND_BACKLOG "|" D_CMND_DELAY "|" D_CMND_POWER "|" D_CMND_FANSPEED "|" D_CMND_STATUS "|" D_CMND_STATE "|" D_CMND_POWERONSTATE "|" D_CMND_PULSETIME "|"
|
||||
D_CMND_BLINKTIME "|" D_CMND_BLINKCOUNT "|" D_CMND_SENSOR "|" D_CMND_SAVEDATA "|" D_CMND_SETOPTION "|" D_CMND_TEMPERATURE_RESOLUTION "|" D_CMND_HUMIDITY_RESOLUTION "|"
|
||||
D_CMND_PRESSURE_RESOLUTION "|" D_CMND_POWER_RESOLUTION "|" D_CMND_VOLTAGE_RESOLUTION "|" D_CMND_CURRENT_RESOLUTION "|" D_CMND_ENERGY_RESOLUTION "|" D_CMND_MODULE "|" D_CMND_MODULES "|"
|
||||
D_CMND_GPIO "|" D_CMND_GPIOS "|" D_CMND_PWM "|" D_CMND_PWMFREQUENCY "|" D_CMND_PWMRANGE "|" D_CMND_COUNTER "|" D_CMND_COUNTERTYPE "|"
|
||||
|
@ -96,6 +96,10 @@ const char kTasmotaCommands[] PROGMEM =
|
|||
D_CMND_TELEPERIOD "|" D_CMND_RESTART "|" D_CMND_RESET "|" D_CMND_TIMEZONE "|" D_CMND_TIMESTD "|" D_CMND_TIMEDST "|" D_CMND_ALTITUDE "|" D_CMND_LEDPOWER "|" D_CMND_LEDSTATE "|"
|
||||
D_CMND_I2CSCAN "|" D_CMND_SERIALSEND "|" D_CMND_BAUDRATE "|" D_CMND_SERIALDELIMITER;
|
||||
|
||||
//const uint8_t kIFan02Speed[4][3] = {{0,0,0}, {1,0,0}, {1,1,0}, {1,0,1}};
|
||||
//const uint8_t kIFan02Speed[4][3] = {{6,6,6}, {7,6,6}, {7,7,6}, {7,6,7}};
|
||||
const uint8_t kIFan02Speed[4][3] = {{16,16,16}, {17,16,16}, {17,17,16}, {17,16,17}};
|
||||
|
||||
// Global variables
|
||||
unsigned long feature_drv1; // Compiled driver feature map
|
||||
unsigned long feature_drv2; // Compiled driver feature map
|
||||
|
@ -502,6 +506,19 @@ void MqttDataHandler(char* topic, byte* data, unsigned int data_len)
|
|||
fallback_topic_flag = 0;
|
||||
return;
|
||||
}
|
||||
else if (CMND_FANSPEED == command_code) {
|
||||
uint8_t fanspeed = (uint8_t)(power &0xF) >> 1;
|
||||
if (fanspeed) { fanspeed = (fanspeed >> 1) +1; }
|
||||
if ((payload >= 0) && (payload <= 3) && (payload != fanspeed)) {
|
||||
fanspeed = payload;
|
||||
for (byte i = 0; i < 3; i++) {
|
||||
uint8_t state = kIFan02Speed[fanspeed][i];
|
||||
// uint8_t state = pgm_read_byte(kIFan02Speed +(fanspeed *3) +i);
|
||||
ExecuteCommandPower(i +2, state, SRC_IGNORE);
|
||||
}
|
||||
}
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_NVALUE, command, fanspeed);
|
||||
}
|
||||
else if (CMND_STATUS == command_code) {
|
||||
if ((payload < 0) || (payload > MAX_STATUS)) payload = 99;
|
||||
PublishStatus(payload);
|
||||
|
@ -1190,6 +1207,19 @@ void ExecuteCommandPower(byte device, byte state, int source)
|
|||
|
||||
// ShowSource(source);
|
||||
|
||||
if (SONOFF_IFAN02 == Settings.module) {
|
||||
if (state > 15) { // Only allow Fanspeed control over relay 2..4
|
||||
state -= 10;
|
||||
blink_mask &= 1;
|
||||
Settings.flag.interlock = 0;
|
||||
Settings.pulse_timer[1] = 0;
|
||||
Settings.pulse_timer[2] = 0;
|
||||
Settings.pulse_timer[3] = 0;
|
||||
} else {
|
||||
device = 1; // Only allow user control over light
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t publish_power = 1;
|
||||
if ((POWER_OFF_NO_STATE == state) || (POWER_ON_NO_STATE == state)) {
|
||||
state &= 1;
|
||||
|
|
|
@ -199,6 +199,7 @@ enum SupportedModules {
|
|||
SONOFF_S31,
|
||||
ZENGGE_ZF_WF017,
|
||||
SONOFF_POW_R2,
|
||||
SONOFF_IFAN02,
|
||||
MAXMODULE };
|
||||
|
||||
/********************************************************************************************/
|
||||
|
@ -239,6 +240,7 @@ const uint8_t kNiceList[MAXMODULE] PROGMEM = {
|
|||
SONOFF_B1,
|
||||
SONOFF_LED,
|
||||
SONOFF_BN,
|
||||
SONOFF_IFAN02,
|
||||
SONOFF_BRIDGE,
|
||||
CH1,
|
||||
CH4,
|
||||
|
@ -834,6 +836,23 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
|
|||
GPIO_REL1, // GPIO12 Red Led and Relay (0 = Off, 1 = On)
|
||||
GPIO_LED1_INV, // GPIO13 Blue Led (0 = On, 1 = Off)
|
||||
0, 0, 0, 0
|
||||
},
|
||||
{ "Sonoff iFan02", // Sonoff iFan02 (ESP8285)
|
||||
GPIO_KEY1, // GPIO00 Virtual button 1
|
||||
GPIO_USER, // GPIO01 Serial RXD and Optional sensor
|
||||
0, // GPIO02 Optional sensor
|
||||
GPIO_USER, // GPIO03 Serial TXD and Optional sensor
|
||||
GPIO_REL3, // GPIO04 Relay 3 (0 = Off, 1 = On)
|
||||
GPIO_REL2, // GPIO05 Relay 2 (0 = Off, 1 = On)
|
||||
0, 0, 0, // Flash connection
|
||||
GPIO_KEY2, // GPIO09 Virtual button 2
|
||||
GPIO_KEY3, // GPIO10 Virtual button 3
|
||||
0, // Flash connection
|
||||
GPIO_REL1, // GPIO12 Relay 1 (0 = Off, 1 = On)
|
||||
GPIO_LED1_INV, // GPIO13 Blue Led on PCA (0 = On, 1 = Off)
|
||||
GPIO_KEY4, // GPIO14 Virtual button 4
|
||||
GPIO_REL4, // GPIO15 Relay 4 (0 = Off, 1 = On)
|
||||
0, 0
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue