Skip to content

Commit 450c334

Browse files
committed
Implemented: OpenZWave, Controller Node, option for Nightly Network Heal (disabled by default)
1 parent 47bfb50 commit 450c334

File tree

6 files changed

+51
-3
lines changed

6 files changed

+51
-3
lines changed

History.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Version 2.0.xxxx (October xxth 2014)
3939
- Implemented: Manual add Thermostat2 switch (type HE105)
4040
- Implemented: OpenZWave, Blinds Percentage Inverted (Thanks to PIM)
4141
- Implemented: OpenZWave, polling all multi_sensor values now (if polling enabled)
42+
- Implemented: OpenZWave, Controller Node, option for Nightly Network Heal (disabled by default)
4243

4344
Version 2.0.2025 (September 28th 2014)
4445
- Implemented: Fibaro Link data pusher

hardware/OpenZWave.cpp

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ m_szSerialPort(devname)
265265
m_allNodesQueried = false;
266266
m_awakeNodesQueried = false;
267267
m_bInUserCodeEnrollmentMode = false;
268+
m_bNightlyNetworkHeal = false;
268269
m_pManager = NULL;
269270
}
270271

@@ -745,6 +746,11 @@ bool COpenZWave::OpenSerialConnector()
745746
OpenZWave::Manager::Get()->AddDriver(m_szSerialPort.c_str());
746747
#endif
747748
m_LastControllerConfigWrite = mytime(NULL);
749+
750+
int nightly_heal = 0;
751+
m_sql.GetPreferencesVar("ZWaveEnableNightlyNetworkHeal", nightly_heal);
752+
m_bNightlyNetworkHeal = (nightly_heal != 0);
753+
748754
//Manager::Get()->AddDriver( "HID Controller", Driver::ControllerInterface_Hid );
749755
return true;
750756
}
@@ -2727,14 +2733,29 @@ void COpenZWave::GetNodeValuesJson(const unsigned int homeID, const int nodeID,
27272733
root["result"][index]["config"][ivalue]["LastUpdate"] = "-";
27282734
ivalue++;
27292735

2736+
//Nightly Node Heal
2737+
root["result"][index]["config"][ivalue]["type"] = "short";
2738+
2739+
int nightly_heal = 0;
2740+
m_sql.GetPreferencesVar("ZWaveEnableNightlyNetworkHeal", nightly_heal);
2741+
root["result"][index]["config"][ivalue]["value"] = nightly_heal;
2742+
2743+
root["result"][index]["config"][ivalue]["index"] = 3;
2744+
root["result"][index]["config"][ivalue]["label"] = "Enable Nightly Heal Network (04:00 am)";
2745+
root["result"][index]["config"][ivalue]["units"] = "";
2746+
root["result"][index]["config"][ivalue]["help"] =
2747+
"Enable/Disable nightly heal network. Disabled=0, Enabled=1 ";
2748+
root["result"][index]["config"][ivalue]["LastUpdate"] = "-";
2749+
ivalue++;
2750+
27302751
//Network Key
27312752
root["result"][index]["config"][ivalue]["type"] = "string";
27322753

27332754
std::string sValue = "0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10";
27342755
m_sql.GetPreferencesVar("ZWaveNetworkKey", sValue);
27352756
root["result"][index]["config"][ivalue]["value"] = sValue;
27362757

2737-
root["result"][index]["config"][ivalue]["index"] = 3;
2758+
root["result"][index]["config"][ivalue]["index"] = 4;
27382759
root["result"][index]["config"][ivalue]["label"] = "Security Network Key";
27392760
root["result"][index]["config"][ivalue]["units"] = "";
27402761
root["result"][index]["config"][ivalue]["help"] =
@@ -2896,6 +2917,18 @@ bool COpenZWave::ApplyNodeConfig(const unsigned int homeID, const int nodeID, co
28962917
}
28972918
}
28982919
else if (rvIndex == 3)
2920+
{
2921+
//Nightly Node Heal
2922+
int nightly_heal = atoi(ValueVal.c_str());
2923+
int old_nightly_heal = 0;
2924+
m_sql.GetPreferencesVar("ZWaveEnableNightlyNetworkHeal", old_nightly_heal);
2925+
if (old_nightly_heal != nightly_heal)
2926+
{
2927+
m_sql.UpdatePreferencesVar("ZWaveEnableNightlyNetworkHeal", nightly_heal);
2928+
m_bNightlyNetworkHeal = (nightly_heal != 0);
2929+
}
2930+
}
2931+
else if (rvIndex == 4)
28992932
{
29002933
//Security Key
29012934
std::string networkkey = ValueVal;
@@ -3031,5 +3064,12 @@ bool COpenZWave::RemoveUserCode(const unsigned int homeID, const int nodeID, con
30313064
return true;
30323065
}
30333066

3067+
void COpenZWave::NightlyNodeHeal()
3068+
{
3069+
if (!m_bNightlyNetworkHeal)
3070+
return; //not enabled
3071+
HealNetwork();
3072+
}
3073+
30343074
#endif //WITH_OPENZWAVE
30353075

hardware/OpenZWave.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ class COpenZWave : public AsyncSerial, public ZWaveBase
104104
bool RemoveNodeFromGroup(const int nodeID,const int groupID, const int removeID);
105105
std::string GetConfigFile(std::string &szConfigFile);
106106

107+
void NightlyNodeHeal();
108+
107109
bool m_awakeNodesQueried;
108110
bool m_allNodesQueried;
109111

@@ -150,6 +152,7 @@ class COpenZWave : public AsyncSerial, public ZWaveBase
150152
bool m_bIsShuttingDown;
151153
bool m_initFailed;
152154
bool m_bInUserCodeEnrollmentMode;
155+
bool m_bNightlyNetworkHeal;
153156
};
154157

155158
#endif //WITH_OPENZWAVE

main/SQLHelper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,10 @@ bool CSQLHelper::OpenDatabase()
12581258
{
12591259
UpdatePreferencesVar("ZWaveNetworkKey", "0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10");
12601260
}
1261+
if (!GetPreferencesVar("ZWaveEnableNightlyNetworkHeal", nValue))
1262+
{
1263+
UpdatePreferencesVar("ZWaveEnableNightlyNetworkHeal", 0);
1264+
}
12611265
if (!GetPreferencesVar("BatteryLowNotification", nValue))
12621266
{
12631267
UpdatePreferencesVar("BatteryLowNotification", 0); //default disabled

main/mainworker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ void MainWorker::Do_Work()
10271027
if (pHardware->HwdType == HTYPE_OpenZWave)
10281028
{
10291029
COpenZWave *pZWave = (COpenZWave *)pHardware;
1030-
pZWave->HealNetwork();
1030+
pZWave->NightlyNodeHeal();
10311031
}
10321032
}
10331033
}

www/html5.appcache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# ref 639
2+
# ref 641
33

44
CACHE:
55
# CSS

0 commit comments

Comments
 (0)