Skip to content

Commit 70b12be

Browse files
committed
Changed: Scenes, now supports adding security devices
1 parent 685a65f commit 70b12be

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

History.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ Version 2.0.xxxx (xxxx 2015)
119119
- Changed: OpenZWave Color Command Class (you need to re-include the node)
120120
- Changed: Enlarged windows console log window
121121
- Implemented: Lithuanian language support (thanks to our translators!)
122+
- Changed: Scenes, now supports adding security devices
122123

123124
Version 2.0.2284 (February 22th 2015)
124125
- Fixed: Firefox, RGBW/Setpoint popup

main/RFXNames.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,6 +2232,11 @@ bool GetLightCommand(
22322232
cmd=sStatusPanic;
22332233
return true;
22342234
}
2235+
else if (switchcmd == "Off")
2236+
{
2237+
cmd = sStatusNormal;
2238+
return true;
2239+
}
22352240
}
22362241
else if (dSubType==sTypeSecX10M)
22372242
{

main/WebServer.cpp

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4261,13 +4261,25 @@ namespace http {
42614261
return;
42624262
int level = atoi(m_pWebEm->FindValue("level").c_str());
42634263
int hue = atoi(m_pWebEm->FindValue("hue").c_str());
4264+
4265+
std::string rState = (command == 1) ? "On" : "Off";
4266+
42644267
//first check if this device is not the scene code!
42654268
szQuery.clear();
42664269
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 << ")";
42684271
result = m_sql.query(szQuery.str());
42694272
if (result.size() > 0)
42704273
{
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+
42714283
szQuery.clear();
42724284
szQuery.str("");
42734285
szQuery << "SELECT HardwareID, DeviceID, Unit, Type, SubType FROM Scenes WHERE (ID==" << idx << ")";
@@ -4286,6 +4298,7 @@ namespace http {
42864298
return;
42874299
}
42884300
}
4301+
42894302
}
42904303
//first check if it is not already a part of this scene/group (with the same OnDelay)
42914304
szQuery.clear();
@@ -4339,6 +4352,25 @@ namespace http {
43394352
(devidx == "")
43404353
)
43414354
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+
}
43424374
int level = atoi(m_pWebEm->FindValue("level").c_str());
43434375
int hue = atoi(m_pWebEm->FindValue("hue").c_str());
43444376
root["status"] = "OK";

0 commit comments

Comments
 (0)