@@ -9774,7 +9774,7 @@ bool MainWorker::SwitchLight(const unsigned long long idx, const std::string &sw
9774
9774
{
9775
9775
if (ExtraDelay != 0 )
9776
9776
{
9777
- _log.Log (LOG_NORM, " Delaying switch [%s] action for %d seconds" , result[0 ][8 ].c_str (), ExtraDelay);
9777
+ _log.Log (LOG_NORM, " Delaying switch [%s] action (%s) for %d seconds" , result[0 ][8 ]. c_str (), switchcmd .c_str (), ExtraDelay);
9778
9778
}
9779
9779
m_sql.AddTaskItem (_tTaskItem::SwitchLightEvent (iOnDelay + ExtraDelay, idx, switchcmd, level, hue, " Switch with Delay" ));
9780
9780
return true ;
@@ -10167,8 +10167,7 @@ bool MainWorker::SwitchScene(const unsigned long long idx, const std::string &sw
10167
10167
std::string offaction=" " ;
10168
10168
10169
10169
// Get Scene Name
10170
- sprintf (szTmp, " SELECT Name, SceneType, OnAction, OffAction FROM Scenes WHERE (ID == %llu)" ,
10171
- idx);
10170
+ sprintf (szTmp, " SELECT Name, SceneType, OnAction, OffAction FROM Scenes WHERE (ID == %llu)" , idx);
10172
10171
result=m_sql.query (szTmp);
10173
10172
if (result.size ()>0 )
10174
10173
{
@@ -10219,6 +10218,7 @@ bool MainWorker::SwitchScene(const unsigned long long idx, const std::string &sw
10219
10218
}
10220
10219
}
10221
10220
10221
+ _log.Log (LOG_NORM, " Activating Scene/Group: %s" , Name.c_str ());
10222
10222
10223
10223
// now switch all attached devices, and only the onces that do not trigger a scene
10224
10224
std::stringstream szQuery;
@@ -10248,13 +10248,14 @@ bool MainWorker::SwitchScene(const unsigned long long idx, const std::string &sw
10248
10248
unsigned char Unit=atoi (sd2[2 ].c_str ());
10249
10249
unsigned char dType=atoi (sd2[3 ].c_str ());
10250
10250
unsigned char dSubType=atoi (sd2[4 ].c_str ());
10251
+ std::string DeviceName = sd2[8 ];
10251
10252
_eSwitchType switchtype=(_eSwitchType)atoi (sd2[5 ].c_str ());
10252
10253
10253
10254
// Check if this device will not activate a scene
10254
10255
int hwID=atoi (sd2[0 ].c_str ());
10255
10256
if (DoesDeviceActiveAScene (hwID,sd2[1 ],Unit,dType,dSubType))
10256
10257
{
10257
- _log.Log (LOG_ERROR," Skipping sensor '%s' because this triggers another scene!" ,sd2[ 8 ] .c_str ());
10258
+ _log.Log (LOG_ERROR, " Skipping sensor '%s' because this triggers another scene!" , DeviceName .c_str ());
10258
10259
continue ;
10259
10260
}
10260
10261
@@ -10276,7 +10277,7 @@ bool MainWorker::SwitchScene(const unsigned long long idx, const std::string &sw
10276
10277
else
10277
10278
GetLightStatus (dType, dSubType, switchtype,rnValue, sValue , lstatus, llevel, bHaveDimmer, maxDimLevel, bHaveGroupCmd);
10278
10279
10279
- _log.Log (LOG_NORM," Activating Scene/Group: %s (%s)" ,Name .c_str (),intswitchcmd.c_str ());
10280
+ _log.Log (LOG_NORM, " Activating Scene/Group Device : %s (%s)" , DeviceName .c_str (), intswitchcmd.c_str ());
10280
10281
10281
10282
int ilevel=maxDimLevel-1 ;
10282
10283
@@ -10301,6 +10302,11 @@ bool MainWorker::SwitchScene(const unsigned long long idx, const std::string &sw
10301
10302
{
10302
10303
int delay = (intswitchcmd == " Off" ) ? offdelay : ondelay;
10303
10304
SwitchLight (idx, intswitchcmd, ilevel, hue, false , delay);
10305
+ if ((intswitchcmd != " Off" ) && (offdelay > 0 ))
10306
+ {
10307
+ // switch with on delay, and off delay
10308
+ SwitchLight (idx, " Off" , ilevel, hue, false , ondelay+offdelay);
10309
+ }
10304
10310
// SwitchLightInt(sd2,intswitchcmd,ilevel,hue,false);
10305
10311
}
10306
10312
else
0 commit comments