Add command Power0 0/1/2/Off/On/Toggle to control all power outputs at once

Add command Power0 0/1/2/Off/On/Toggle to control all power outputs at once (#6340)
This commit is contained in:
Theo Arends 2019-09-03 23:04:49 +02:00
parent 41f76c5128
commit 34eed717fa
2 changed files with 11 additions and 1 deletions

View File

@ -6,6 +6,7 @@
* Add 'sonoff-ir' pre-packaged IR-dedicated firmware and 'sonoff-ircustom' to customize firmware with IR Full protocol support
* Add Zigbee support phase 2 - cc2530 initialization and basic ZCL decoding
* Add driver USE_SDM120_2 with Domoticz P1 Smart Meter functionality as future replacement for USE_SDM120 - Pls test and report
* Add command Power0 0/1/2/Off/On/Toggle to control all power outputs at once (#6340)
*
* 6.6.0.8 20190827
* Add Tuya Energy monitoring by Shantur Rathore

View File

@ -258,10 +258,19 @@ void CmndPower(void)
{
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= devices_present)) {
if ((XdrvMailbox.payload < 0) || (XdrvMailbox.payload > 4)) { XdrvMailbox.payload = 9; }
// Settings.flag.device_index_enable = user_index;
// Settings.flag.device_index_enable = XdrvMailbox.usridx;
ExecuteCommandPower(XdrvMailbox.index, XdrvMailbox.payload, SRC_IGNORE);
mqtt_data[0] = '\0';
}
else if (0 == XdrvMailbox.index) {
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload <= 2)) {
if (2 == XdrvMailbox.payload) {
XdrvMailbox.payload = (power) ? 0 : 1;
}
SetAllPower(XdrvMailbox.payload, SRC_IGNORE);
mqtt_data[0] = '\0';
}
}
}
void CmndStatus(void)