Critical AC fix

Some additional commands compatibility for generic driver
This commit is contained in:
2019-09-22 00:25:25 +03:00
parent e487db022a
commit 7c9d9d171b
2 changed files with 11 additions and 5 deletions

View File

@@ -496,7 +496,12 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send, int suffixCode
} }
if (driver) return driver->Ctrl(cmd, n, Parameters, send, suffixCode, subItem); if (driver)
{
int res = driver->Ctrl(cmd, n, Parameters, send, suffixCode, subItem);
setCmd(cmd);
return res;
}
// Legacy code // Legacy code
bool toExecute = (chActive>0); //if channel is already active - unconditionally propogate changes bool toExecute = (chActive>0); //if channel is already active - unconditionally propogate changes
switch (cmd) { switch (cmd) {

View File

@@ -250,11 +250,11 @@ int out_AC::Ctrl(short cmd, short n, int * Parameters, boolean send, int suffixC
switch(suffixCode) switch(suffixCode)
{ {
case S_SET: case S_SET:
set_tmp = Parameters[0]-16; set_tmp = Parameters[0];
if (set_tmp >= 0 && set_tmp <= 30) if (set_tmp >= 10 && set_tmp <= 30)
{ {
data[B_SET_TMP] = set_tmp; data[B_SET_TMP] = set_tmp -16;
if (send) publishTopic(item->itemArr->name,(long)Parameters[0],"/set"); if (send) publishTopic(item->itemArr->name,(long) set_tmp,"/set");
} }
break; break;
@@ -263,6 +263,7 @@ int out_AC::Ctrl(short cmd, short n, int * Parameters, boolean send, int suffixC
switch (cmd) switch (cmd)
{ {
case CMD_ON: case CMD_ON:
case CMD_XON:
data[B_POWER] |= 1; data[B_POWER] |= 1;
SendData(on, sizeof(on)/sizeof(byte)); SendData(on, sizeof(on)/sizeof(byte));
if (send) publishTopic(item->itemArr->name,"ON","/cmd"); if (send) publishTopic(item->itemArr->name,"ON","/cmd");