@@ -4261,13 +4261,25 @@ namespace http {
4261
4261
return;
4262
4262
int level = atoi(m_pWebEm->FindValue("level").c_str());
4263
4263
int hue = atoi(m_pWebEm->FindValue("hue").c_str());
4264
+
4265
+ std::string rState = (command == 1) ? "On" : "Off";
4266
+
4264
4267
//first check if this device is not the scene code!
4265
4268
szQuery.clear();
4266
4269
szQuery.str("");
4267
- szQuery << "SELECT HardwareID, DeviceID, Unit, Type, SubType FROM DeviceStatus WHERE (ID==" << devidx << ")";
4270
+ szQuery << "SELECT HardwareID, DeviceID, Unit, Type, SubType, SwitchType FROM DeviceStatus WHERE (ID==" << devidx << ")";
4268
4271
result = m_sql.query(szQuery.str());
4269
4272
if (result.size() > 0)
4270
4273
{
4274
+ int dType = atoi(result[0][3].c_str());
4275
+ int sType = atoi(result[0][4].c_str());
4276
+ _eSwitchType switchtype = (_eSwitchType)atoi(result[0][5].c_str());
4277
+ unsigned char scommand;
4278
+ if (GetLightCommand(dType, sType, switchtype, rState, scommand))
4279
+ {
4280
+ command = scommand;
4281
+ }
4282
+
4271
4283
szQuery.clear();
4272
4284
szQuery.str("");
4273
4285
szQuery << "SELECT HardwareID, DeviceID, Unit, Type, SubType FROM Scenes WHERE (ID==" << idx << ")";
@@ -4286,6 +4298,7 @@ namespace http {
4286
4298
return;
4287
4299
}
4288
4300
}
4301
+
4289
4302
}
4290
4303
//first check if it is not already a part of this scene/group (with the same OnDelay)
4291
4304
szQuery.clear();
@@ -4339,6 +4352,25 @@ namespace http {
4339
4352
(devidx == "")
4340
4353
)
4341
4354
return;
4355
+
4356
+ std::string rState = (command == 1) ? "On" : "Off";
4357
+
4358
+ //first check if this device is not the scene code!
4359
+ szQuery.clear();
4360
+ szQuery.str("");
4361
+ szQuery << "SELECT HardwareID, DeviceID, Unit, Type, SubType, SwitchType FROM DeviceStatus WHERE (ID==" << devidx << ")";
4362
+ result = m_sql.query(szQuery.str());
4363
+ if (result.size() > 0)
4364
+ {
4365
+ int dType = atoi(result[0][3].c_str());
4366
+ int sType = atoi(result[0][4].c_str());
4367
+ _eSwitchType switchtype = (_eSwitchType)atoi(result[0][5].c_str());
4368
+ unsigned char scommand;
4369
+ if (GetLightCommand(dType, sType, switchtype, rState, scommand))
4370
+ {
4371
+ command = scommand;
4372
+ }
4373
+ }
4342
4374
int level = atoi(m_pWebEm->FindValue("level").c_str());
4343
4375
int hue = atoi(m_pWebEm->FindValue("hue").c_str());
4344
4376
root["status"] = "OK";
0 commit comments