mirror of https://github.com/arendst/Tasmota.git
Add command ``SwitchMode0``
Add command ``SwitchMode0`` to show or set all SwitchModes
This commit is contained in:
parent
b456b97dda
commit
5bb624ad09
|
@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
|
||||||
### Added
|
### Added
|
||||||
- Matter support simple Relay on Apple Homekit by Stephan Hadinger (#18239)
|
- Matter support simple Relay on Apple Homekit by Stephan Hadinger (#18239)
|
||||||
- VSC Pio menu bar extensions by @Jason2866 (#18233)
|
- VSC Pio menu bar extensions by @Jason2866 (#18233)
|
||||||
|
- Command ``SwitchMode0`` to show or set all SwitchModes
|
||||||
|
|
||||||
### Breaking Changed
|
### Breaking Changed
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
||||||
|
|
||||||
## Changelog v12.4.0.4
|
## Changelog v12.4.0.4
|
||||||
### Added
|
### Added
|
||||||
|
- Command ``SwitchMode0`` to show or set all SwitchModes
|
||||||
- Support for multiple MCP23008/MCP23017/MCP23S17 as switch/button/relay
|
- Support for multiple MCP23008/MCP23017/MCP23S17 as switch/button/relay
|
||||||
- Support for multiple PCF8574 as switch/button/relay
|
- Support for multiple PCF8574 as switch/button/relay
|
||||||
- NTP time request from gateway [#17984](https://github.com/arendst/Tasmota/issues/17984)
|
- NTP time request from gateway [#17984](https://github.com/arendst/Tasmota/issues/17984)
|
||||||
|
|
|
@ -2139,14 +2139,31 @@ void CmndSwitchText(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CmndSwitchMode(void)
|
void CmndSwitchMode(void) {
|
||||||
{
|
|
||||||
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_SWITCHES_SET)) {
|
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_SWITCHES_SET)) {
|
||||||
|
// SwitchMode1 - Show SwitchMode1
|
||||||
|
// SwitchMode1 2 - Set SwitchMode tot 2
|
||||||
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < MAX_SWITCH_OPTION)) {
|
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < MAX_SWITCH_OPTION)) {
|
||||||
Settings->switchmode[XdrvMailbox.index -1] = XdrvMailbox.payload;
|
Settings->switchmode[XdrvMailbox.index -1] = XdrvMailbox.payload;
|
||||||
}
|
}
|
||||||
ResponseCmndIdxNumber(Settings->switchmode[XdrvMailbox.index-1]);
|
ResponseCmndIdxNumber(Settings->switchmode[XdrvMailbox.index-1]);
|
||||||
}
|
}
|
||||||
|
else if (0 == XdrvMailbox.index) {
|
||||||
|
// SwitchMode0 - Show all SwitchMode like {"SwitchMode":[2,2,2,2,2,2,2,2,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}
|
||||||
|
// SwitchMode0 2 - Set all SwitchMode to 2
|
||||||
|
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < MAX_SWITCH_OPTION)) {
|
||||||
|
for (uint32_t i = 0; i < MAX_SWITCHES_SET; i++) {
|
||||||
|
Settings->switchmode[i] = XdrvMailbox.payload;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
char stemp[MAX_SWITCHES_SET * 3];
|
||||||
|
stemp[0] = '\0';
|
||||||
|
for (uint32_t i = 0; i < MAX_SWITCHES_SET; i++) {
|
||||||
|
snprintf_P(stemp, sizeof(stemp), PSTR("%s%s%d" ), stemp, (i > 0 ? "," : "["), Settings->switchmode[i]);
|
||||||
|
}
|
||||||
|
strcat(stemp, "]");
|
||||||
|
Response_P(S_JSON_COMMAND_XVALUE, XdrvMailbox.command, stemp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CmndInterlock(void)
|
void CmndInterlock(void)
|
||||||
|
|
Loading…
Reference in New Issue