Skip to content

Commit a1cfe34

Browse files
committed
Merge remote-tracking branch 'origin/master' into fix_deadlock_using_rxmessage_queue
2 parents 8d8965d + f7b3adf commit a1cfe34

31 files changed

+899
-186
lines changed

History.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ Version 2.3xxx
1818
- Changed: EventSystem, don't process unused devices
1919
- Implemented: MySensors, Option to Enable/Disable using ACK per Child sensor from the MySensors hardware setup page
2020
- Implemented: MySensors, Option to Name a node
21+
- Implemented: Netatmo, support for multiple weather stations (from the weathermap) and multiple rain sensors
22+
- Changed: OpenZwave, not sending cold-white in the colorclass, solved issues on different zipato bulbs
23+
- Changed: OpenZwave, kWh sensor now maybe compatible with more hardware
24+
- Fixed: Blockly, string uservariables where saved with quotes when not using with set-after
25+
- Implemented: Wind Graph, option to delete a short-log data point
26+
- Implemented: Wind Beaufort scale
2127

2228
Version 2.3530 (November 1th 2015)
2329
- Implemented: Degree Days in Temperature report

hardware/MySensorsBase.cpp

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ void MySensorsBase::LoadDevicesFromDatabase()
231231
boost::lock_guard<boost::mutex> l(readQueueMutex);
232232
m_nodes.clear();
233233

234-
std::vector<std::vector<std::string> > result;
234+
std::vector<std::vector<std::string> > result,result2;
235235
result = m_sql.safe_query("SELECT ID, Name, SketchName, SketchVersion FROM MySensors WHERE (HardwareID=%d) ORDER BY ID ASC", m_HwdID);
236236
if (result.size() > 0)
237237
{
@@ -251,6 +251,23 @@ void MySensorsBase::LoadDevicesFromDatabase()
251251
mNode.SketchName = SkectName;
252252
mNode.SketchVersion = SkectVersion;
253253
mNode.lastreceived = 0;
254+
//Load the Childs
255+
result2 = m_sql.safe_query("SELECT ChildID, [Type], [Name], UseAck FROM MySensorsChilds WHERE (HardwareID=%d) AND (NodeID=%d) ORDER BY ChildID ASC", m_HwdID, ID);
256+
if (result2.size() > 0)
257+
{
258+
std::vector<std::vector<std::string> >::const_iterator itt2;
259+
for (itt2 = result2.begin(); itt2 != result2.end(); ++itt2)
260+
{
261+
std::vector<std::string> sd2 = *itt2;
262+
_tMySensorChild mSensor;
263+
mSensor.nodeID = ID;
264+
mSensor.childID = atoi(sd2[0].c_str());
265+
mSensor.presType = (_ePresentationType)atoi(sd2[1].c_str());
266+
mSensor.childName = sd2[2];
267+
mSensor.useAck = atoi(sd2[3].c_str()) != 0;
268+
mNode.m_childs.push_back(mSensor);
269+
}
270+
}
254271
m_nodes[ID] = mNode;
255272
}
256273
}
@@ -1144,12 +1161,12 @@ bool MySensorsBase::WriteToHardware(const char *pdata, const unsigned char lengt
11441161
if ((light_command == light2_sOn) || (light_command == light2_sOff))
11451162
{
11461163
std::string lState = (light_command == light2_sOn) ? "1" : "0";
1147-
if (FindChildWithValueType(node_id, V_LOCK_STATUS) != NULL)
1164+
if (pChild->presType == S_LOCK)
11481165
{
11491166
//Door lock
11501167
return SendNodeSetCommand(node_id, child_sensor_id, MT_Set, V_LOCK_STATUS, lState, pChild->useAck);
11511168
}
1152-
else if ((FindChildWithValueType(node_id, V_SCENE_ON) != NULL) || (FindChildWithValueType(node_id, V_SCENE_OFF) != NULL))
1169+
else if (pChild->presType == S_SCENE_CONTROLLER)
11531170
{
11541171
//Scene Controller
11551172
return SendNodeSetCommand(node_id, child_sensor_id, MT_Set, (light_command == light2_sOn) ? V_SCENE_ON : V_SCENE_OFF, lState, pChild->useAck);
@@ -2027,8 +2044,7 @@ namespace http {
20272044
std::vector<std::vector<std::string> > result, result2;
20282045
char szTmp[100];
20292046

2030-
result = m_sql.safe_query("SELECT ID,Name,SketchName,SketchVersion FROM MySensors WHERE (HardwareID==%d) ORDER BY ID ASC",
2031-
iHardwareID);
2047+
result = m_sql.safe_query("SELECT ID,Name,SketchName,SketchVersion FROM MySensors WHERE (HardwareID==%d) ORDER BY ID ASC", iHardwareID);
20322048
if (result.size() > 0)
20332049
{
20342050
std::vector<std::vector<std::string> >::const_iterator itt;
@@ -2065,7 +2081,7 @@ namespace http {
20652081
{
20662082
root["result"][ii]["LastReceived"] = "-";
20672083
}
2068-
result2 = m_sql.safe_query("SELECT COUNT(*) FROM MySensorsChilds WHERE(NodeID == %d)", NodeID);
2084+
result2 = m_sql.safe_query("SELECT COUNT(*) FROM MySensorsChilds WHERE (HardwareID=%d) AND (NodeID == %d)", iHardwareID, NodeID);
20692085
int totChilds = 0;
20702086
if (!result2.empty())
20712087
{
@@ -2102,7 +2118,7 @@ namespace http {
21022118
MySensorsBase::_tMySensorNode* pNode = pMySensorsHardware->FindNode(NodeID);
21032119
std::vector<std::vector<std::string> >::const_iterator itt2;
21042120
std::vector<std::vector<std::string> > result;
2105-
result = m_sql.safe_query("SELECT ChildID, [Type], Name, UseAck FROM MySensorsChilds WHERE(NodeID == %d) ORDER BY ChildID ASC", NodeID);
2121+
result = m_sql.safe_query("SELECT ChildID, [Type], Name, UseAck FROM MySensorsChilds WHERE (HardwareID=%d) AND (NodeID == %d) ORDER BY ChildID ASC", iHardwareID, NodeID);
21062122
int ii = 0;
21072123
for (itt2 = result.begin(); itt2 != result.end(); ++itt2)
21082124
{

hardware/MySensorsTCP.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ MySensorsTCP::~MySensorsTCP(void)
2424

2525
bool MySensorsTCP::StartHardware()
2626
{
27+
LoadDevicesFromDatabase();
28+
2729
m_stoprequested=false;
2830
m_bDoRestart=false;
2931

0 commit comments

Comments
 (0)