mirror of https://github.com/arendst/Tasmota.git
Change commands Tariff
Change commands Tariff1 22,23 = Tariff1 (Off-Peak) ST,DST Tariff2 (Standard) 6,7 = Tariff2 ST,DST Tariff9 0/1 = Weekend toggle (1 = Off-Peak during weekend)
This commit is contained in:
parent
99dcfaff35
commit
a4e1c10953
|
@ -1,7 +1,7 @@
|
|||
/*********************************************************************************************\
|
||||
* 6.6.0.12 20190910
|
||||
* Redesign command Tariff to now default to 0 (=disabled) and allowing to set both Standard Time (ST) and Daylight Savings Time (DST) start hour
|
||||
* Commands Tariff1 23 = Tariff1 ST, Tariff2 7 = Tariff2 ST, Tarriff3 22 = Tarrif1 DST, Tariff4 6 = Tariff2 DST, Tariff9 0/1 = Weekend toggle
|
||||
* Commands Tariff1 22,23 = Tariff1 (Off-Peak) ST,DST Tariff2 (Standard) 6,7 = Tariff2 ST,DST Tariff9 0/1 = Weekend toggle (1 = Off-Peak during weekend)
|
||||
*
|
||||
* 6.6.0.11 20190907
|
||||
* Change Settings crc calculation allowing short term backward compatibility
|
||||
|
|
|
@ -516,14 +516,21 @@ void CmndEnergyReset(void)
|
|||
|
||||
void CmndTariff(void)
|
||||
{
|
||||
// Tariff1 23 - Standard Time Tariff1 start hour
|
||||
// Tariff2 7 - Standard Time Tariff2 start hour
|
||||
// Tariff3 22 - Daylight Savings Time Tariff1 start hour
|
||||
// Tariff4 6 - Daylight Savings Time Tariff2 start hour
|
||||
// Tariff1 22,23 - Tariff1 start hour for Standard Time and Daylight Savings Time
|
||||
// Tariff2 6,7 - Tariff2 start hour for Standard Time and Daylight Savings Time
|
||||
// Tariff9 0/1
|
||||
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= 4)) {
|
||||
if ((XdrvMailbox.payload >= 0) && (XdrvMailbox.payload < 24)) {
|
||||
Settings.register8[R8_ENERGY_TARIFF1_ST + XdrvMailbox.index -1] = XdrvMailbox.payload;
|
||||
|
||||
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= 2)) {
|
||||
char *p;
|
||||
char *str = strtok_r(XdrvMailbox.data, ", ", &p);
|
||||
uint32_t time_type = 0;
|
||||
while ((str != nullptr) && (time_type <= 2)) {
|
||||
uint8_t value = strtol(str, nullptr, 10);
|
||||
if ((value >= 0) && (value < 24)) {
|
||||
Settings.register8[R8_ENERGY_TARIFF1_ST + (XdrvMailbox.index -1) + time_type] = value;
|
||||
}
|
||||
str = strtok_r(nullptr, ", ", &p);
|
||||
time_type += 2;
|
||||
}
|
||||
}
|
||||
else if (XdrvMailbox.index == 9) {
|
||||
|
|
Loading…
Reference in New Issue