mirror of https://github.com/arendst/Tasmota.git
Fix rule trigger POWER1#STATE
Fix rule trigger POWER1#STATE execution after restart and SetOption0 is 0 (#3856)
This commit is contained in:
parent
665a4abc47
commit
f05fc71d67
|
@ -4,6 +4,7 @@
|
||||||
* Add support for PCA9685 12bit 16pin hardware PWM driver (#3866)
|
* Add support for PCA9685 12bit 16pin hardware PWM driver (#3866)
|
||||||
* Add power value below 5W to Sonoff Pow R2 and S31 (#3745)
|
* Add power value below 5W to Sonoff Pow R2 and S31 (#3745)
|
||||||
* Add force_update to Home Assistant discovery (#3873)
|
* Add force_update to Home Assistant discovery (#3873)
|
||||||
|
* Fix rule trigger POWER1#STATE execution after restart and SetOption0 is 0 (#3856)
|
||||||
*
|
*
|
||||||
* 6.2.1.5 20180921
|
* 6.2.1.5 20180921
|
||||||
* Add authentication to HTTP web pages
|
* Add authentication to HTTP web pages
|
||||||
|
|
|
@ -203,7 +203,7 @@ enum LichtSubtypes {LST_NONE, LST_SINGLE, LST_COLDWARM, LST_RGB, LST_RGBW, LST_R
|
||||||
enum LichtSchemes {LS_POWER, LS_WAKEUP, LS_CYCLEUP, LS_CYCLEDN, LS_RANDOM, LS_MAX};
|
enum LichtSchemes {LS_POWER, LS_WAKEUP, LS_CYCLEUP, LS_CYCLEDN, LS_RANDOM, LS_MAX};
|
||||||
|
|
||||||
enum XsnsFunctions {FUNC_PRE_INIT, FUNC_INIT, FUNC_LOOP, FUNC_EVERY_50_MSECOND, FUNC_EVERY_100_MSECOND, FUNC_EVERY_200_MSECOND, FUNC_EVERY_250_MSECOND, FUNC_EVERY_SECOND, FUNC_PREP_BEFORE_TELEPERIOD,
|
enum XsnsFunctions {FUNC_PRE_INIT, FUNC_INIT, FUNC_LOOP, FUNC_EVERY_50_MSECOND, FUNC_EVERY_100_MSECOND, FUNC_EVERY_200_MSECOND, FUNC_EVERY_250_MSECOND, FUNC_EVERY_SECOND, FUNC_PREP_BEFORE_TELEPERIOD,
|
||||||
FUNC_JSON_APPEND, FUNC_WEB_APPEND, FUNC_SAVE_BEFORE_RESTART, FUNC_COMMAND, FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA, FUNC_SET_POWER, FUNC_SHOW_SENSOR,
|
FUNC_JSON_APPEND, FUNC_WEB_APPEND, FUNC_SAVE_BEFORE_RESTART, FUNC_COMMAND, FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA, FUNC_SET_POWER, FUNC_RULE_INIT_POWER, FUNC_SHOW_SENSOR,
|
||||||
FUNC_RULES_PROCESS, FUNC_SERIAL, FUNC_FREE_MEM};
|
FUNC_RULES_PROCESS, FUNC_SERIAL, FUNC_FREE_MEM};
|
||||||
|
|
||||||
const uint8_t kDefaultRfCode[9] PROGMEM = { 0x21, 0x16, 0x01, 0x0E, 0x03, 0x48, 0x2E, 0x1A, 0x00 };
|
const uint8_t kDefaultRfCode[9] PROGMEM = { 0x21, 0x16, 0x01, 0x0E, 0x03, 0x48, 0x2E, 0x1A, 0x00 };
|
||||||
|
|
|
@ -335,7 +335,8 @@ void SetDevicePower(power_t rpower, int source)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XdrvSetPower(rpower);
|
XdrvMailbox.index = rpower;
|
||||||
|
XdrvCall(FUNC_SET_POWER);
|
||||||
|
|
||||||
if ((SONOFF_DUAL == Settings.module) || (CH4 == Settings.module)) {
|
if ((SONOFF_DUAL == Settings.module) || (CH4 == Settings.module)) {
|
||||||
Serial.write(0xA0);
|
Serial.write(0xA0);
|
||||||
|
@ -2613,6 +2614,9 @@ void setup()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XdrvMailbox.index = power;
|
||||||
|
XdrvCall(FUNC_RULE_INIT_POWER);
|
||||||
|
|
||||||
blink_powersave = power;
|
blink_powersave = power;
|
||||||
|
|
||||||
snprintf_P(log_data, sizeof(log_data), PSTR(D_PROJECT " %s %s (" D_CMND_TOPIC " %s, " D_FALLBACK " %s, " D_CMND_GROUPTOPIC " %s) " D_VERSION " %s-" ARDUINO_ESP8266_RELEASE),
|
snprintf_P(log_data, sizeof(log_data), PSTR(D_PROJECT " %s %s (" D_CMND_TOPIC " %s, " D_FALLBACK " %s, " D_CMND_GROUPTOPIC " %s) " D_VERSION " %s-" ARDUINO_ESP8266_RELEASE),
|
||||||
|
|
|
@ -628,6 +628,7 @@ boolean Xdrv10(byte function)
|
||||||
case FUNC_EVERY_SECOND:
|
case FUNC_EVERY_SECOND:
|
||||||
RulesEverySecond();
|
RulesEverySecond();
|
||||||
break;
|
break;
|
||||||
|
case FUNC_RULE_INIT_POWER:
|
||||||
case FUNC_SET_POWER:
|
case FUNC_SET_POWER:
|
||||||
RulesSetPower();
|
RulesSetPower();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -153,14 +153,6 @@ boolean XdrvCommand(uint8_t grpflg, char *type, uint16_t index, char *dataBuf, u
|
||||||
return XdrvCall(FUNC_COMMAND);
|
return XdrvCall(FUNC_COMMAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
void XdrvSetPower(power_t mpower)
|
|
||||||
{
|
|
||||||
// XdrvMailbox.valid = 1;
|
|
||||||
XdrvMailbox.index = mpower;
|
|
||||||
|
|
||||||
XdrvCall(FUNC_SET_POWER);
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean XdrvMqttData(char *topicBuf, uint16_t stopicBuf, char *dataBuf, uint16_t sdataBuf)
|
boolean XdrvMqttData(char *topicBuf, uint16_t stopicBuf, char *dataBuf, uint16_t sdataBuf)
|
||||||
{
|
{
|
||||||
XdrvMailbox.index = stopicBuf;
|
XdrvMailbox.index = stopicBuf;
|
||||||
|
|
Loading…
Reference in New Issue