mirror of https://github.com/arendst/Tasmota.git
readd TimePropCommand
This commit is contained in:
parent
ef2525fcdd
commit
97f3a7d438
|
@ -87,6 +87,8 @@
|
||||||
#define D_CMND_TIMEPROP "timeprop_"
|
#define D_CMND_TIMEPROP "timeprop_"
|
||||||
#define D_CMND_TIMEPROP_SETPOWER "setpower_" // add index no on end (0:8) and data is power 0:1
|
#define D_CMND_TIMEPROP_SETPOWER "setpower_" // add index no on end (0:8) and data is power 0:1
|
||||||
|
|
||||||
|
#include "Timeprop.h"
|
||||||
|
|
||||||
enum TimepropCommands { CMND_TIMEPROP_SETPOWER };
|
enum TimepropCommands { CMND_TIMEPROP_SETPOWER };
|
||||||
const char kTimepropCommands[] PROGMEM = D_CMND_TIMEPROP_SETPOWER;
|
const char kTimepropCommands[] PROGMEM = D_CMND_TIMEPROP_SETPOWER;
|
||||||
|
|
||||||
|
@ -117,8 +119,6 @@ static long currentRelayStates = 0; // current actual relay states. Bit 0 first
|
||||||
#define TIMEPROP_RELAYS 1 // which relay to control 1:8
|
#define TIMEPROP_RELAYS 1 // which relay to control 1:8
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "Timeprop.h"
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
Timeprop timeprops[TIMEPROP_NUM_OUTPUTS];
|
Timeprop timeprops[TIMEPROP_NUM_OUTPUTS];
|
||||||
int relay_nos[TIMEPROP_NUM_OUTPUTS] = {TIMEPROP_RELAYS};
|
int relay_nos[TIMEPROP_NUM_OUTPUTS] = {TIMEPROP_RELAYS};
|
||||||
|
@ -209,7 +209,7 @@ bool TimepropCommand()
|
||||||
AddLog(LOG_LEVEL_INFO);
|
AddLog(LOG_LEVEL_INFO);
|
||||||
*/
|
*/
|
||||||
if (XdrvMailbox.index >=0 && XdrvMailbox.index < TIMEPROP_NUM_OUTPUTS) {
|
if (XdrvMailbox.index >=0 && XdrvMailbox.index < TIMEPROP_NUM_OUTPUTS) {
|
||||||
timeprops[XdrvMailbox.index].setPower( atof(XdrvMailbox.data), timeprop_current_time_secs );
|
timeprops[XdrvMailbox.index].setPower( atof(XdrvMailbox.data), Tprop.current_time_secs );
|
||||||
}
|
}
|
||||||
snprintf_P(TasmotaGlobal.mqtt_data, sizeof(TasmotaGlobal.mqtt_data), PSTR("{\"" D_CMND_TIMEPROP D_CMND_TIMEPROP_SETPOWER "%d\":\"%s\"}"),
|
snprintf_P(TasmotaGlobal.mqtt_data, sizeof(TasmotaGlobal.mqtt_data), PSTR("{\"" D_CMND_TIMEPROP D_CMND_TIMEPROP_SETPOWER "%d\":\"%s\"}"),
|
||||||
XdrvMailbox.index, XdrvMailbox.data);
|
XdrvMailbox.index, XdrvMailbox.data);
|
||||||
|
@ -239,9 +239,6 @@ bool Xdrv48(byte function) {
|
||||||
case FUNC_EVERY_SECOND:
|
case FUNC_EVERY_SECOND:
|
||||||
TimepropEverySecond();
|
TimepropEverySecond();
|
||||||
break;
|
break;
|
||||||
case FUNC_COMMAND:
|
|
||||||
result = TimepropCommand();
|
|
||||||
break;
|
|
||||||
case FUNC_COMMAND:
|
case FUNC_COMMAND:
|
||||||
result = TimepropCommand();
|
result = TimepropCommand();
|
||||||
break;
|
break;
|
||||||
|
@ -252,5 +249,4 @@ bool Xdrv48(byte function) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // FIRMWARE_MINIMAL
|
|
||||||
#endif // USE_TIMEPROP
|
#endif // USE_TIMEPROP
|
||||||
|
|
Loading…
Reference in New Issue